Page MenuHomePhabricator

[apt-buildpack] some packages install broken links
Closed, ResolvedPublic

Description

Some packages that install links expect them to be at the root of the OS (or root-handled paths) instead of using the relocated paths.

For example in wm-lol --ref with_everything: “/layers/fagiani_apt/apt/usr/bin/pygettext3: broken symbolic link to pygettext3.10”

Event Timeline

dcaro changed the task status from Open to In Progress.Jan 17 2024, 3:56 PM
dcaro moved this task from Next Up to In Progress on the Toolforge (Toolforge iteration 03) board.

It’s probably doable to do a post-extract check that looks for any absolute symlinks below /layers/fagiani_apt/apt/ and adjusts them? (I’m not entirely sure which adjustment I would prefer tbh – prepend absolute /layers/fagiani_apt/apt/, or prepend an appropriate number of ../ elements depending on how many parent directories the symlink has?)

And I suppose it’s possible that there are symlinks that should stay absolute… it’s probably enough to fix those as they are discovered? (My best guess so far would be something like /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf, but I wouldn’t expect that in the extracted packages, I think.)


Also, I think I mixed something up yesterday. I reused your wm-lol image out of laziness, and when it didn’t have Java in it, I looked for different symlinks in it to mention as broken. But those are actually relative, not absolute:

$ sudo docker run --rm -it --entrypoint=bash tools-harbor.wmcloud.org/tool-lucaswerkmeister-test/tool-lucaswerkmeister-test:latest@sha256:25968357bf4e79c98cf25a29a2653d99ce3fffcbbfad09599f20e709a703937a 
heroku@58031a396b46:/workspace$ find /layers/fagiani_apt/apt/ -type l -exec readlink {} \;
pygettext3.10
pdb3.10
pydoc3.10
libjq.so.1.0.4
../libjq1/changelog.Debian.gz
../python3/python-policy.txt.gz
../libpython3-stdlib/README.Debian
../libpython3-stdlib/changelog.Debian.gz
python3.10.xpm
pydoc3.10.1.gz
pygettext3.10.1.gz
pdb3.10.1.gz
heroku@58031a396b46:/workspace$ find /layers/fagiani_apt/apt/ -type l -exec file {} +
/layers/fagiani_apt/apt/usr/bin/pygettext3:                            broken symbolic link to pygettext3.10
/layers/fagiani_apt/apt/usr/bin/pdb3:                                  broken symbolic link to pdb3.10
/layers/fagiani_apt/apt/usr/bin/pydoc3:                                broken symbolic link to pydoc3.10
/layers/fagiani_apt/apt/usr/lib/x86_64-linux-gnu/libjq.so.1:           symbolic link to libjq.so.1.0.4
/layers/fagiani_apt/apt/usr/share/doc/jq/changelog.Debian.gz:          symbolic link to ../libjq1/changelog.Debian.gz
/layers/fagiani_apt/apt/usr/share/doc/python3.10/python-policy.txt.gz: symbolic link to ../python3/python-policy.txt.gz
/layers/fagiani_apt/apt/usr/share/doc/python3/README.Debian:           broken symbolic link to ../libpython3-stdlib/README.Debian
/layers/fagiani_apt/apt/usr/share/doc/python3/changelog.Debian.gz:     broken symbolic link to ../libpython3-stdlib/changelog.Debian.gz
/layers/fagiani_apt/apt/usr/share/pixmaps/python3.xpm:                 broken symbolic link to python3.10.xpm
/layers/fagiani_apt/apt/usr/share/man/man1/pydoc3.1.gz:                broken symbolic link to pydoc3.10.1.gz
/layers/fagiani_apt/apt/usr/share/man/man1/pygettext3.1.gz:            broken symbolic link to pygettext3.10.1.gz
/layers/fagiani_apt/apt/usr/share/man/man1/pdb3.1.gz:                  broken symbolic link to pdb3.10.1.gz

So I think we really have two tasks – absolute symlinks need to be adjusted, to fix the Java problems mentioned in T353847; but also, some relative symlinks are apparently broken, and I don’t know why? Why does usr/bin/ have pygettext3 but not pygettext3.10?

For java, I'm missing a couple links, that I think are broken anyhow:

[step-build] 2024-01-26T12:31:51.804496170Z I don't know how to fix broken link /layers/fagiani_apt/apt/usr/lib/jvm/java-11-openjdk-amd64/lib/src.zip -> /layers/fagiani_apt/apt/usr/lib/jvm/openjdk-11/src.zip.
[step-build] 2024-01-26T12:31:51.805309569Z Missing link destination for /layers/fagiani_apt/apt/usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs -> /etc/java-11-openjdk/security/blacklisted.certs
[step-build] 2024-01-26T12:31:51.805321108Z maybe there's some packages missing to install?

On an ubuntu machine:

dcaro@lima-ubuntu-lts:~$ ls -la /usr/lib/jvm/java-11-openjdk-amd64/lib/src.zip
lrwxrwxrwx 1 root root 24 Oct 19 07:55 /usr/lib/jvm/java-11-openjdk-amd64/lib/src.zip -> ../../openjdk-11/src.zip

And

dcaro@lima-ubuntu-lts:~$ ls -la /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs
lrwxrwxrwx 1 root root 47 Oct 19 07:55 /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs -> /etc/java-11-openjdk/security/blacklisted.certs

I will make the buildpack not fail if it can fix all the links, but just show a message :/

dcaro moved this task from In Progress to Done on the Toolforge (Toolforge iteration 04) board.

This should be fixed now, the links are created and skipped if unable to do so.

I don't know how to fix broken link /layers/fagiani_apt/apt/usr/lib/jvm/java-11-openjdk-amd64/lib/src.zip -> /layers/fagiani_apt/apt/usr/lib/jvm/openjdk-11/src.zip.

I’m guessing that’s part of the separate package openjdk-11-source (which openjdk-11-jdk-headless suggests but neither recommends nor depends on).

Java and Maven seem to work now, thank you!