Bug 19032 - inconsistent behaviour of unlink when dealing with relative and full paths of symlinks
Summary: inconsistent behaviour of unlink when dealing with relative and full paths of...
Status: RESOLVED FIXED
Alias: None
Product: Scratchbox 2
Classification: Unclassified
Component: libsb2 (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Lauri Leukkunen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-11 16:27 UTC by Carsten Munk
Modified: 2008-12-14 03:45 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
test case for issue (903 bytes, application/octet-stream)
2008-12-11 16:27 UTC, Carsten Munk
Details
output of testcase being run with sb2 -R -m emulate ./testcase.sh (1.96 KB, text/plain)
2008-12-11 16:31 UTC, Carsten Munk
Details
sbox2 debug log associated to testcase running, gzipped (237.15 KB, application/gzip)
2008-12-11 16:34 UTC, Carsten Munk
Details

Description Carsten Munk 2008-12-11 16:27:50 UTC
Created attachment 21071 [details]
test case for issue

This attached testcase yields inconsistent behaviour when run with sb2 -R -m emulate, basically, that rm <relative path> of a symbolic link containing a relative path (../foo/bar for instance.) works, while rm /full/path of a symbolic link containing a relative path does not work.

This breaks for instance, the fontconfig-config package (from ubuntu), where it rm's /etc/fonts/conf.d/10-no-sub-pixel.conf which is a relative symlink to ../conf.avail/10-no-sub-pixel.conf, and fails to configure because of failure to
rm (No such file or directory).
Comment 1 Carsten Munk 2008-12-11 16:31:52 UTC
Created attachment 21073 [details]
output of testcase being run with sb2 -R -m emulate ./testcase.sh
Comment 2 Carsten Munk 2008-12-11 16:34:31 UTC
Created attachment 21074 [details]
sbox2 debug log associated to testcase running, gzipped
Comment 3 Carsten Munk 2008-12-12 16:32:18 UTC
relevant strace (outside sb2) traces from successful attempt:

id  7610] execve("/home/cvm/mr-sdk/sb2/bin/qemu-arm", ["/home/cvm/mr-sdk/sb2/bin/qemu-ar"..., "-drop-ld-preload", "-L", "/", "/bin/readlink", "/foo/test/a/d"
...
[pid  7610] readlink("/home/cvm/mr-sdk/jaunty-armel/foo/test/a/d", "../b/c", 64) = 6
....
[pid  7610] write(1, "../b/c\n", 7../b/c
....
[pid  7611] unlinkat(AT_FDCWD, "test/a/d", 0) = 0


relevant strace traces from unsuccessful attempt:
[pid  7611] execve("/home/cvm/mr-sdk/sb2/bin/qemu-arm", ["/home/cvm/mr-sdk/sb2/bin/qemu-ar"..., "-drop-ld-preload", "-L", "/", "/bin/rm", "test/a/d"], [/* 45


id  7618] execve("/home/cvm/mr-sdk/sb2/bin/qemu-arm", ["/home/cvm/mr-sdk/sb2/bin/qemu-ar"..., "-drop-ld-preload", "-L", "/", "/bin/readlink", "/bar/test/a/d"
.....
[pid  7618] readlink("/home/cvm/mr-sdk/jaunty-armel/bar", 0xbf8b5b97, 4096) = -1 EINVAL (Invalid argument)
[pid  7618] readlink("/home/cvm/mr-sdk/jaunty-armel/bar/test", 0xbf8b5b97, 4096) = -1 EINVAL (Invalid argument)
[pid  7618] readlink("/home/cvm/mr-sdk/jaunty-armel/bar/test/a", 0xbf8b5b97, 4096) = -1 EINVAL (Invalid argument)
[pid  7618] readlink("/home/cvm/mr-sdk/jaunty-armel/bar/test/a/d", "../b/c", 64) = 6
[pid  7618] fstat64(1, {st_mode=S_IFREG|0644, st_size=2934567, ...}) = 0
....
[pid  7618] mmap2(0x421cf000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x421cf000
[pid  7618] write(1, "../b/c\n", 7../b/c
)     = 7

.....
[pid  7619] execve("/home/cvm/mr-sdk/sb2/bin/qemu-arm", ["/home/cvm/mr-sdk/sb2/bin/qemu-ar"..., "-drop-ld-preload", "-L", "/", "/bin/rm", "/bar/test/a/d"], [
.....
[pid  7619] unlinkat(AT_FDCWD, "/bar/test/a/d", 0) = -1 ENOENT (No such file or directory)
[pid  7619] write(2, "/bin/rm: ", 9/bin/rm: )    = 9
[pid  7619] write(2, "cannot remove `/bar/test/a/d\'", 29cannot remove `/bar/test/a/d') = 29
[pid  7619] write(2, ": No such file or directory", 27: No such file or directory) = 27
[pid  7619] write(2, "\n", 1

.....
Comment 4 Carsten Munk 2008-12-14 03:45:37 UTC
problem was solved with sb2-qemu-arm from maemo-sdk+. might be worth documenting.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.