|
From: | youngchen |
Subject: | Re[PATCH]:Re:cpio changed exit code when failed to create symlink |
Date: | Mon, 10 Jul 2023 20:38:42 +0800 (CST) |
At 2023-07-04 20:53:46, "youngchen" <13980044430@163.com> wrote:
Dear cpio maintainers:I would like to propose a patch because after fix of CVE-2015-1197, cpio-2.14 set exit code to 2 when failing to create a symlink. In fact, in function copyin_link, cpio use symlink_error() instead of error() function.From the user's perspective, exit code not equal to 0 means error and cpio should terminate, but cpio don't terminate. So I thinkit's better to keep exit code as 0 when failing to create a symlink, which is consistent with cpio-2.13. I am very happy to hear any feedback or suggestions regarding this patch.BestZiyang
At 2023-06-23 11:16:38, "youngchen" <13980044430@163.com> wrote:
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 changingerror 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 2which means failure, but cpio didn't do that. So what is the expected exit code when failing to create a symbolic link?BestZiyang
0001-Do-not-set-exit-code-to-2-when-failing-to-create-sym.patch
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |