rpm-software-management / rpmlint

Tool for checking common errors in rpm packages
GNU General Public License v2.0
127 stars 113 forks source link

Error about hardlinking over partitions with 2.2.0 #771

Open smooge opened 2 years ago

smooge commented 2 years ago

I ran into a catch-22 issue with rpmlint-2.2.0 and hardlinking.

If in one case we hardlink between /usr/bin and /usr/lib64 we get errors like:

qt5-qtbase-devel.x86_64: E: hardlink-across-partition /usr/lib64/qt5/bin/uic /usr/bin/uic-qt5 Your package contains two files that are apparently hardlinked and that are likely on different partitions. Installation of such an RPM will fail due to RPM being unable to unpack the hardlink. Do not hardlink across the first two levels of a path, e.g. between /var/ftp and /var/www or /etc and /usr.

qt5-qtbase-devel.x86_64: W: cross-directory-hard-link
/usr/lib64/qt5/bin/uic /usr/bin/uic-qt5
File is hard linked across directories. This can cause problems in
installations where the directories are located on different devices.

but if you don't then you get an error about %fdupes needing to be used and the packages should be hardlinked across directories.

qt5-qtbase-examples.x86_64: E: files-duplicated-waste 168944
Your package contains duplicated files that are not hard- or symlinks. You
should use the %fdupes macro to link the files to one.
qt5-qtbase-examples.x86_64: W: files-duplicate
/usr/lib64/qt5/examples/widgets/itemviews/puzzle/example.jpg
/usr/lib64/qt5/examples/widgets/draganddrop/puzzle/example.jpg

It seems that this is a no-win situation.

marxin commented 2 years ago

@Vogtinator @DimStar77 Can you please help me if the cross-directory-hard-link is a correct rpmlint error reported?

Vogtinator commented 2 years ago

At least post usr-merge it's not really possible to have /usr/lib64 and /usr/bin on different partitions.

In openSUSE packages, /usr/bin/uic-qt5 is a symlink so we avoided that issue by accident.

DimStar77 commented 2 years ago

I don't think /usr/bin being split onto a different partition than /usr/lib64 was ever considered a supported setup in any distro. So rpmlint seems to be slightly too eager here

marxin commented 2 years ago

I don't think /usr/bin being split onto a different partition than /usr/lib64 was ever considered a supported setup in any distro. So rpmlint seems to be slightly too eager here

I see, to be honest, the check only compares parent directory of 2 hardlinks:

https://github.com/rpm-software-management/rpmlint/blob/497dfb3f85b92b9b465089d24c951ac9e024b4ef/rpmlint/checks/FilesCheck.py#L584-L586

Theoretically, it can only report when top-most directories are different. One more note, openSUSE config has it disabled the check: https://github.com/rpm-software-management/rpmlint/blob/497dfb3f85b92b9b465089d24c951ac9e024b4ef/configs/openSUSE/opensuse.toml#L30