Skip to content

Difference in comment parsing #1638

@rowlap

Description

@rowlap

#1484 was closed last year, but I think there's a difference worth documenting in the comment syntax.

$ cat dnf.conf
[main]

excludepkgs =
  # packages we don't want
  nginx

$ python3 -c "import configparser; c = configparser.ConfigParser(); c.read('dnf.conf'); print(dict(c.items('main')))"
{'excludepkgs': '\nnginx'}


$ dnf -v --config dnf.conf help | grep Exclude
Excludes in dnf.conf: #, don't, nginx, packages, want, we

The code in libdnf IniParser only considers comments to begin in column 0.

For a boolean/int option this is more obvious as trailing comments will be invalid, but for list options it's an easy trap to fall in to (guess why I'm filing this issue).

Please either document the libdnf comment syntax, or change the parser to align with python configparser, and even then it's still worth documenting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriagedSomeone on the DNF 5 team has read the issue and determined the next steps to take

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions