Silly behaviour when installing a symlink and marking it as a "backup" file
Consider this rather absurd package:
# Maintainer: Please don't make me responsible for this <noone@nowhere>
pkgname=silly
pkgver=1.0
pkgrel=1
pkgdesc="A rather silly package"
arch=(x86_64)
license=('GPL')
backup=(etc/my_nonexisting etc/my_existing)
package() {
mkdir -p "$pkgdir/etc"
cd "$pkgdir/etc"
ln -s /usr/doesnt_exist my_nonexisting
ln -s /usr/bin/bash my_existing
}
The question is how backups of non-regular files behave (I'm writing my own tool that interacts with the pacman database, basically a rewrite in rust of paccheck that is much faster thanks to parallelism, thus I run into weird questions).
Man pacman(8) doesn't help, because it talks about comparing md5sums. What does that mean for symlinks? The md5sum of the path the link points to?
No, it turns out it is the md5sum of the pointed to file. In particular, the pointed to file at the time of the installation. And for non-existing symlinks it is "(null)" in /var/lib/pacman/local/silly-1.0-1/files
. The (null)
causes a .pacnew to be created on update even when nothing changes. Which is quite silly.
NOTE: I'm not saying this should work. I am saying it should do one of:
- Error out when building/installing the package
- Work: hash the pointed to path, not the pointed to file
- At least be documented that backup files should only be regular files.
Also note: I haven't tried (yes I did, see comments) other exotic files (fifos, sockets, etc). But I might. It might be quite interesting.