Hello everyone. When cpio is asked to archive files like
/sys/devices/pci0000:00/pci_bus:0000:00 on Linux, it emits
messages like

  cpio: $file: Warning: Cannot readlink: Invalid argument

Guess this is because it calls readlink(2) with a buffer size of
zero :

  # echo /sys/devices/pci0000:00/pci_bus:0000:00 |
    strace cpio -o 2>&1 >/dev/null | grep ^readlink
  readlink("/sys/devices/pci0000:00/pci_bus:0000:00", 0x9a86c80, 0)
    = -1 EINVAL (Invalid argument)

cpio does that because it blindly trusts st_size (copyout.c:810)
and, on a Linux sys pseudo file system, st_size is apparently zero
for all symlinks.

While the OS is clearly at fault here for returning bollocks in
st_size, I think it would be a good thing if cpio could cope. The
other programs I've tried (GNU ls, stat(1), readlink(1), GNU find)
all do.

-- 
André Majorel http://www.teaser.fr/~amajorel/


Reply via email to