Hi!

I've ecountered minor problem with scratchbox2 - after each run of gcc 
there are empty /tmp/cc* files left despite of mapping rules (ok, these 
files don't appear in emulate but that is it).

I've tried to narrow down the cause of problem and I've to say I've been 
only partially successful at it.

  1. I've created minimal armel Debian-based environment at $HOME/sb2/
target-armel with tools from Debian/emDebian at $HOME/sb2/tools and setup 
sb2 environment like this:

     sb2-init -N -n -m devel -A arm -c qemu-arm -t $HOME/sb2/tools/ gcc-
test $HOME/sb2/tools/usr/bin/arm-linux-gnueabi-gcc

 2. I've found rather minimial command that causes the creation of 
temporary files. (I tried to compile sth like "int main() { print("erm
\n"); return 0;}")

     sb2 -t gcc-test -R -m devel gcc -### a.c

     Ok, /tmp/cc* files were created and left after gcc finished.

 3. I straced it.

child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0xb7592728) = 13328

[pid 13328] execve("/home/k.lewandowsk/sb2/tools/lib/ld-linux.so.2", ["/
home/k.lewandowsk/sb2/tools/lib"..., "--rpath-prefix", "/home/
k.lewandowsk/sb2/tools", "--nodefaultdirs", "--argv0", "/bin/bash", "/
home/k.lewandowsk/sb2/tools/bin"..., "-c", "gcc -### a.c"], [/* 59 vars 
*/]) = 0

[pid 13328] open("/tmp/sb2-k.lewandowsk-20101019-011954.FyPSDQ/
lua_scripts/main.lua", O_RDONLY) = 3
[pid 13328] fstat64(3, {st_mode=S_IFREG|0644, st_size=4132, ...}) = 0
[pid 13328] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|
MAP_ANONYMOUS, -1, 0) = 0xb750c000
[pid 13328] read(3, "-- Scratchbox2 Lua main file\n-- "..., 4096) = 4096
[pid 13328] read(3, "end\n\n-- sb2 is ready for operati"..., 4096) = 36

[pid 13328] write(2, "gcc version 4.4.1 (SLP 4.4.1-6+s"..., 41gcc version 
4.4.1 (SLP 4.4.1-6+slp2+s3) 
) = 41
[pid 13328] access("/tmp/sb2-k.lewandowsk-20101019-011954.FyPSDQ/tmp", 
R_OK|W_OK|X_OK) = 0
[pid 13328] gettimeofday({1287418796, 450363}, NULL) = 0
[pid 13328] open("/tmp/cc2bYEZE.s", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 
0600) = 3
[pid 13328] close(3) = 0

Ok, this is the part I don't understand - access resolves path correctly 
but not open?

 4.  I've looked into gcc's "driver" sources - didn't find any hardcoded 
system calls... ;)

      (Actually, I ran away screaming.)

 5.  Next was "sb2 -d"

      $ sb2 -t gcc-test -R -d -L noise2 gcc -### a.c 

First, path to cross-compiler is mapped (correctly):

gcc[8131] >>>>: map:/usr/lib/gcc/arm-linux-gnueabi [luaif/luaif.c:558]
gcc[8131] split->'/home/k.lewandowsk/sb2/tools/usr/lib/gcc/arm-linux-
gnueabi' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] mapped: access '/usr/lib/gcc/arm-linux-gnueabi' -> '/home/
k.lewandowsk/sb2/tools/usr/lib/gcc/arm-linux-gnueabi' (readonly) [luai
f/paths.c:877]
gcc[8131] call_lua_function_sbox_translate_path: at exit, gettop=77 
[luaif/paths.c:888]
gcc[8131] drop policy from stack: at exit, gettop=76 [luaif/paths.c:1006]
gcc[8131] prefix_mapping_result_host_path before loop => /home/
k.lewandowsk/sb2/tools/usr/lib/gcc/arm-linux-gnueabi [luaif/paths.c:1126]
gcc[8131] path_resolution: test if symlink [3] '/home/k.lewandowsk/sb2/
tools/usr/lib/gcc/arm-linux-gnueabi' [luaif/paths.c:1164]
gcc[8131] readlink_nomap returns, errno=22 (SET) [preload/wrappers.c:4974]
gcc[8131] path_resolution: test if symlink [4] '/home/k.lewandowsk/sb2/
tools/usr/lib/gcc/arm-linux-gnueabi/4.4.1' [luaif/paths.c:1164]
gcc[8131] readlink_nomap returns, errno=22 (unchanged) [preload/
wrappers.c:4974]
gcc[8131] path_resolution: test if symlink [5] '/home/k.lewandowsk/sb2/
tools/usr/lib/gcc/arm-linux-gnueabi/4.4.1/collect2' [luaif/paths.
gcc:1164]
gcc[8131] readlink_nomap returns, errno=22 (unchanged) [preload/
wrappers.c:4974]
gcc[8131] sb_path_resolution returns '/usr/lib/gcc/arm-linux-
gnueabi/4.4.1/collect2' [luaif/paths.c:1277]
gcc[8131] sbox_map_path_internal: resolved_virtua='/usr/lib/gcc/arm-linux-
gnueabi/4.4.1/collect2' [luaif/paths.c:1679]
gcc[8131] calling sbox_translate_path for access(/usr/lib/gcc/arm-linux-
gnueabi/4.4.1/collect2) [luaif/paths.c:784]
gcc[8131] call_lua_function_sbox_translate_path: gettop=76 [luaif/
paths.c:787]
gcc[8131] >>>>: map:/usr/lib/gcc/arm-linux-gnueabi/4.4.1/collect2 [luaif/
luaif.c:558]
gcc[8131] split->'/home/k.lewandowsk/sb2/tools/usr/lib/gcc/arm-linux-
gnueabi/4.4.1/collect2' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] mapped: access '/usr/lib/gcc/arm-linux-gnueabi/4.4.1/collect2' -
> '/home/k.lewandowsk/sb2/tools/usr/lib/gcc/arm-linux-gnueabi/4.4.1/
collect2' (readonly) [luaif/paths.c:877]
gcc[8131] call_lua_function_sbox_translate_path: at exit, gettop=77 
[luaif/paths.c:888]
gcc[8131] drop policy from stack: at exit, gettop=76 [luaif/paths.c:1006]
gcc[8131] drop rule from stack: at exit, gettop=75 [luaif/paths.c:1006]
gcc[8131] sbox_map_path_internal: mapping_result='/home/k.lewandowsk/sb2/
tools/usr/lib/gcc/arm-linux-gnueabi/4.4.1/collect2' [luaif/paths.c:1738]
gcc[8131] release_lua() [luaif/luaif.c:312]
gcc[8131] access returns 0, errno=2 (unchanged) [preload/wrappers.c:1974]

Then, the /tmp/cc*

gcc[8131] sbox_map_path_internal: __xstat(/tmp/ccgMX94n.o) [luaif/
paths.c:1541]
gcc[8131] getenv(SBOX_DISABLE_MAPPING) [preload/privatewrappers.c:11]
gcc[8131] getenv returns '<NULL>', errno=0 (unchanged) [preload/
privatewrappers.c:21]
gcc[8131] get_lua() [luaif/luaif.c:339]
gcc[8131] split->'/tmp/ccgMX94n.o' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] sbox_map_path_internal: process '/tmp/ccgMX94n.o', n='/tmp/
ccgMX94n.o' [luaif/paths.c:1644]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] calling sbox_get_mapping_requirements for __xstat(/tmp/
ccgMX94n.o) [luaif/paths.c:916]
gcc[8131] call_lua_function_sbox_get_mapping_requirements: gettop=75 
[luaif/paths.c:919]
gcc[8131] >>>>: find_rule for (/tmp/ccgMX94n.o) [luaif/luaif.c:558]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/sb2/
wrappers','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/sb2/
scripts','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/home/k.lewandowsk/
sb2/tools','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/opt/maemo','(null)' 
=> -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/home/
k.lewandowsk','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/home/user','(null)' 
=> -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/home','(null)' => -1 
(no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/lib/
terminfo','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','/lib','(null)' => -1 
(no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccgMX94n.o','(null)','(null)' => 4 
(dir) [luaif/luaif.c:791]
gcc[8131] >>>>: selected rule 'rule:1.14' [luaif/luaif.c:558]
gcc[8131] sbox_get_mapping_requirements -> 1,4,00 [luaif/paths.c:943]
gcc[8131] call_lua_function_sbox_get_mapping_requirements: at exit, 
gettop=76 [luaif/paths.c:948]
gcc[8131] min_path_len_to_check=4 [luaif/paths.c:1087]
gcc[8131] skipping [0] 'tmp' (1,3) [luaif/paths.c:1092]
gcc[8131] Path resolutions starts from [1] 'ccgMX94n.o' [luaif/
paths.c:1102]
gcc[8131] clean_virtual_path_prefix_tmp => /tmp/ccgMX94n.o [luaif/
paths.c:1116]
gcc[8131] calling sbox_translate_path for __xstat(/tmp/ccgMX94n.o) [luaif/
paths.c:784]
gcc[8131] call_lua_function_sbox_translate_path: gettop=76 [luaif/
paths.c:787]
gcc[8131] >>>>: map:/tmp/ccgMX94n.o [luaif/luaif.c:558]
gcc[8131] split->'/tmp/sb2-k.lewandowsk-20101019-012912.ku56ua/tmp/
ccgMX94n.o' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] mapped: __xstat '/tmp/ccgMX94n.o' -> '/tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccgMX94n.o' [luaif/paths.c:877]
gcc[8131] call_lua_function_sbox_translate_path: at exit, gettop=77 
[luaif/paths.c:888]
gcc[8131] drop policy from stack: at exit, gettop=76 [luaif/paths.c:1006]
gcc[8131] prefix_mapping_result_host_path before loop => /tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccgMX94n.o [luaif/paths.c:1126]

Well, this is ok!

gcc[8131] path_resolution: test if symlink [1] '/tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccgMX94n.o' [luaif/paths.c:1164]
gcc[8131] readlink_nomap returns, errno=2 (SET) [preload/wrappers.c:4974]
gcc[8131] sb_path_resolution returns '/tmp/ccgMX94n.o' [luaif/
paths.c:1277]

But this isn't. It's the end of sb_path_resolution - from my (very 
limited) understanding it's the case when one doesn't need to traverse  
virtual_path_ptr - i.e. pe_next is NULL and you just free the current (in 
this case correct) mapping result. 

virtual_path_work_ptr = virtual_path_work_ptr->pe_next;
if (virtual_path_work_ptr) {
...
} else {
  free(prefix_mapping_result_host_path);
  prefix_mapping_result_host_path = NULL;
}

Ok, actually I'm lost in the code - I tried to fix it but it failed 
horribly under testing on my system (several times).

So, the question is  - can you reproduce the problem and tell me if my 
reasoning is sound?  I'm using vanilla scratchbox2.1 (uh, I might have 
modified it trying to fix this issue).


Here goes the rest of log, maybe it will be useful.

Thanks! :)

gcc[8131] sbox_map_path_internal: resolved_virtua='/tmp/
ccgMX94n.o' [luaif/paths.c:1679]
gcc[8131] calling sbox_translate_path for __xstat(/tmp/ccgMX94n.o) [luaif/
paths.c:784]
gcc[8131] call_lua_function_sbox_translate_path: gettop=76 [luaif/
paths.c:787]
gcc[8131] >>>>: map:/tmp/ccgMX94n.o [luaif/luaif.c:558]
gcc[8131] split->'/tmp/sb2-k.lewandowsk-20101019-012912.ku56ua/tmp/
ccgMX94n.o' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] mapped: __xstat '/tmp/ccgMX94n.o' -> '/tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccgMX94n.o' [luaif/paths.c:877]
gcc[8131] call_lua_function_sbox_translate_path: at exit, gettop=77 
[luaif/paths.c:888]
gcc[8131] drop policy from stack: at exit, gettop=76 [luaif/paths.c:1006]
gcc[8131] drop rule from stack: at exit, gettop=75 [luaif/paths.c:1006]
gcc[8131] sbox_map_path_internal: mapping_result='/tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccgMX94n.o' [luaif/paths.c:1738]
gcc[8131] release_lua() [luaif/luaif.c:312]
gcc[8131] __xstat returns -1, errno=2 (unchanged) [preload/
wrappers.c:1658]
gcc[8131] sbox_map_path_internal: __xstat(/tmp/ccDlDUbM.s) [luaif/
paths.c:1541]
gcc[8131] getenv(SBOX_DISABLE_MAPPING) [preload/privatewrappers.c:11]
gcc[8131] getenv returns '<NULL>', errno=0 (unchanged) [preload/
privatewrappers.c:21]
gcc[8131] get_lua() [luaif/luaif.c:339]
gcc[8131] split->'/tmp/ccDlDUbM.s' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] sbox_map_path_internal: process '/tmp/ccDlDUbM.s', n='/tmp/
ccDlDUbM.s' [luaif/paths.c:1644]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] calling sbox_get_mapping_requirements for __xstat(/tmp/
ccDlDUbM.s) [luaif/paths.c:916]
gcc[8131] call_lua_function_sbox_get_mapping_requirements: gettop=75 
[luaif/paths.c:919]
gcc[8131] >>>>: find_rule for (/tmp/ccDlDUbM.s) [luaif/luaif.c:558]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/sb2/
wrappers','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/sb2/
scripts','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/home/k.lewandowsk/
sb2/tools','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/opt/maemo','(null)' 
=> -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/home/
k.lewandowsk','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/home/user','(null)' 
=> -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/home','(null)' => -1 
(no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/lib/
terminfo','(null)' => -1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','/lib','(null)' => -1 
(no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','(null)','(null)' => 
-1 (no match) [luaif/luaif.c:791]
gcc[8131] lua_sb_test_path_match '/tmp/ccDlDUbM.s','(null)','(null)' => 4 
(dir) [luaif/luaif.c:791]
gcc[8131] >>>>: selected rule 'rule:1.14' [luaif/luaif.c:558]
gcc[8131] sbox_get_mapping_requirements -> 1,4,00 [luaif/paths.c:943]
gcc[8131] call_lua_function_sbox_get_mapping_requirements: at exit, 
gettop=76 [luaif/paths.c:948]
gcc[8131] min_path_len_to_check=4 [luaif/paths.c:1087]
gcc[8131] skipping [0] 'tmp' (1,3) [luaif/paths.c:1092]
gcc[8131] Path resolutions starts from [1] 'ccDlDUbM.s' [luaif/
paths.c:1102]
gcc[8131] clean_virtual_path_prefix_tmp => /tmp/ccDlDUbM.s [luaif/
paths.c:1116]
gcc[8131] calling sbox_translate_path for __xstat(/tmp/ccDlDUbM.s) [luaif/
paths.c:784]
gcc[8131] call_lua_function_sbox_translate_path: gettop=76 [luaif/
paths.c:787]
gcc[8131] >>>>: map:/tmp/ccDlDUbM.s [luaif/luaif.c:558]
gcc[8131] split->'/tmp/sb2-k.lewandowsk-20101019-012912.ku56ua/tmp/
ccDlDUbM.s' [luaif/paths.c:321]
gcc[8131] is_clean_path: clean [luaif/paths.c:514]
gcc[8131] mapped: __xstat '/tmp/ccDlDUbM.s' -> '/tmp/sb2-
k.lewandowsk-20101019-012912.ku56ua/tmp/ccDlDUbM.s' [luaif/paths.c:877]

_______________________________________________
Scratchbox-devel mailing list
[email protected]
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-devel

Reply via email to