check for DEBCONF_REDIR in debconf.py

Bug #24727 reported by Tristan Hill
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debconf (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

In /usr/share/debconf/confmodule there is a check for DEBCONF_REDIR so that
standard output redirection doesn't happen twice.

A similar thing for debconf.py would be useful.

Revision history for this message
Tristan Hill (stan) wrote :

Created an attachment (id=4816)
patch to add DEBCONF_REDIR check to debconf.py

Revision history for this message
Tristan Hill (stan) wrote :

Created an attachment (id=4817)
patch to add DEBCONF_REDIR check to debconf.py

Revision history for this message
Colin Watson (cjwatson) wrote :

Ugh, the Python confmodule seems a bit broken to me. The shell confmodule fd
redirection hack was there for backward compatibility, and shouldn't have been
introduced into the Python confmodule (because there was no reason to have
backward compatibility there). The Perl confmodule simply does this:

        # A truly gross hack. This is only needed if
        # /usr/share/debconf/confmodule is loaded, and then this
        # perl module is used. In that case, this module needs to write
        # to fd #3, rather than stdout. See changelog 0.3.74.
        if (exists $ENV{DEBCONF_REDIR} && $ENV{DEBCONF_REDIR}) {
                open(STDOUT,">&3");
        }

That would suggest something more like the following:

- self.write = write or sys.stdout
- sys.stdout = sys.stderr
+ if (os.environ.has_key('DEBCONF_REDIR') and
+ os.environ['DEBCONF_REDIR'] != ''):
+ self.write = write or os.fdopen(3, 'w')
+ else:
+ self.write = write or sys.stdout

It's awkward given that debconf.py has already been deployed with 'sys.stdout =
sys.stderr', though. I'm tempted to add a redirect=True keyword argument to
Debconf.__init__() to allow code that doesn't rely on this misfeature to turn it
off.

Revision history for this message
Adam Niedling (krychek) wrote :

Based on the date when this bug was reported the original reporter was using Breezy which is not supported anymore. Please reopen this report if this is still an issue in a later version of Ubuntu.

Changed in debconf:
status: Confirmed → Invalid
Revision history for this message
Colin Watson (cjwatson) wrote :

Adam, your change was very rude. Please do not close bugs when a developer has acknowledged them and assigned them to himself (even if that developer hasn't got round to doing anything about it for a while)!

Changed in debconf:
status: Invalid → Triaged
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Hey Colin, is this still relevant? Cause my house mate reported this bug, and he is now complaining to be about it.... Do you want me to look into that? Although he says it was only relevant back in the day when he was working at cmed, now he is at credativ and priorities are slightly different. Although, you probably do not care about his life story. Anyway he is stan on irc you can ping him, like infinity did by mistake the other day.

Colin Watson (cjwatson)
Changed in debconf (Ubuntu):
assignee: Colin Watson (cjwatson) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.