Re: [v3 PATCH] input: Read standard input byte-wise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/01/2023 08:59, Herbert Xu wrote:
On Tue, Jan 03, 2023 at 11:54:55AM +0000, Harald van Dijk wrote:

Does it? preadbuffer() knows to call history() with the H_APPEND flag to
append a next chunk of input to what was already added to the buffer.

It only uses H_APPEND once a newline has been detected and
whichprompt switches over to PS2.

Oh yeah, that's something I'd changed in my version already in 2019 for other reasons. I missed that dash didn't do the same. There are a few separate but related bugs in the history handling, and until they are fixed, agreed that simply reading one bye at a time will make these more prominent.

One is that because of what you say, the history recording for commands greater than BUFSIZ is already buggy, but unlikely to pose a problem in practice currently because normally, people don't write such long commands.

Another is that the stripping of blank lines from history breaks when blank lines are significant, as in

  $ cat <<EOF
  > hello
  >
  > world
  > EOF
  hello

  world
  $ fc 1
  26
  q
  hello
  world

Note how the blank line was lost.

If there was already "something" (as the code puts it), then when more data is appended, blanks must be preserved.

There may be more that I am not seeing right now.

Cheers,
Harald van Dijk



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux