jackyf / cupt

high-level package manager for Debian, inspired from APT
36 stars 4 forks source link

Incomplete support for APT config list variables #11

Open urp opened 5 years ago

urp commented 5 years ago

When using apt in a docker container I noticed several error messages.

root@e4a9be148f73:/# cupt update
E: syntax error: line 11, character 33: expected: option value (quoted string) or opening curly bracket ('{')
E: unable to parse the config file '//etc/apt/apt.conf.d/docker-gzip-indexes'
W: skipped the configuration file '//etc/apt/apt.conf.d/docker-gzip-indexes'

originating from an APT config line

Acquire::CompressionTypes::Order:: "gz";

I first suspected it was a faulty APT config file and filed an issue in moby. It turned out the file has legal syntax but cupt seems to lack support for appending elements to list variables by appending :: to the variable name.

From https://manpages.debian.org/buster/apt/apt.conf.5.en.html

To append a new element to a list, add a trailing :: to the name of the list. (As you might suspect, the scope syntax can't be used on the command line.)

Note that appending items to a list using :: only works for one item per line, and that you should not use it in combination with the scope syntax (which adds :: implicitly). Using both syntaxes together will trigger a bug which some users unfortunately depend on: an option with the unusual name "::" which acts like every other option with a name. This introduces many problems; for one thing, users who write multiple lines in this wrong syntax in the hope of appending to a list will achieve the opposite, as only the last assignment for this option "::" will be used. Future versions of APT will raise errors and stop working if they encounter this misuse, so please correct such statements now while APT doesn't explicitly complain about them.
jackyf commented 5 years ago

Thank you for the report. Indeed, the syntax parser shall learn how to parse list variable appends.