Debian Bug report logs - #688806
Crufty stdout fd3 comment in debconf/confmodule

version graph

Package: debconf; Maintainer for debconf is Debconf Developers <[email protected]>; Source for debconf is src:debconf (PTS, buildd, popcon).

Reported by: John Morrissey <[email protected]>

Date: Tue, 25 Sep 2012 20:03:01 UTC

Severity: minor

Found in version debconf/1.5.46

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Debconf Developers <[email protected]>:
Bug#688806; Package debconf. (Tue, 25 Sep 2012 20:03:03 GMT) (full text, mbox, link).


Acknowledgement sent to John Morrissey <[email protected]>:
New Bug report received and forwarded. Copy sent to Debconf Developers <[email protected]>. (Tue, 25 Sep 2012 20:03:03 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: John Morrissey <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: Crufty stdout fd3 comment in debconf/confmodule
Date: Tue, 25 Sep 2012 12:53:22 -0700
Package: debconf
Version: 1.5.46
Severity: minor

debconf/confmodule has a crufty comment about stdout on fd3:

    # To actually send something to standard output, send it to fd 3.

fd3 is used to send commands to the frontend, and stdout isn't carried over
from the original shell script invocation, so you can't use fd3 (or stdout
at all) to emit output to stdout.


Originally from debconf-devel@:
http://lists.alioth.debian.org/pipermail/debconf-devel/2012-August/003417.html

------
Date: Tue, 28 Aug 2012 12:23:33 -0700
From: John Morrissey <[email protected]>
To: Debconf Developers <[email protected]>
Subject: Crufty stdout comment in confmodule?

I was looking at /usr/share/debconf/confmodule recently, and the comment
about stdout and fd 3 seems crufty.

The script winds up with its write pipe to the frontend on fd 3:

debconf.sh 17810  jwm    0r  FIFO    0,8      0t0 9443796 pipe
debconf.sh 17810  jwm    1w   CHR 136,13      0t0      16 /dev/pts/13
debconf.sh 17810  jwm    2u   CHR 136,13      0t0      16 /dev/pts/13
debconf.sh 17810  jwm    3w  FIFO    0,8      0t0 9443797 pipe

If I redirect stderr to a file (by invoking the shell fragment below as
'./debconf.sh 2>foo', for example), I see stdout is completely gone:

debconf.sh 18022  jwm    0r  FIFO    0,8      0t0 9445266 pipe
debconf.sh 18022  jwm    1w   REG  254,6      112 1951755 /home/jwm/newbug/foo
debconf.sh 18022  jwm    2w   REG  254,6      112 1951755 /home/jwm/newbug/foo
debconf.sh 18022  jwm    3w  FIFO    0,8      0t0 9445267 pipe

The frontend starts the shell script with its two pipes on the script's fd0
and fd1, so stdout is never available to the script.

john


/usr/share/debconf/confmodule
--
if [ -z "$DEBCONF_REDIR" ]; then
    # Redirect standard output to standard error. This prevents common
    # mistakes by making all the output of the postinst or whatever
    # script is using this library not be parsed as confmodule commands.
    #
    # To actually send something to standard output, send it to fd 3.
    exec 3>&1
    if [ "$DEBCONF_USE_CDEBCONF" ]; then
        exec 1>&5
    else
        exec 1>&2
    fi
[...]
fi
--

debconf.sh:
--
#!/bin/sh

lsof +c 12 -p $$
. /usr/share/debconf/confmodule
lsof +c 12 -p $$
--
------



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Fri May 16 12:11:58 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.