[Bug 1076237] Re: /etc/kernel/postinst.d/apt-auto-removal creates comment with invalid # character
David Kalnischkies
1076237 at bugs.launchpad.net
Thu Nov 8 11:36:47 UTC 2012
Just for the record: APT really supports # as comments as a convenience:
apt (0.7.22) unstable; urgency=low
…
* [ABI break] support '#' in apt.conf and /etc/apt/preferences
(closes: #189866)
…
-- Michael Vogt <mvo at debian.org> Wed, 29 Jul 2009 19:16:22 +0200
I really don't get why everyone thinks config file parsing is so damn cool that it must be reimplemented everywhere. I guess I have to try it some time. Sounds like a lot of fun.
Unnecessary to mention that aptdaemon will fail on other for-APT-valid config files also, like these including #clear option; and this time there is not even an excuse as this syntax is present since ever. Even though it might be hard to give a valid excuse provided the copyright year of config.py is 2010 … Oh dear …
My python is to limited, but from a first look it seems like it
incorporates quiet a few issues like parsing/editing files which aren't
parsed by APT (e.g. config.dpkg-new), #clear, #include, #-comments, …
(yes, I know that aptdaemon "needs" it to rewrite the configuration file
as nobody has implemented it in libapt-pkg – properly because it sounds
like so much fun – but I still don't get why because you could just
append a new line to file to set a different value …)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1076237
Title:
/etc/kernel/postinst.d/apt-auto-removal creates comment with invalid
# character
Status in “apt” package in Ubuntu:
Fix Released
Bug description:
/etc/kernel/postinst.d/apt-auto-removal does:
cat > "$config_file".dpkg-new <<EOF
# File autogenerated by $0, do not edit
APT
{
[...]
But apt does not seem to accept that. This is exposed by the current
aptdaemon autopkgtest failure in
https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-
adt-aptdaemon/lastFailedBuild/ARCH=i386,label=albali/ :
=====================================================================
ERROR: test_ (tests.test_configparser.ConfigurationParserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/tmp.dHacB3CTL5/dsc0-build/aptdaemon-0.45+bzr861/tests/test_configparser.py", line 63, in test_
config = self.parser.parse(fd.readlines())
File "/tmp/tmp.dHacB3CTL5/dsc0-build/aptdaemon-0.45+bzr861/aptdaemon/config.py", line 156, in parse
raise Exception("Unknown char '%s' in: %s" % (char, line))
Exception: Unknown char '#' in: # File autogenerated by /etc/kernel/postinst.d/apt-auto-removal, do not edit
man apt.conf also just documents // and /* .. */ as valid comments,
not #.
I think this apt script should be fixed to write a // comment instead
of a # comment. Or should aptdaemon/apt accept # as well?
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1076237/+subscriptions
More information about the foundations-bugs
mailing list