an9wer's

A Failed Gentoo Update: USE Flags

posted:

2022-03-20

Excitedly, it came the time to update my Gentoo system - unsurprisingly, it failed once again. This time, one package called "media-gfx/qrencode" was skipped because of a dependency conflict:

# emerge --ask --verbose --update --newuse --deep @world

These are the packages that would be merged, in order:

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0

WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:

media-gfx/qrencode:0

  (media-gfx/qrencode-4.1.1:0/4::gentoo, ebuild scheduled for merge) USE="-png -test" conflicts with
    media-gfx/qrencode[png(+)] required by (app-admin/pass-1.7.4-r2:0/0::gentoo, installed) USE="git -X -dmenu -emacs -importers -wayland"

The error message indicates a conflict between the packages "media-gfx/qrencode" and "app-admin/pass", related to the USE flag "png". To better understand the issue, let's examine their source code in detail.

For the package "media-gfx/qrencode", the source file "qrencode-4.1.1.ebuild" declares a USE flag called "png", which, however, is disabled by default:

IUSE="png test"

For the package "app-admin/pass", the source file "pass-1.7.4-r2.ebuild" lists the package "media-gfx/qrencode" as one of its runtime dependencies:

RDEPEND="
     media-gfx/qrencode[png(+)]
     ...
"

One thing to pay attention to here is the part [png(+)] next to the package name, which means that it requires the dependency "media-gfx/qrencode" to have the USE flag "png" enabled - indicated by [png], and if it doesn't declare "png" in its IUSE, it assumes the flag exists and is enabled - indicated by (+). This allows the dependency to resolve correctly even if the USE flag isn't declared.

The issue then becomes clear: the USE flag "png" is expicitly declared in the dependency "media-gfx/qrencode", so the assumption that the flag might not exist is irrelevant. However, since the USE flag "png" is not enabled by default, this causes a conflict with the package "app-admin/pass", which requires it to be enabled.

Usually, emerge handles this kind of issue automatically by adding the necessary USE flag to the file "/etc/portage/package.use/zz-autounmask". But for some reason, that didn't happen this time, so I had to enable it myself:

# ed /etc/portage/package.use/qrencode.use
a
media-gfx/qrencode png
.
wq

P.S. I was curious about how this issue was introduced, so I looked through the commit history of the source file "qrencode-4.1.1.ebuild". It turns out a commit from just a month ago added the USE flag "png".

Thanks for reading :)