Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 May 2015 13:02:06 +0200
From:      Dirk Engling <erdgeist@erdgeist.org>
To:        freebsd-hackers@freebsd.org
Subject:   lam silently spills overly long lines
Message-ID:  <5558752E.8030404@erdgeist.org>

next in thread | raw e-mail | index | archive | help
Dear all,

when working on a set of files quite large files I noticed that lam(1)
would suddenly start combining lines that clearly don't belong together.

I tracked it down to a single overly long line (with overly meaning >
BUFSIZ from stdio.h) in one of the files and noticed that in

https://svnweb.freebsd.org/base/head/usr.bin/lam/lam.c?revision=227240&view=markup#l201

the function gatherline would not consume all chars up to the eol marker
for that file, leaving the reminder of that particular input line
fragment for the next output line, in turn screwing up the output.

I find that behaviour surprising and would expect a) lam not to choke on
lines over an arbitrary size limit or b) try to get itself in a
consistent state in this easily to understand situation and/or c) exit
or at least issue a warning while doing something unexpected.

I finally switched to using the paste(1) tool where this problem does
not occur but still found the issue annoying enough to send this email.
I also offer to write the patch.

  erdgeist



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5558752E.8030404>