Page MenuHomeFreeBSD

ul(1) truncates long lines
ClosedPublic

Authored by gahr on Jun 17 2016, 2:40 PM.

Details

Summary

ul(1) holds a static buffer of 512 characters and truncates any line longer than that.

The attached patch allows expanding the buffer to accommodate lines longer than 512 characters. This is only done on the first occurrence of such a line, so for most files no dynamic allocation is needed.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210344

Test Plan

Unpatched version

 # perl -e 'print "A" x 512; print "BBB\n"' | /usr/bin/ul
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA

Patched version

# perl -e 'print "A" x 512; print "BBB\n"' | ./ul                                                                           
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAABBB

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gahr retitled this revision from to ul(1) truncates long lines.
gahr updated this object.
gahr edited the test plan for this revision. (Show Details)
gahr added a reviewer: cognet.
gahr set the repository for this revision to rS FreeBSD src repository - subversion.
gahr removed rS FreeBSD src repository - subversion as the repository for this revision.

Fixed C99-style comments.

bapt added a reviewer: bapt.
This revision is now accepted and ready to land.Jun 17 2016, 3:35 PM
gahr edited edge metadata.
gahr set the repository for this revision to rS FreeBSD src repository - subversion.

No initialization in definition of int copy.

This revision now requires review to proceed.Jun 17 2016, 3:38 PM
bapt edited edge metadata.
This revision is now accepted and ready to land.Jul 1 2016, 7:12 AM
This revision was automatically updated to reflect the committed changes.