On Tue, Jun 04, 2024 at 11:05:15AM +0100, Phillip Wood wrote: > Hi Rubén > > On 03/06/2024 21:38, Rubén Justo wrote: > > In 18d8c26930 (test_terminal: redirect child process' stdin to a pty, > > 2015-08-04), t/test-terminal.perl learned to connect the child process' > > stdin to a pty. It works well for what was intended: satisfying an > > `isatty(STDIN_FILENO)` check. > > > > However, the fork introduced, that copies the stdin to the child > > process, does not always manage to send all the information. > > I think the problem maybe to do with the use of File::Copy, not with the > fork. The man page for the copy function says > > Note that passing in files as handles instead of names may > lead to loss of information on some operating systems; it is > recommended that you use file names whenever possible. > > Rather than adding a new flag to work around a bug in our script it might be > better to try and fix the bug by using a loop that reads blocks of data from > the source and writes them to the destination instead of calling copy. I don't think I've seen missing data. But do note that the test_terminal stdin handling is racy: https://lore.kernel.org/git/20190520125016.GA13474@xxxxxxxxxxxxxxxxxxxxx/ IMHO we should consider getting rid of it entirely. I think the only thing that uses it is t4153 (AFAICT it is luckily not racy because it does not actually read stdin, but only checks isatty). -Peff