tar-1.26 not unpacking archives with symlinks?

Natanael Copa natanael.copa at gmail.com
Tue Mar 13 21:40:38 UTC 2012


On Thu, Mar 1, 2012 at 5:45 PM, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:
> On Feb 29, 2012 6:33 PM, "Ed W" <lists at wildgooses.com> wrote:
>>
>> Hi, I'm hitting an error when trying to unpack archives with the recently
> unmasked tar-1.26.  Basically any symlinks in the archive trigger an
> "unknown file" error.  This prevents me using emerge -k amongst other things
>>
>> I only see this on uclibc-0.9.33 based system, not on the build host
> which uses glibc amd64
>>
>> Can anyone else repro this and shed any light on what the problem might
> be?  Problem in tar or uclibc?
>>
>
> Can you provide a tarbalk with one file that exhibits the problem, plus an
> strafe of the attempt to unpack it?

I have seen this too and it only happens when the symlink is extracted
before the file it points to.

To reproduce:
  touch myfile
  ln -s myfile mylink
  tar -cf testcase1.tar mylink myfile

If the file comes first (tar -cf testcase2.tar myfile mylink) it will work.

The eopen("../testcase.tar", O_RDONLY|O_LARGEFILE) = 3
read(3, "mylink\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
10240) = 10240
fstat64(3, {st_mode=S_IFREG|0644, st_size=10240, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=10240, ...}) = 0
clock_gettime(CLOCK_REALTIME, {1331674689, 932333357}) = 0
open("/etc/passwd", O_RDONLY)           = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, 0x5e47954c) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0x14e71000)                         = 0x14e71000
read(4, "root:x:0:0:root:/root:/bin/ash\nb"..., 8192) = 2853
close(4)                                = 0
open("/etc/group", O_RDONLY)            = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, 0x5e47954c) = -1 ENOTTY (Inappropriate ioctl for device)
read(4, "root:x:0:root\nbin:x:1:root,bin,d"..., 8192) = 1158
close(4)                                = 0
symlinkat("myfile", AT_FDCWD, "mylink") = 0
fstatat64(AT_FDCWD, "mylink", {st_mode=S_IFLNK|0777, st_size=6, ...},
AT_SYMLINK_NOFOLLOW) = 0
utimensat(AT_FDCWD, "mylink", {{1331674689, 930453230}, {1331674345,
0}}, AT_SYMLINK_NOFOLLOW) = 0
fstatat64(AT_FDCWD, "mylink", {st_mode=S_IFLNK|0777, st_size=6, ...},
AT_SYMLINK_NOFOLLOW) = 0
fchmodat(AT_FDCWD, "mylink", 0755)      = -1 ENOENT (No such file or directory)
write(2, "tar", 3tar)                      = 3
write(2, ": ", 2: )                       = 2
write(2, "mylink", 6mylink)                   = 6
write(2, ": Cannot change mode to ", 24: Cannot change mode to ) = 24
write(2, "rwxr-xr-x", 9rwxr-xr-x)                = 9
write(2, ": ", 2: )                       = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
)                       = 1
openat(AT_FDCWD, "myfile",
O_WRONLY|O_CREAT|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC,
0644) = 4
dup2(4, 4)                              = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
utimensat(4, NULL, {{1331674689, 933786545}, {1331674327, 0}}, 0) = 0
close(4)                                = 0
clock_gettime(CLOCK_REALTIME, {1331674689, 938422399}) = 0
clock_gettime(CLOCK_REALTIME, {1331674689, 938497339}) = 0
close(3)                                = 0
write(2, "tar", 3tar)                      = 3
write(2, ": ", 2: )                       = 2
write(2, "Exiting with failure status due "..., 50Exiting with failure
status due to previous errors) = 50
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(2)                           = ?
rror message from tar:
tar: mylink: Cannot change mode to rwxr-xr-x: No such file or directory
tar: Exiting with failure status due to previous errors


It's the fchmodat() that fails which makes me wonder why it works on GNU libc.

-- 
Natanael Copa


More information about the uClibc mailing list