Hi cpio miantainers,

I encountered a regression in cpio 2.14: the --make-directories option is ignored if the file being created is a symbolic link. cpio 2.13 and prior are not affected.

Example using cpio 2.14:

        # rpm2cpio < 
../source/RPMS/libreoffice7.4-freedesktop-menus-7.4.7-2.noarch.rpm |\
          cpio -i -u -m -d --no-absolute-filenames --quiet
        cpio: ./usr/bin/libreoffice7.4: Cannot open: No such file or directory
        cpio: ./usr/share/applications/libreoffice7.4-base.desktop: Cannot 
open: No such file or directory
        # ls ./usr/bin
        /bin/ls: cannot access './usr/bin': No such file or directory
        #

Same command after downgrading to cpio 2.13:

        # rpm2cpio < 
../source/RPMS/libreoffice7.4-freedesktop-menus-7.4.7-2.noarch.rpm |\
          cpio -i -u -m -d --no-absolute-filenames --quiet
        cpio: Removing leading `/' from hard link targets
        # ls -l ./usr/bin
        total 4
        lrwxrwxrwx 1 root root 34 May 17 03:44 libreoffice7.4 -> 
opt/libreoffice7.4/program/soffice
        #

As an aside, there's another bug - or rather a misfeature - displayed here, and that is that --no-absolute-filenames is not only removing the leading "/" from pathnames of files extracted, but also removes the leading "/" from the target of symbolic links.  This makes building an OS package very frustrating (as you need to remake all the symlinks by hand).

That is, if we are extracting under /tmp/package_build/ we get /tmp/package_build/usr/bin/libreoffice7.4 and so on, which when installed under the root "/", we get this:

        # libreoffice7.4
        -bash: libreoffice7.4: command not found
        # readlink /usr/bin/libreoffice7.4
        opt/libreoffice7.4/program/soffice
        # realpath -m /usr/bin/libreoffice7.4
        /usr/bin/opt/libreoffice7.4/program/soffice
        #

So, to fix this, one would want another option, similar to rsync's option --munge-symlinks, that defaults off but could be turned on to remove the leading "/" on the link target.

Best regards,
Kris

Reply via email to