[LLVMbugs] [Bug 6228] New: ASCII NUL bytes in output of `llvm-ar t`

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Feb 3 22:07:50 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=6228

           Summary: ASCII NUL bytes in output of `llvm-ar t`
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: abbeyj at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4171)
 --> (http://llvm.org/bugs/attachment.cgi?id=4171)
Remove NUL padding bytes when reading archive

Running `llvm-ar t` on certain archives will produce ASCII NUL bytes in the
output.  These are normally invisible but they don't belong there and are
causing test/Archive/toc_MacOSX.ll to fail on Windows.  When diff sees two
"binary" files that have different line endings it reports them as different
and the test fails.

The MacOSX.a archive has the names NUL padded up to (I believe) 8 byte
boundaries.  These NULs need to be trimmed off on reading.

STR:
$ llvm-ar t test/Archive/MacOSX.a | od -c

Expected output:
0000000   _   _   .   S   Y   M   D   E   F       S   O   R   T   E   D
0000020  \r  \n   e   v   e   n   l   e   n  \r  \n   o   d   d   l   e
0000040   n  \r  \n   v   e   r   y   _   l   o   n   g   _   b   y   t
0000060   e   c   o   d   e   _   f   i   l   e   _   n   a   m   e   .
0000100   b   c  \r  \n   I   s   N   A   N   .   o  \r  \n
0000115
(possibly with different platform-appropriate line endings)

Actual output:
0000000   _   _   .   S   Y   M   D   E   F       S   O   R   T   E   D
0000020  \0  \0  \0  \0  \r  \n   e   v   e   n   l   e   n  \0  \0  \0
0000040  \0  \0  \r  \n   o   d   d   l   e   n  \0  \0  \0  \0  \0  \0
0000060  \r  \n   v   e   r   y   _   l   o   n   g   _   b   y   t   e
0000100   c   o   d   e   _   f   i   l   e   _   n   a   m   e   .   b
0000120   c  \0  \0  \0  \0  \0  \r  \n   I   s   N   A   N   .   o  \0
0000140  \0  \0  \0  \0  \r  \n
0000146


Attached patch removes the extra NUL bytes from the output and changes
test/Archive/MacOSX.toc from a binary to a text file (removes
svn:mime-type=application/octet-stream and adds svn:eol-style=native).  I can't
figure out how to get SVN to include the new contents of the file in the patch
so I'm attaching it separately.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list