rpm-software-management / dnf5

Next-generation RPM package management system
Other
233 stars 75 forks source link

nevras.toml parsing error #1186

Open praiskup opened 7 months ago

praiskup commented 7 months ago

Suddenly, dnf5 stopped working with this failure:

$ sudo dnf update
terminate called after throwing an instance of 'toml::syntax_error'
  what():  [error] toml::parse_key: an invalid key appeared.
 --> /usr/lib/sysimage/libdnf5/nevras.toml
       |
 13284 | [nevras."libxcb-1.13.1-12.fc39.x86_64]
       | ^--- is not a valid key
       |
Hint: bare keys  : non-empty strings composed only of [A-Za-z0-9_-].
Hint: quoted keys: same as "basic strings" or 'literal strings'.
Hint: dotted keys: sequence of bare or quoted keys joined with a dot.
Aborted
$ rpm -q dnf5 libdnf5 
dnf5-5.1.11-20240116005056.4.g57fe937a.fc40.x86_64
libdnf5-5.1.11-20240116005056.4.g57fe937a.fc40.x86_64
praiskup commented 7 months ago

In vim I see ^B instead of "

- nevras."libxcb-1.13.1-12.fc39.x86_64"]
+ nevras."libxcb-1.13.1-12.fc39.x86_64^B]
praiskup commented 7 months ago

Note that the Fedora 39 chroot has fc40 %dist: https://download.copr.fedorainfracloud.org/results/rpmsoftwaremanagement/dnf5-unstable/fedora-39-x86_64/06916395-dnf5/ I'm actually on fc39.

j-mracek commented 7 months ago

May I ask you to think about possible triggers. What kind of LANG is on the system. Is your disk in good conditions. Did system crash recently. Anything would be helpful.

jan-kolarik commented 7 months ago

Hi, I've been looking into this issue, but I haven't identified the source of the problem yet, and I'm unable to reproduce it locally. From my understanding, the toml library should add the correct quotes to the output file, so it might be a bug there. Could you confirm if the rest of the /usr/lib/sysimage/libdnf5/nevras.toml file is valid?

Note that the Fedora 39 chroot has fc40 %dist: https://download.copr.fedorainfracloud.org/results/rpmsoftwaremanagement/dnf5-unstable/fedora-39-x86_64/06916395-dnf5/ I'm actually on fc39.

Please refer to this comment on the related BZ.

j-mracek commented 7 months ago

The key is to identify how the ^B symbol was created in the file. I don't think we should somehow automatically replace ^B by ". There even might be a problem in TOML library.

Would be possible to look to the history in which transaction libxcb-1.13.1-12.fc39.x86_64 was handled and provide details?

praiskup commented 7 months ago

May I ask you to think about possible triggers.

I have no idea. Really :)

What kind of LANG is on the system.

$ env | grep -i -e LANG -e LC_
GDM_LANG=en_US.UTF-8
LANG=en_US.UTF-8
LC_TIME=cs_CZ.UTF-8

Is your disk in good conditions.

While it is hard to rule this out, I don't see any signs of disk issues.

Did system crash recently. Anything would be helpful.

No.

From my understanding, the toml library should add the correct quotes to the output file, so it might be a bug there. Could you confirm if the rest of the /usr/lib/sysimage/libdnf5/nevras.toml file is valid?

I opened the file, fixed the single byte, and dnf5 started working from that point in time.

Would be possible to look to the history in which transaction libxcb-1.13.1-12.fc39.x86_64 was handled and provide details?

I manually observed the last 30 transactions, and didn't see anything suspicious, and I'm back 7 days... libxcb was not updated there.

I can't do dnf5 history PKGNAME :-(, and dnf-3 history libxcb says 2023-04-18 ... distrosync to 38 (the distrosync to 39 was done by dnf5).

praiskup commented 7 months ago

I often use TMUX, and CTRL+B is a controlling key combination, but I don't recall running a local dnf5 in tmux actually. Is it possible that, by any chance, stdin of the dnf5 commandv (my terminal key-press of ctrl+b) leaks into the toml file?

ppisar commented 7 months ago

^B is 0x02. DNF5 uses that byte as a separator in MC_() macro expansion when constructing bgettext message identifiers.

j-mracek commented 7 months ago

^B is 0x02. DNF5 uses that byte as a separator in MC_() macro expansion when constructing bgettext message identifiers.

Interesting, but that macro is not used anywhere therefore I don't think this is related. I would be very surprised if any string related to toml is translated.