[Aptitude-devel] Bug#662983: When called by aptitude, apt-listbugs crash and precludes the package upgrade

Daniel Hartwig mandyke at gmail.com
Thu Mar 8 02:49:05 UTC 2012


On 8 March 2012 07:01, Francesco Poli <invernomuto at paranoici.org> wrote:
> On Wed, 7 Mar 2012 22:31:18 +0100 Nicolas DEGAND wrote:
>
>> On Wed, 7 Mar 2012 21:11:43 +0100 Francesco Poli wrote:
>>
>> > On Wed, 07 Mar 2012 20:17:19 +0100 Nicolas DEGAND wrote:
>> >
>> > > I try to upgrade packages with aptitude. When it calls apt-listbugs, it crashes with the following messages:
>> > >
>> > > Are you sure you want to install/upgrade the above packages? [Y/n/?/...] /usr/lib/ruby/1.8/open-uri.rb:32:in `initialize': No such device or address - /dev/tty (Errno::ENXIO)
>> > >         from /usr/lib/ruby/1.8/open-uri.rb:32:in `open_uri_original_open'
>> > >         from /usr/lib/ruby/1.8/open-uri.rb:32:in `open'
>> > >         from /usr/share/apt-listbugs/apt-listbugs/logic.rb:1053:in `tty'
>> > >         from /usr/share/apt-listbugs/apt-listbugs/logic.rb:1060:in `ask'
>> > >         from /usr/share/apt-listbugs/apt-listbugs/logic.rb:350:in `view'
>> > >         from /usr/sbin/apt-listbugs:415

> I am suspecting that the issue is due to aptitude invoking commands
> (that need to be run as root) with an "su -c command".
> Do I understand correctly that this is what is done by  src/ui.cc:499
> of current git master HEAD (commit c3b706f3c921585c70d2fc15d75f0713762efae3)?
>

Yes.

> ...
> Well, apt-listbugs needs a controlling TTY for interactive use...
>

Is this interactive use limited to reading the response to a [Yn] prompt?

Other programs have no problem with such a prompt when run via "su -c".

> What could be done to make aptitude's ncurses interface and
> apt-listbugs work better together?
>
>  (A) Should apt-listbugs try harder to detect whether a controlling TTY
> is available and switch to a non-interactive failure mode, in case no
> controlling TTY may be used?
>

Apt-listbugs could try harder to avoid directly reading from /dev/tty

-- /usr/share/apt-listbugs/apt-listbugs/logic.rb:1052
  def tty
    @tty ||= open("/dev/tty")
  end

  def ask(msg)
    $stdout.print "#{msg} "
    $stdout.flush
    line = nil
    line = self.tty.gets
    if line != nil
      line.chomp!
    end
    return line
  end
--


>  (B) Could aptitude's ncurses interface behave differently to adapt to
> the security fix for CVE-2005-4890?

I doubt it.


It seems that apt-listbugs directly accesses /dev/tty many other
places in the code also.  Now correct me if I'm wrong, but a quick
look suggests most (all?) of those uses are unnecessary.


Regards



More information about the Aptitude-devel mailing list