apt.conf man page should indicate # is also used for comments

Bug #1309658 reported by Stoyan Stoyanov on 2014-04-18
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Medium
Unassigned

Bug Description

According to apt.conf(5) man page, the only valid comments in apt config files are:

"Lines starting with // are treated as comments (ignored), as well as all text between /* and */, just like C/C++ comments."

There are comments in debian/apt.conf.autoremove (/etc/apt/apt.conf.d/01autoremove) that start with '#' which breaks other tools like augeas that follow strictly the definition of comments in apt.conf's man page and rely on it to function properly.

1)
Description: Ubuntu 14.04 LTS
Release: 14.04

2) apt:
  Installed: 1.0.1ubuntu2
  Candidate: 1.0.1ubuntu2
  Version table:
 *** 1.0.1ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

The file can be patched by running:
$ sed -i "s/#/\/\//" apt.conf.autoremove

David Kalnischkies (donkult) wrote :

As I implemented this years ago I am obviously biased, but I think not supporting "#" as a comment is a mistake as sources.list and preferences support it and most other config files you come across do comments with '#'. The autokernelremove code was an "external" contribution and it just shows that the default assumption is in fact '#'.
(all apt config files I have on my systems include #-comments btw, and I doubt I am the only one)
We should just document this fact properly instead of reverting support for it…

I wonder more why augeas is parsing our config file (but then again, I have no idea what augeas is). We have the apt-config tool to extract settings as well as python-apt, libapt-perl and libapt proper. Doing it on your own leads to a disaster sooner or later…
(just compare it with sources.list parsers… a simple codesearch reveals that most of them are fundamentally broken even in perfectly documented cases; but in most cases I have no idea why they they try to parse it in the first place…)

I think that a single tool that allows you to edit various config files
preserving the validity of the syntax has its uses. Yes, it would be easier
to shoot yourself in the foot than if using the tools provided with the
distribution, but a single interface for changing name/value pairs in
different config files is priceless.

Anyway, documenting the ability to use '#' for comments in apt config files
should suffice. It will provide ground for pushing changes to other
projects parsing the apt config files.

Thanks,
Stoyan

On Fri, Apr 18, 2014 at 1:31 PM, David Kalnischkies <
<email address hidden>> wrote:

> As I implemented this years ago I am obviously biased, but I think not
> supporting "#" as a comment is a mistake as sources.list and preferences
> support it and most other config files you come across do comments with
> '#'. The autokernelremove code was an "external" contribution and it just
> shows that the default assumption is in fact '#'.
> (all apt config files I have on my systems include #-comments btw, and I
> doubt I am the only one)
> We should just document this fact properly instead of reverting support
> for it…
>
>
> I wonder more why augeas is parsing our config file (but then again, I
> have no idea what augeas is). We have the apt-config tool to extract
> settings as well as python-apt, libapt-perl and libapt proper. Doing it on
> your own leads to a disaster sooner or later…
> (just compare it with sources.list parsers… a simple codesearch reveals
> that most of them are fundamentally broken even in perfectly documented
> cases; but in most cases I have no idea why they they try to parse it in
> the first place…)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1309658
>
> Title:
> Invalid comments in debian/apt.conf.autoremove
>
> Status in “apt” package in Ubuntu:
> New
>
> Bug description:
> According to apt.conf(5) man page, the only valid comments in apt
> config files are:
>
> "Lines starting with // are treated as comments (ignored), as well as
> all text between /* and */, just like C/C++ comments."
>
> There are comments in debian/apt.conf.autoremove
> (/etc/apt/apt.conf.d/01autoremove) that start with '#' which breaks
> other tools like augeas that follow strictly the definition of
> comments in apt.conf's man page and rely on it to function properly.
>
> 1)
> Description: Ubuntu 14.04 LTS
> Release: 14.04
>
> 2) apt:
> Installed: 1.0.1ubuntu2
> Candidate: 1.0.1ubuntu2
> Version table:
> *** 1.0.1ubuntu2 0
> 500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64
> Packages
> 100 /var/lib/dpkg/status
>
> The file can be patched by running:
> $ sed -i "s/#/\/\//" apt.conf.autoremove
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1309658/+subscriptions
>

Changed in apt (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
summary: - Invalid comments in debian/apt.conf.autoremove
+ apt.conf man page should indicate # is also used for comments
Dillon Brock (okay19) wrote :

Added a patch for this bug.

The attachment "add-comment-type-to-manpage.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers