profile contents depends on package order

  • Open
  • quality assurance status badge
Details
4 participants
  • Attila Lendvai
  • John Kehayias
  • Maxime Devos
  • zimoun
Owner
unassigned
Submitted by
John Kehayias
Severity
normal
J
J
John Kehayias wrote on 29 Oct 2022 06:36
(name . Guix Bugs)(address . bug-guix@gnu.org)(name . Guix Devel)(address . guix-devel@gnu.org)
87v8o39rh1.fsf@protonmail.com
Hi Guix,

(I'm cc'ing the devel list for this bug report as I think some wider input and commentary would be worthwhile.)

While investigating a bug with the --emulate-fhs option (bug report forthcoming) I noticed that the profile contents can depend on the order of packages given as input to guix shell. The FHS bug is also due to argument order, but I think is clearly a bug and not expected behavior (wrong glibc included in the container). Though maybe we want to look around for other argument order problems or have some tests?

Actually, this is true for profiles more generally, as I just quickly tested the first example with "guix install" rather than just shell. My examples are all with shell, but I guess it comes down to the same thing. I think this is trickier with shell and the -D option, as we'll see in the second example.

First example, where we might expect something to happen, though personally I expected a profile collision error:

Toggle snippet (13 lines)
? guix shell ffmpeg@4 ffmpeg@5

? ls -la $(which ffmpeg)
lrwxrwxrwx 1 root root 67 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/bin/ffmpeg -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/bin/ffmpeg*

? ls -la $GUIX_ENVIRONMENT/lib/libavdevice.so*
lrwxrwxrwx 1 root root 75 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/lib/libavdevice.so -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/lib/libavdevice.so*
lrwxrwxrwx 1 root root 78 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/lib/libavdevice.so.58 -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/lib/libavdevice.so.58*
lrwxrwxrwx 1 root root 85 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/lib/libavdevice.so.58.13.100 -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/lib/libavdevice.so.58.13.100*
lrwxrwxrwx 1 root root 78 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/lib/libavdevice.so.59 -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/lib/libavdevice.so.59*
lrwxrwxrwx 1 root root 84 Dec 31 1969 /gnu/store/ivfa3mjhqiqc91m5h27sr9gfyzwnv1d0-profile/lib/libavdevice.so.59.7.100 -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/lib/libavdevice.so.59.7.100*

Note that the last specified package, ffmpeg@5, takes precedence here for bin, and the lib directory contains a mixture (as there are some unique filenames as well).

To compare, we do the same thing with the order of ffmpeg versions switched. As we might guess, the profile was not cached; this is a different profile.

Toggle snippet (24 lines)
? guix shell ffmpeg@5 ffmpeg@4
The following derivation will be built:
/gnu/store/2273cnn0wpgid93na7wbhzijrz0r0hlx-profile.drv

building CA certificate bundle...
listing Emacs sub-directories...
building fonts directory...
generating GLib schema cache...
building directory of Info manuals...
building XDG desktop file cache...
building XDG MIME database...
building profile with 2 packages...

? ls -la $(which ffmpeg)
lrwxrwxrwx 1 root root 67 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/bin/ffmpeg -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/bin/ffmpeg*

? ls -la $GUIX_ENVIRONMENT/lib/libavdevice.so*
lrwxrwxrwx 1 root root 75 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/lib/libavdevice.so -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/lib/libavdevice.so*
lrwxrwxrwx 1 root root 78 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/lib/libavdevice.so.58 -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/lib/libavdevice.so.58*
lrwxrwxrwx 1 root root 85 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/lib/libavdevice.so.58.13.100 -> /gnu/store/hx4xf70yjgycx0asv1k1h33p7xms15m8-ffmpeg-4.4.2/lib/libavdevice.so.58.13.100*
lrwxrwxrwx 1 root root 78 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/lib/libavdevice.so.59 -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/lib/libavdevice.so.59*
lrwxrwxrwx 1 root root 84 Dec 31 1969 /gnu/store/c3r3n5fxjs5r4lbjvz1x6rdlgbi8bv8a-profile/lib/libavdevice.so.59.7.100 -> /gnu/store/51gal8hjxilk1f26f3m3ggdhg9rykz6s-ffmpeg-5.1.2/lib/libavdevice.so.59.7.100*

This confirms the ordering of inputs to guix shell matters.

As a rather contrived example we might expect the user is paying attention with this explicit package input conflict. However, this also happens when that is not clear from the package names without inspecting package definitions.

See this second example, where the sdl2 package given to guix shell does not match the sdl2-2.0 input of ffmpeg@4 (with the -D argument):

Toggle snippet (15 lines)
? guix shell -D ffmpeg@4 sdl2

? ls $GUIX_ENVIRONMENT/lib/libSDL2* -la
lrwxrwxrwx 1 root root 76 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2-2.0.so.0 -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2-2.0.so.0*
lrwxrwxrwx 1 root root 81 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2-2.0.so.0.14.0 -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2-2.0.so.0.14.0*
lrwxrwxrwx 1 root root 83 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2-2.0.so.0.2400.0 -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2-2.0.so.0.2400.0*
lrwxrwxrwx 1 root root 69 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2.a -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2.a
lrwxrwxrwx 1 root root 70 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2.la -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2.la*
lrwxrwxrwx 1 root root 73 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2main.a -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2main.a
lrwxrwxrwx 1 root root 74 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2main.la -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2main.la*
lrwxrwxrwx 1 root root 70 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2.so -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2.so*
lrwxrwxrwx 1 root root 74 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2_test.a -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2_test.a
lrwxrwxrwx 1 root root 75 Dec 31 1969 /gnu/store/2hhpchr2xv01sbmjlngxhaq5znbvsckj-profile/lib/libSDL2_test.la -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2_test.la*

Compare to

Toggle snippet (15 lines)
? guix shell sdl2 -D ffmpeg@4

? ls $GUIX_ENVIRONMENT/lib/libSDL2* -la
lrwxrwxrwx 1 root root 76 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2-2.0.so.0 -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2-2.0.so.0*
lrwxrwxrwx 1 root root 81 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2-2.0.so.0.14.0 -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2-2.0.so.0.14.0*
lrwxrwxrwx 1 root root 83 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2-2.0.so.0.2400.0 -> /gnu/store/f3bx0lad4w42035mlch9vnbl94q62yl0-sdl2-2.24.0/lib/libSDL2-2.0.so.0.2400.0*
lrwxrwxrwx 1 root root 69 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2.a -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2.a
lrwxrwxrwx 1 root root 70 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2.la -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2.la*
lrwxrwxrwx 1 root root 73 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2main.a -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2main.a
lrwxrwxrwx 1 root root 74 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2main.la -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2main.la*
lrwxrwxrwx 1 root root 70 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2.so -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2.so*
lrwxrwxrwx 1 root root 74 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2_test.a -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2_test.a
lrwxrwxrwx 1 root root 75 Dec 31 1969 /gnu/store/5qha912xpch2qswvc7clm3v08zab3zl9-profile/lib/libSDL2_test.la -> /gnu/store/m2p4dymf3s001kqmclr8dcysxdplz2b6-sdl2-2.0.14/lib/libSDL2_test.la*

We see that a needed and expected library, libSDL2-2.0.so.0, points to sdl2-2.24.0 in the first case and sdl2-2.014 in the second, matching the "later package argument takes precedence rule." We might expect this can get rather confusing given a few inputs and different versions.

Is this the expected behavior? In discussing with nckxhexen on #guix, it seemed something that should be messaged to the user. Perhaps a warning that there is a potential conflict/collision as one package is overriding or shadowing the other. And documented. The behavior itself seems predictable and perhaps the best choice here, if it is communicated.

Thoughts? Patches?

Thanks!
John
M
A
A
Attila Lendvai wrote on 29 Oct 2022 22:47
(name . Maxime Devos)(address . maximedevos@telenet.be)
9Qe_tVTztcDLxL1LNbf8-qvrMEVOGUHqVadcGHtSeQvYir2oN55bNnYP0hJJhb6wOdLvZ7028EW8ESKHKtqI1LCtlkcCVOuMduWk6-q4RJY=@lendvai.name
this is also somewhat related to:


--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“In your journey to healing, you will learn to appreciate the many faceted qualities of others. Your early impressions will grow more accurate and you will use your trust more wisely. As your boundaries become more clearly defined, you will detect more quickly when others violate them. When the wounds are healed, the sharks will no longer circle.”
— Richard Moskovitz, 'Lost in the Mirror'
Z
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 58859@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 58859
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch