apt preferences file should allow comments (#) (was: [apport] update-manager crashed with SystemError in open())

Bug #83337 reported by Brian J. Murrell
24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Debian)
Fix Released
Unknown
apt (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: update-manager

Are comments not allowed in the preferences file. Simply changing:

Package: tar
Pin: version 1.15.1-2ubuntu2
Pin-Priority: 1000

to:

#Package: tar
#Pin: version 1.15.1-2ubuntu2
#Pin-Priority: 1000

seems to have caused this defect.

ProblemType: Crash
Date: Sun Feb 4 19:04:37 2007
DistroRelease: Ubuntu 7.04
ExecutablePath: /usr/bin/update-manager
InterpreterPath: /usr/bin/python2.5
Package: update-manager 0.53.5 [modified: usr/share/pycentral/update-manager/site-packages/UpdateManager/UpdateManager.py]
ProcCmdline: /usr/bin/python /usr/bin/update-manager
ProcCwd: /home/brian
ProcEnviron:
 PATH=/home/brian/bin:/sbin:/bin:/usr/sbin/:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/StarOffice-3.1/linux-x86/bin
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/update-manager']
SourcePackage: update-manager
Uname: Linux pc 2.6.20-4-generic #2 SMP Fri Jan 5 04:31:55 UTC 2007 i686 GNU/Linux

Revision history for this message
Brian J. Murrell (brian-interlinx) wrote :
Revision history for this message
Michael Vogt (mvo) wrote :

No, comments are not allowed in the apt preferences file.

I will change this to a wishlist bug against apt to allow this.

Changed in update-manager:
importance: Undecided → Wishlist
status: Unconfirmed → Confirmed
Revision history for this message
Lars Noodén (larsnooden) wrote :

This is an important item. One needs to be able to document the changes not only for other system administrators but also for oneself, if the time period is long enough. The best location is inline within the preferences file itself. A separate file *will* get lost or forgotten...

Revision history for this message
Rockwalrus (rockwalrus) wrote :

As a workaround, you can use the Explanation: field for this purpose:

Explanation: Package: tar
Explanation: Pin: version 1.15.1-2ubuntu2
Explanation: Pin-Priority: 1000

Revision history for this message
Anders Kaseorg (andersk) wrote :

Fixed in Karmic.

apt (0.7.22) unstable; urgency=low

  [ David Kalnischkies ]
  * [ABI break] support '#' in apt.conf and /etc/apt/preferences
    (closes: #189866)

 -- Michael Vogt <email address hidden> Wed, 29 Jul 2009 19:16:22 +0200

Changed in apt (Ubuntu):
status: Confirmed → Fix Released
Changed in apt (Debian):
status: Unknown → Fix Released
Revision history for this message
Daniel Hahler (blueyed) wrote :

This has regressed:

% cat /etc/apt/preferences
#test

% apt-get source apt
Reading package lists... Done
E: Unable to parse package file /etc/apt/preferences (1)

The man page tells that "Explanation: " would work for commenting package sections (and "//" does appear to work the same), but it requires a Package header then anyway (otherwise it results in "E: Invalid record in the preferences file /etc/apt/preferences, no Package header").

Changed in apt (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :

The patch from Debian bug 189866 appears to be there (at least partly), but does apparently not work as expected in this case.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Well, a comment without something to comment is not really useful anyway. If there are actual sections in the file, it works. It expects the file to be empty or to contain at least one valid section.

Revision history for this message
Removed by request (removed3425744) wrote :

If there are only comments in the file it will still result in an error: "E: Unable to parse package file /etc/apt/preferences (1)". In my opinion apt should handle this file like an empty file in this case.

Revision history for this message
Aidan Furlan (aidan-epochlabs) wrote :

I agree with sworddragon, a fully commented file is useful in that it tells me "this syntax works but I have temporarily disabled it".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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