Greetings! There is a bug in our fold(1), so 'fold -s' keeps trailing whitespace at the end of the line. (I fold my DESCR text to 80 column with fold and pkglint complained all the time.) A small test case to show the problem: $ echo 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB '>test.txt < $ cat test.txt AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB $ /usr/bin/fold -s test.txt | tr ' ' _ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB_ With my patch: $ ./fold -s test.txt | tr ' ' _ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB_ I believe the following patch is the correct fix for the issue. Any comments? --- /usr/src/usr.bin/fold/fold.c 2003-10-16 08:48:03.000000000 +0200 +++ fold.c 2008-07-08 16:01:58.000000000 +0200 @@ -155,9 +155,9 @@ } if (split_words && last_space != -1) { - last_space++; - fwrite (buf, 1, last_space, stdout); + + last_space++; memmove (buf, buf+last_space, indx-last_space); indx -= last_space; -- Adam Hoka <ahoka%NetBSD.org@localhost>
Attachment:
pgpn6iwb7hwnd.pgp
Description: PGP signature