Please allow '#' comments in /etc/apt/preferences

Bug #348729 reported by RichardNeill
6
Affects Status Importance Assigned to Milestone
APT
Fix Released
Unknown
apt (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

If I comment out the entries in /etc/apt/preferences, it then completely breaks apt.

# cat /etc/apt/preferences
    #Package: wine
    #Pin: version 20041201-1
    #Pin-Priority: 1001

# apt-get upgrade
E: Invalid record in the preferences file, no Package header.

Apt really shouldn't fail catastrophically just because one of its files contains a comment!

Revision history for this message
Sebastien Bacher (seb128) wrote :

that has nothing to do with gnome-desktop which is about GNOME dialog and a library

Revision history for this message
RichardNeill (ubuntu-richardneill) wrote :

D'Oh. I think I forgot to change that entry, and it remained set to the value I had in the previous bug (which I filed a few minutes earlier.) Launchpad is trying to help me by using a session-variable to store the package name and pre-fill it in the next bug. Oops.

Revision history for this message
Max Bowsher (maxb) wrote :

Richard,

What constitutes a comment varies from file-format to file-format. The APT preferences file format does not have any syntax for comments. It does allow lines beginning "Explanation: " followed by freeform text, but only immediately preceding a "Package: " line, so they aren't really comments, really.

It's not unreasonable for APT to complain loudly if one of its config files contains a syntax error, which #-marks are in this context.

Changed in apt:
status: New → Incomplete
Revision history for this message
Paul Dufresne (paulduf) wrote :

I have verified that Max's explanation is right by reading 'man apt_preferences'.

Confirming bug.
Could be considered invalid, but could also be interpreted as a wish to have line beginning by # to be ignored.
Up to a developer to decide.

Changed in apt:
status: Incomplete → Confirmed
Revision history for this message
RichardNeill (ubuntu-richardneill) wrote :

Fair point.

I do hope this gets added - It would be a reasonable assumption that the same syntax (eg # for comments) used by the rest of apt (eg sources.list) should apply here.

Revision history for this message
Max Bowsher (maxb) wrote :

Upstream bugwatch added on preexisting upstream bug. Retitled with title from upstream bug.

Changed in apt:
status: Unknown → New
Daniel T Chen (crimsun)
Changed in apt (Ubuntu):
importance: Undecided → Wishlist
Changed in apt:
status: New → 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.