Skip to contentSkip to conversation

inconsistency with handling of symlinked ttys in background

DISCUSSION Pádraig Brady 2 participants 2 messages Nov 9, 2010 – Mar 15, 2011

lore
Share & tools
lore
#0 lore raw

I noticed a bug with dash-0.5.6-2.fc11.i586
in that it doesn't redirect from symlinked ttys
correctly for background processes.

$ dash -c "tty < /dev/stdin&"
$ dash -c "tty < /dev/stdin"
/dev/pts/3
$ bash -c "tty < /dev/stdin&"
/dev/pts/3
$ dash -c "tty < $(readlink -f /dev/stdin)&"
/dev/pts/3

cheers,
Pádraig.

#1 lore raw
Quoted 11 lines · Pádraig Brady

I noticed a bug with dash-0.5.6-2.fc11.i586
in that it doesn't redirect from symlinked ttys
correctly for background processes.

$ dash -c "tty < /dev/stdin&"
$ dash -c "tty < /dev/stdin"
/dev/pts/3
$ bash -c "tty < /dev/stdin&"
/dev/pts/3
$ dash -c "tty < $(readlink -f /dev/stdin)&"
/dev/pts/3

It's completely expected as we close stdin for backgrounded commands.

Try:

bash -c '{ :; tty < /dev/stdin; }&'

Now who is inconsistent? :)

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt