bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] Warning: Cannot readlink: Invalid argument


From: Andre Majorel
Subject: [Bug-cpio] Warning: Cannot readlink: Invalid argument
Date: Fri, 22 Jan 2010 20:49:24 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

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

[Prev in Thread] Current Thread [Next in Thread]