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

Michael Niedermayer michael at niedermayer.cc
Mon Oct 12 15:25:15 CEST 2015


On Mon, Oct 12, 2015 at 09:12:02AM -0400, Ganesh Ajjanagadde wrote:
> On Mon, Oct 12, 2015 at 8:56 AM, wm4 <nfxjfg at googlemail.com> wrote:
> > On Mon, 12 Oct 2015 08:39:53 -0400
> > Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> >
> >> On Mon, Oct 12, 2015 at 8:24 AM, wm4 <nfxjfg at googlemail.com> wrote:
> >> > On Mon, 12 Oct 2015 08:14:14 -0400
> >> > Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> >> >
> >> >> On Mon, Oct 12, 2015 at 8:03 AM, Michael Niedermayer
> >> >> <michael at niedermayer.cc> wrote:
> >> >> > On Mon, Oct 12, 2015 at 01:46:19PM +0200, Michael Niedermayer wrote:
> >> >> >> On Fri, Jul 31, 2015 at 01:48:18PM +0200, Nicolas George wrote:
> >> >> >> [...]
> >> >> >> >    -> "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.
> >> >> >>
> >> >> >>
> >> >> >> the patch was applied and this does not work
> >> >> >>
> >> >> >> the first segfault i see breaks the terminal
> >> >> >>
> >> >> >> a testcase is a script like:
> >> >> >> #!/bin/sh
> >> >> >> valgrind ./ffmpeg_g -i matrixbench_mpeg2.mpg -encryption_key 0123456789abcdef0011223344556677  -encryption_iv aabbccddeeff11335577999876542222  crypto:file-crypt.nut
> >> >> >>
> >> >> >> (with the aesni patches or anything else that causes a segfault)
> >> >> >>
> >> >> >> ls -alF /bin/sh
> >> >> >> lrwxrwxrwx 1 root root 4 Mar 29  2012 /bin/sh -> dash*
> >> >> >> (this is default on ubuntu)
> >> >> >
> >> >> > i think i got it working as long as bash is the users shell with
> >> >> > the suggested stty commands
> >> >>
> >> >> So it does not work with dash?
> >> >
> >> > dash isn't meant to be used interactively anyway?
> >>
> >> Good point, just now read up on this weird shell I have never heard
> >> of: https://en.wikipedia.org/wiki/Debian_Almquist_shell. However,
> >> Michael does bring up a point in that /bin/sh by default symlinks to
> >> dash on a rather large platform, namely Ubuntu. We need to find out a
> >> workaround for it.  I am of no use here; hopefully Michael finds
> >> something and posts.
> >>
> >> I will then collect them all and add to the wiki.
> >
> > No, for interactive shell, Debian and Ubuntu still use bash by default.
> > So even if /bin/sh is used to run a script, the /bin/sh itself will be
> > started from a bash. So I do not see the problem here.
> 
> There is still a problem (albeit a minor use case): suppose a user is
> running /bin/sh as his interactive shell. Maybe Michael for the sake
> of testing only POSIX compliant stuff prefers to work within a /bin/sh
> shell, and thus as soon as he opens his terminal (running bash as you
> said), he invokes a /bin/sh subshell on Debian or Ubuntu (other
> places, /bin/sh is usually a symlink to bash, with no issues).

i cant speak for others but i dont do that, no
i just saw one of my scripts messing up the terminal and then when
testing that, tested under dash which failed badly even with the
workarounds. The initial failure was caused by the workaround not
being in place yet but i didnt realize that it wasnt in place for
that terminal because it was in place for a 2nd terminal in which i
checked.
so the remaining dash issue should not affect me personally i think
i dont know if there are any other issues or cases where it affects
people.



> 
> In such a situation, the user is screwed: unfortunately, AFAIK, there
> is no way to do a "pre-prompt" command in /bin/sh, all one has is
> $PS1. Furthermore, I can't really ask Michael to change from /bin/sh
> symlinking to dash to a symlink to bash since he wants to test /bin/sh
> as implemented on a user's machine.
> 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151012/3413b4e2/attachment.sig>


More information about the ffmpeg-devel mailing list