Crash if a file in /etc/apt/apt.conf.d is unreadable

Bug #175506 reported by Stefan Taferner
2
Affects Status Importance Assigned to Milestone
command-not-found (Baltix)
New
Undecided
Unassigned
command-not-found (Ubuntu)
Fix Released
Undecided
Michael Vogt

Bug Description

Binary package hint: command-not-found

The file /etc/apt/apt.conf.d/50proxy contains a proxy user/password and
is therefore unreadable for the users on my system.

command-not-found crashes when it tries to open this file:

E:Opening configuration file /etc/apt/apt.conf.d/50proxy - ifstream::ifstream (13 Permission denied)
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 24, in <module>
    CommandNotFound(options.data_dir).advise(args[0])
  File "/usr/lib/python2.5/site-packages/CommandNotFound/CommandNotFound.py", line 72, in __init__
    self.sources_list = self._getSourcesList()
  File "/usr/lib/python2.5/site-packages/CommandNotFound/CommandNotFound.py", line 93, in _getSourcesList
    apt_pkg.init()
SystemError: E:Opening configuration file /etc/apt/apt.conf.d/50proxy - ifstream::ifstream (13 Permission denied)
Python version: 2.5.1 final 0

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

This is fixed in bzr and will be part of the next upload.

Changed in command-not-found:
assignee: nobody → mvo
status: New → Fix Committed
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote : Also crashes if /etc/apt/apt.conf file is unreadable by user

command-not-found also crashes if /etc/apt/apt.conf file is unreadable by user - I get almost same error, like reported in this bugreport:
SystemError: E:Opening configuration file /etc/apt/apt.conf - ifstream::ifstream (13 Permission denied)

Please ensure, that your fix also works, when /etc/apt/apt.conf file is unreadable by user (sudo chmod a-w,a-r /etc/apt/apt.conf )

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

This appears to have been fixed by this upload:

command-not-found (0.2.15ubuntu1) hardy; urgency=low

  [ Kjell Braden ]
   * Don't run command-not-found from the shell scripts when it has been
     removed in the meantime (LP: #194939)

  [ Michael Vogt ]
  * CommandNotFound/CommandNotFound.py:
    - do not advise on ".." (LP: # 195090) - thanks to Thomas Perl
    - do not crash on problems with python-apt (LP: #161804)
  * debian/control:
    - improve description (LP: #144153)
  * command-not-found:
    - make the crash message a bit more friendly
  * use lgettext() instead of gettext() (LP: #161159)

 -- Michael Vogt <email address hidden> Fri, 07 Mar 2008 10:01:20 +0100

Changed in command-not-found:
status: Fix Committed → Fix Released
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.