Subject: Re: bug#27136: info coreutils

From: kalle <[email-masked]>
Date: Sun, 13 Aug 2017 12:22:46 +0200

hmm. no one is responding anymore. No change in cat-Documentation then?

Am 25.07.2017 um 00:31 schrieb kalle:
> 
> 
> Am 30.05.2017 um 00:08 schrieb Pádraig Brady:
>> On 29/05/17 14:06, kalle wrote:
>>> hello,
>>> I think it is not obvious for everyone how to deal with Standard Input in the `cat'-command. I took some time to figure out, that Ctrl-d  aborts it. and just now I realized, that EOF the first time acts to terminate a so called "record" (I got the term from "info coreutils 'tac'"), and applied twice terminates the Standard Input. If <newline> was typed before it is enough to type it once.
>>> So I think it would be helpful for some people if in the documentations man/info cat there would be at least a reference, if not a short explanation how to deal with Standard Input.
>>
>> Note this is nothing specific to cat or coreutils for that matter.
>> This applies to all programs and is specific to the terminal driver.
> 
>> Now where info like this should be documented is an interesting question.
> 
> maybe in a general unix-introduction. Then for all commands, where "end
> input" has to be given in instead of Enter/linefeed, it should  be
> referred to some explaining text. There could be a manual about the role
> of terminal drivers, possibly man 7.
> 
>> Perhaps coreutils should take some responsibility for documenting such things?
>>
>> Anyway some info for what is happening here...
>> Note there is no "record" distinction here.
>> The Ctrl-d combo just means "end input". I.E. send pending input to the program.
>> When there is text on the line already this is sent, and usually (as cat does too)
>> the program will read() again looking for more input. If you send pending input
>> on an empty line, then the program will get zero bytes and usually quit.
>> You can see this with:
>>
>>   strace -e read cat
>>
>> Note the Ctrl-d combo can be changed in the terminal driver
>> using the slightly misnamed eof stty setting:
>>
>>   $ stty -a | grep eof
>>   intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
>>
>> cheers,
>> Pádraig
>>