When /usr/bin/ucf opens a new shell, it explicitly connects STDIN and STDOUT
to the script's controlling terminal, so even if STDIN is fed by a pipe, as
is the case when run from /usr/bin/debconf,  the shell should be fully
functional. However, the test for a controlling terminal uses /usr/bin/tty,
which consults only STDIN. As far as I can tell, when run from debconf, ucf
will _never_ use the current terminal. If the goal is to check for access to
a terminal, the test should be for foreground process group membership, not
a terminal connected to STDIN (tty -s), and not a terminal it doesn't
necessarily own (tty -s </dev/tty). The easiest way do this from a shell is
probably with /bin/ps.

--- /usr/bin/ucf        2009-08-27 01:16:28.000000000 -0400
+++ ucf 2012-08-16 14:32:18.000000000 -0400
@@ -1022,7 +1022,7 @@
                fi
                ;;
            shell|Z|z)
-                if tty -s; then
+                if ps -o stat= --ppid $$ | grep -q '+'; then
                    bash >/dev/tty </dev/tty || true
                 elif [ -n "$DISPLAY" ]; then
                     x-terminal-emulator || true


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to