Hi cpio miantainers,

I found that cpio has changed exit code from 0 to 2 when failed to create a 
symbolic link in this fix: 
http://git.savannah.gnu.org/cgit/cpio.git/commit/?id=376d663340a9dc91c91a5849e5713f07571c1628
 and I am writing to ask is this an expected behavior? 
Before this commit, in copyin_link() function, when failing to create a 
symbolic link, cpio used error() to record failure. After this commit, cpio 
uses symlink_error () to record failure.
However, symlink_error() will set the exit code to 2 which means failure. May I 
know the reason for changing
error function to symlink_error function?


Below are the steps to reproduce the problem:
```
dd if=/dev/zero of=/root/tempfsvfat bs=1M count=4000
mkfs.vfat /root/tempfsvfat
mkdir vfat-file
mount tempfsvfat vfat-file/      # create a vfat file system which don't 
support symlink
cd vfat-file/
cp -ar /boot/initramfs-4.19.90-2109.1.0.0108.oe1.x86_64.img .
zcat *.img | cpio -di
echo $?      
```
We may replace '/boot/initramfs-4.19.90-2109.1.0.0108.oe1.x86_64.img' file with 
any other initramfs file under /boot/ directory in Linux system.


The cpio will always fail to extract symbolic link under vfat-file directory 
which is normal behavior because vfat filesystem doesn't support symbolic link,
but the return value of 'echo $?' has changed from 0 to 2 when using the latest 
cpio version. In my opinion, cpio should terminate once it sets the exit code 
to 2
which means failure, but cpio didn't do that. So what is the expected exit code 
when failing to create a symbolic link?


Best
Ziyang

Reply via email to