[FFmpeg-devel] [PATCHv2] ffmpeg: modify tty state when stderr is redirected

Nicolas George george at nsup.org
Fri Jul 31 13:48:18 CEST 2015


Le tridi 13 thermidor, an CCXXIII, Ganesh Ajjanagadde a écrit :
> Nevertheless, echo $? invoked right after this yields 2 for both.
> The reason this happens is the md5sum wrapper sees that the output
> file has not been written,
> and errors out there (see the .err files for precisely what I mean).
> This is why I did not notice it.

Ok.

> Seeing the above, I think just the change in ffmpeg.c along with
> telling people of the workarounds for both bashrc and zshrc
> should be enough, with no modification to run-tests.sh.

Indeed, but the change to add -nostdin to FATE is also right: FATE is not an
interactive process, it should not listen for interactive commands. If the
cat paws the q key while FATE is running, it will cause a failure, it should
not.

There are three issues, and one right fix for each of them:

1. ffmpeg reads command on stdin and needs stdin to be a tty in cbreak mode:
   the test must be on stdin, not any other file descriptor. Actually, no
   test at all should work too, since tcgetattr() would fail anyway.

   -> The patch that has just been reverted was right.

2. ffmpeg can crash, ffmpeg can not catch all signals (example: memory-leak,
   OOM killer, SIGKILL, uncatchable): the shell should be configured to
   restore the tty in a sane state.

   -> "ttyctl -f" in ~/.zshrc, "bash_tty_mode=$(stty -g);
   PROMPT_COMMAND='stty $bash_tty_mode'" in ~/.bashrc; that can be added in
   the FAQ or the wiki.

3. FATE is non-interactive: it should not listen to interactive commands.

   -> run FATE with -nostdin.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150731/3c58cdfa/attachment.sig>


More information about the ffmpeg-devel mailing list