Blog of Julian Andres Klode

Debian Developer | Ubuntu Member | Fellow of FSFE | SPI contributing member

APT2: config parser testing

If you have an amd64 system, install the apt2 package from “deb http://people.debian.org/~jak/debian/ unstable/” and run the apt2-config command. Make sure that the parser reports no errors, otherwise send me an email or leave a comment here. One known exception is that all values must be quoted in the configuration file, I have no plans to fix this (probably just deprecate unquoted strings in APT instead). The parser is not as strict as cupt’s parser, but it gives you more help if something wents wrong. We also ignore most semicolons for now (they will be turned into warnings or errors later on). It is using GScanner from GLib for parsing the files.

apt2-config replicates the functionality of apt-config. It currently do not read the configuration files in the correct order, so don’t expect “apt2-config dump” to produce exactly the same output as “apt-config dump”. To build APT2 yourself, you need a patch for waf from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548329.

About these ads

Written by Julian Andres Klode

September 25, 2009 at 23:19

Posted in APT2

7 Responses

Subscribe to comments with RSS.

  1. [...] here to read the rest: Julian Andres Klode: APT2: config parser testing Share and [...]

    • Hi Julian Andres Klode,

      a few suggestions after a quick test:
      * While git log indicates that you want to drop libgee “waf configure” and the following “waf” needs both an installed libgee-dev (and therefore also libgee1) which is not listed as build-dep. (I have not build a deb, so i don’t know if it effects the pkg building – i prefer running tests as user and with the help of LD_LIBRARY_PATH)
      * I don’t know if it is intended but APT::Architecture “(null)”; if no setting is included in the files looks a bit strange.
      * If i would reimplement it, i would ignore backup/swap files like *.~, .*.swp, *.bak und co.
      * It doesn’t like entries like
      Test {
      “Option” “value”;
      };
      (which is maybe a feature, but if i suspect something like Acquire::cdrom::”/cdrom/”::Mount “foo”; will also fail which would be a valid entry)
      * It refuses to parse the config file provided by localepurge:
      /etc/apt/apt.conf.d/99-localepurge:3: error: unexpected character `
      ‘, expected identifier
      (Maybe an end-of-line issue)

      Best regards / Mit freundlichen Grüßen,

      David “DonKult” Kalnischkies

      DonKult

      September 26, 2009 at 12:47

      • About gee, it has been re-added, although I forgot to re-add it to the build-depends.

        APT::Architecture is currently always “(null)”, as I first need to get waf to write a configuration file (in Vala) for the build and include it.

        About the backup files, yes they should be ignored in the future.

        About the options with quotes: Please, no. They are not supposed to be quoted. That’s why cupt and APT2 fail at parsing them. It would just complicate the parsing. We don’t even support unquoted options, although they are allowed according to the format (though I want to deprecate them in the documentation of the next APT release).

        About the localepurge issue, it uses quotes inside a value and thus fails because they are not escaped. All 3 parsers behave differently here: APT ignores quotes completely, APT2 requires escaped quotes, and cupt accepts unescaped quotes. We should probably just accept APT2′s behaviour everywhere, as this is the standard used in programming languages (and it would be easier for me, as GScanner handles the string quoting stuff).

        Julian Andres Klode

        September 26, 2009 at 13:11

  2. /etc/apt/apt.conf:6: error: unexpected character `.’, expected string constant – Unfinished option, missing value.

    Which is:
    Acquire::HTTP::Proxy::bugs.debian.org “DIRECT”;

    Tobias

    September 26, 2009 at 14:54

    • Fixed in f1ff31fd50cf9fe4147f14e3c8759f90c7b44d26.

      APT2 now accepts all alphanumerical characters and the “/-:._+” in option names.

      Julian Andres Klode

      September 26, 2009 at 15:18

  3. waf 1.5.9+dfsg-2 uploaded with a fix for #548329. It’s a backport from trunk, thanks for your patch anyway! :)

    Luca Falavigna

    September 26, 2009 at 19:27


Comments are closed.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: