bugGNU cpio - Bugs: bug #66101, cpio -d doesn't create directories...

 
 

bug #66101: cpio -d doesn't create directories for symlinks

Submitter:  Paul D. Smith <psmith>
Submitted:  Sat 17 Aug 2024 06:24:52 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 17 Aug 2024 10:25:04 AM UTC, comment #1: 

This has been fixed in version 2.14. Please, upgrade.

Sergey Poznyakoff <gray>
Group administrator
Sat 17 Aug 2024 06:24:52 AM UTC, original submission:  

I'm running cpio (GNU cpio) 2.13 on GNU/Linux (x86_64).

I have a CPIO file with these contents:

$ cpio -itv < ../xx.cpio
-rwxr-xr-x   1 root     root        33864 Apr 11  2021 ./usr/bin/xmlwf
drwxr-xr-x   1 root     root            0 Apr 11  2021 ./usr/lib/.build-id
drwxr-xr-x   1 root     root            0 Apr 11  2021 ./usr/lib/.build-id/3c
lrwxrwxrwx   1 root     root           39 Apr 11  2021 ./usr/lib/.build-id/3c/f85ecb96e4abd4ca00f000970d1f8c89eb6753 -> ../../../../usr/lib64/libexpat.so.1.6.7
drwxr-xr-x   1 root     root            0 Apr 11  2021 ./usr/lib/.build-id/bb
lrwxrwxrwx   1 root     root           25 Apr 11  2021 ./usr/lib/.build-id/bb/0390b9cc18e9a874ffed624b6ec25d5993ebb8 -> ../../../../usr/bin/xmlwf
lrwxrwxrwx   1 root     root           17 Apr 11  2021 ./usr/lib64/libexpat.so.1 -> libexpat.so.1.6.7
-rwxr-xr-x   1 root     root       243992 Apr 11  2021 ./usr/lib64/libexpat.so.1.6.7
drwxr-xr-x   1 root     root            0 Apr 11  2021 ./usr/share/doc/expat
-rw-r--r--   1 root     root          142 Nov  1  2017 ./usr/share/doc/expat/AUTHORS
-rw-r--r--   1 root     root        28237 Nov  1  2017 ./usr/share/doc/expat/Changes
drwxr-xr-x   1 root     root            0 Apr 11  2021 ./usr/share/licenses/expat
-rw-r--r--   1 root     root         1144 Nov  1  2017 ./usr/share/licenses/expat/COPYING
-rw-r--r--   1 root     root         3785 Apr 11  2021 ./usr/share/man/man1/xmlwf.1.gz
613 blocks


When I try to extract it I get an error:

$ rm -rf usr && cpio -idmu --force-local --no-absolute-filenames --quiet < ../xx.cpio
cpio: ./usr/lib64/libexpat.so.1: Cannot open: No such file or directory


It turns out the problem is that the ./usr/lib64 directory does not exist, and the -d option does not compel cpio to create it when the thing to be created is a symlink (as libexpat.so.1 is).

If I pre-create the directory then it works:

$ rm -rf usr && mkdir -p usr/lib64 && cpio -idmu --force-local --no-absolute-filenames --quiet < ../xx.cpio

$ ls -l usr/lib64/
total 240
lrwxrwxrwx 1 pds pds     17 Aug 17 02:22 libexpat.so.1 -> libexpat.so.1.6.7*
-rwxr-xr-x 1 pds pds 243992 Apr 11  2021 libexpat.so.1.6.7*


Using strace I can see that the symlink fails to create, then we don't try to run mkdir for it as we do when, for example, the actual shared library libexpat.so.1.6.7 file doesn't exist.

Paul D. Smith <psmith>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gray (Posted a comment)
  • -email is unavailable- added by psmith (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-08-17 gray StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-8ccc.
    Corresponding source code