termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
775 stars 160 forks source link

link2symlink makes too many symlink hops, gentoo distro emerge of git failed. #189

Closed zxq432 closed 3 years ago

zxq432 commented 3 years ago

Problem description

the error message:

/usr/lib/gcc/aarch64-unknown-linux-gnu/11.2.0/../../../../aarch64-unknown-linux-gnu/bin/ld: cannot open output file git: Too many levels of symbolic links
collect2: error: ld returned 1 exit status
make: *** [Makefile:2228: git] Error 1
make: *** Waiting for unfinished jobs....
 * ERROR: dev-vcs/git-2.33.0-r1::gentoo failed (install phase):
 *   emake failed

the .l2s.git files in /.l2s

# ls -alti /.l2s/.l2s.*git*
 118264 lrwxrwxrwx 1 root root     158 Sep 19 14:23 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.00020001.0002
 118264 lrwxrwxrwx 1 root root     158 Sep 19 14:23 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.00020001.0002
 118265 lrwxrwxrwx 1 root root     154 Sep 19 14:23 /.l2s/.l2s..l2s..l2s.git0001.00020003.00020001.0002 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.00020001
 118261 lrwxrwxrwx 1 root root     146 Sep 19 14:23 /.l2s/.l2s..l2s..l2s.git0001.00020003.00020001 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.0002
 118262 lrwxrwxrwx 1 root root     138 Sep 19 14:23 /.l2s/.l2s..l2s.git0001.00020003.0002 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001
 118255 lrwxrwxrwx 1 root root     130 Sep 19 14:23 /.l2s/.l2s..l2s.git0001.00020003 -> /.l2s/.l2s..l2s..l2s.git0001.00020003.00020001.0002
 118256 lrwxrwxrwx 1 root root     126 Sep 19 14:23 /.l2s/.l2s.git0001.0002 -> /.l2s/.l2s..l2s..l2s.git0001.00020003.00020001
 118252 lrwxrwxrwx 1 root root     118 Sep 19 14:23 /.l2s/.l2s.git0001 -> /.l2s/.l2s..l2s.git0001.00020003.0002
 118234 -rwxr-xr-x 1 root root 3720712 Sep 19 14:23 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.00020001.0002
 118234 -rwxr-xr-x 1 root root 3720712 Sep 19 14:23 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020003.00020001.00020001.0002
 118242 lrwxrwxrwx 1 root root     142 Sep 19 14:23 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020003.00020001 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020003.00020001.0002
 118242 lrwxrwxrwx 1 root root     142 Sep 19 14:23 /.l2s/.l2s..l2s.git-remote-http0001.00020003 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020003.00020001.0002
 118243 lrwxrwxrwx 1 root root     138 Sep 19 14:23 /.l2s/.l2s.git-remote-http0001.0001 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020003.00020001
 118239 lrwxrwxrwx 1 root root     130 Sep 19 14:23 /.l2s/.l2s.git-remote-http0001 -> /.l2s/.l2s..l2s.git-remote-http0001.00020003.0002
 118230 -rwxr-xr-x 1 root root 2231056 Sep 19 14:23 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020003.00020001.0002
 118230 -rwxr-xr-x 1 root root 2231056 Sep 19 14:23 /.l2s/.l2s..l2s.git-remote-http0001.00020003.0002
1186361 lrwxrwxrwx 1 root root     142 Sep 18 21:23 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020002.00020001 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020002.00020001.0001
1186361 lrwxrwxrwx 1 root root     142 Sep 18 21:23 /.l2s/.l2s..l2s.git-remote-http0001.00020002 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020002.00020001.0001
1186345 lrwxrwxrwx 1 root root     158 Sep 18 21:23 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.00020001.0001
1186345 lrwxrwxrwx 1 root root     158 Sep 18 21:23 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.00020001.0001
1186348 lrwxrwxrwx 1 root root     146 Sep 18 21:23 /.l2s/.l2s..l2s..l2s.git0001.00020002.00020001 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.0001
1186341 lrwxrwxrwx 1 root root     130 Sep 18 21:23 /.l2s/.l2s..l2s.git0001.00020002 -> /.l2s/.l2s..l2s..l2s.git0001.00020002.00020001.0001
1361443 lrwxrwxrwx 1 root root     154 Sep 18 14:39 /.l2s/.l2s..l2s..l2s.git0001.00020002.00020001.0001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.00020001
1361437 lrwxrwxrwx 1 root root     138 Sep 18 14:39 /.l2s/.l2s..l2s.git0001.00020002.0001 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001
1361301 -rwxr-xr-x 1 root root 3720712 Sep 18 14:39 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.00020001.0001
1361301 -rwxr-xr-x 1 root root 3720712 Sep 18 14:39 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020002.00020001.00020001.0001
1361226 -rwxr-xr-x 1 root root 2231056 Sep 18 14:39 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020002.00020001.0001
1361226 -rwxr-xr-x 1 root root 2231056 Sep 18 14:39 /.l2s/.l2s..l2s.git-remote-http0001.00020002.0001
1386981 lrwxrwxrwx 1 root root     142 Sep 18 14:23 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020001.00020001.0001
1386981 lrwxrwxrwx 1 root root     142 Sep 18 14:23 /.l2s/.l2s..l2s.git-remote-http0001.00020001 -> /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020001.00020001.0001
1387043 lrwxrwxrwx 1 root root     130 Sep 18 14:23 /.l2s/.l2s..l2s.git0001.00020001 -> /.l2s/.l2s..l2s..l2s.git0001.00020001.00020001.0001
1387002 lrwxrwxrwx 1 root root     146 Sep 18 14:23 /.l2s/.l2s..l2s..l2s.git0001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.0001
1387036 lrwxrwxrwx 1 root root     158 Sep 18 14:23 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.00020001.0001
1387036 lrwxrwxrwx 1 root root     158 Sep 18 14:23 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.00020001.0001
1361747 lrwxrwxrwx 1 root root     154 Sep 18 07:03 /.l2s/.l2s..l2s..l2s.git0001.00020001.00020001.0001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.00020001
1361744 lrwxrwxrwx 1 root root     138 Sep 18 07:03 /.l2s/.l2s..l2s.git0001.00020001.0001 -> /.l2s/.l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001
1361723 -rwxr-xr-x 1 root root 3720712 Sep 18 07:03 /.l2s/.l2s..l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.00020001.0001
1361723 -rwxr-xr-x 1 root root 3720712 Sep 18 07:03 /.l2s/.l2s..l2s..l2s..l2s.git0001.00020001.00020001.00020001.0001
1361719 -rwxr-xr-x 1 root root 2231056 Sep 18 07:03 /.l2s/.l2s..l2s..l2s.git-remote-http0001.00020001.00020001.0001
1361719 -rwxr-xr-x 1 root root 2231056 Sep 18 07:03 /.l2s/.l2s..l2s.git-remote-http0001.00020001.0001
1184397 lrwxrwxrwx 1 root root     110 Sep 14 08:43 /.l2s/.l2s.perlgit.tmp0001 -> /.l2s/.l2s.perlgit.tmp0001.0001
1184766 -rw-r--r-- 1 root root   39392 Sep 14 08:43 /.l2s/.l2s.perlgit.tmp0001.0001
 205197 lrwxrwxrwx 1 root root     102 Sep 13 18:31 /.l2s/.l2s.git0002 -> /.l2s/.l2s.git0002.0138
 205188 lrwxrwxrwx 1 root root     110 Sep 13 18:31 /.l2s/.l2s.git-shell0001 -> /.l2s/.l2s.git-shell0001.0002
 205147 lrwxrwxrwx 1 root root     114 Sep 13 18:31 /.l2s/.l2s.git-cvsserver0001 -> /.l2s/.l2s.git-cvsserver0001.0002
 205150 lrwxrwxrwx 1 root root     114 Sep 13 18:31 /.l2s/.l2s.git-remote-http0002 -> /.l2s/.l2s.git-remote-http0002.0004
 204690 -rwxr-xr-x 1 root root     107 Sep 13 18:28 /.l2s/.l2s.git-cvsserver0001.0002
 204685 -rwxr-xr-x 1 root root 2012776 Sep 13 18:28 /.l2s/.l2s.git-shell0001.0002
 204681 -rwxr-xr-x 1 root root 3737416 Sep 13 18:28 /.l2s/.l2s.git0002.0138
 204652 -rwxr-xr-x 1 root root 2239416 Sep 13 18:28 /.l2s/.l2s.git-remote-http0002.0004
# 

Steps to reproduce

proot-distro login gentoo
emerge -va git

Expected behavior

emerge till finish successfully.

Additional information

~ $ termux-info
Application version:
0.117
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.librehat.com/apt/termux-main/ stable main
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
Updatable packages:
openssh/stable 8.6p1-3 aarch64 [upgradable from: 8.6p1-1]
termux-keyring/stable 2.2 all [upgradable from: 2.0]
Android version:
10
Kernel build information:
Linux localhost 4.14.116 #1 SMP PREEMPT Fri Aug 6 19:16:39 CST 2021 aarch64 Android
Device manufacturer:
HUAWEI
Device model:
SPN-AL00
~ $ 
zxq432 commented 3 years ago

it seems link2symlink support 5 hardlinks of a file at most.

localhost /tmp # date>a1 && for i in `seq 10`;do ln a1 l${i}a1;done; ls -l *1
ln: failed to access 'a1': Too many levels of symbolic links
ln: failed to access 'a1': Too many levels of symbolic links
ln: failed to access 'a1': Too many levels of symbolic links
ln: failed to access 'a1': Too many levels of symbolic links
ln: failed to access 'a1': Too many levels of symbolic links
lrwxrwxrwx 1 root root 110 Sep 19 20:25 a1 -> /.l2s/.l2s..l2s.a10001.00020001
lrwxrwxrwx 1 root root 110 Sep 19 20:25 l1a1 -> /.l2s/.l2s..l2s.a10001.00020001
lrwxrwxrwx 1 root root 126 Sep 19 20:25 l2a1 -> /.l2s/.l2s..l2s..l2s.a10001.00020001.00020001
lrwxrwxrwx 1 root root 138 Sep 19 20:25 l3a1 -> /.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001
lrwxrwxrwx 1 root root 154 Sep 19 20:25 l4a1 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001
-rw-r--r-- 1 root root  29 Sep 19 20:25 l5a1

localhost /.l2s # ls -alt .l2s.*a1000*
lrwxrwxrwx 1 root root 158 Sep 19 20:25 .l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0002
lrwxrwxrwx 1 root root 158 Sep 19 20:25 .l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0002
lrwxrwxrwx 1 root root 154 Sep 19 20:25 .l2s..l2s..l2s.a10001.00020001.00020001.0002 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001
lrwxrwxrwx 1 root root 142 Sep 19 20:25 .l2s..l2s..l2s.a10001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.0002
lrwxrwxrwx 1 root root 138 Sep 19 20:25 .l2s..l2s.a10001.00020001.0002 -> /.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001
lrwxrwxrwx 1 root root 130 Sep 19 20:25 .l2s..l2s.a10001.00020001 -> /.l2s/.l2s..l2s..l2s.a10001.00020001.00020001.0002
lrwxrwxrwx 1 root root 126 Sep 19 20:25 .l2s.a10001.0002 -> /.l2s/.l2s..l2s..l2s.a10001.00020001.00020001
lrwxrwxrwx 1 root root 114 Sep 19 20:25 .l2s.a10001 -> /.l2s/.l2s..l2s.a10001.00020001.0002
-rw-r--r-- 1 root root  29 Sep 19 20:25 .l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0002
-rw-r--r-- 1 root root  29 Sep 19 20:25 .l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.0002

localhost /.l2s #rm /tmp/*a1 && ls -alt .l2s.*a1000*
lrwxrwxrwx 1 root root 158 Sep 19 21:02 .l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0001
lrwxrwxrwx 1 root root 158 Sep 19 21:02 .l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0001
lrwxrwxrwx 1 root root 142 Sep 19 21:02 .l2s..l2s..l2s.a10001.00020001.00020001 -> /.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.0001
lrwxrwxrwx 1 root root 130 Sep 19 21:02 .l2s..l2s.a10001.00020001 -> /.l2s/.l2s..l2s..l2s.a10001.00020001.00020001.0001
lrwxrwxrwx 1 root root 154 Sep 19 20:25 .l2s..l2s..l2s.a10001.00020001.00020001.0001 -> /.l2s/.l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001
lrwxrwxrwx 1 root root 138 Sep 19 20:25 .l2s..l2s.a10001.00020001.0001 -> /.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001
-rw-r--r-- 1 root root  29 Sep 19 20:25 .l2s..l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.00020001.0001
-rw-r--r-- 1 root root  29 Sep 19 20:25 .l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.0001
localhost /.l2s # 
michalbednarski commented 3 years ago

emerge -va git worked fine for me

What you're showing in second post is clearly unexpected behavior, as after creation link2symlink symlinks should be shown as normal files

localhost /tmp # date>a1 && for i in `seq 10`;do ln a1 l${i}a1;done; ls -l *1
-rw-r--r-- 1 root root 29 Sep 19 15:27 a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l10a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l1a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l2a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l3a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l4a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l5a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l6a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l7a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l8a1
-rw-r--r-- 1 root root 29 Sep 19 15:27 l9a1

And all of them should be pointing to same file (example below is from running outside proot):

.../gentoo/tmp $ pwd
/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp
.../gentoo/tmp $ ls -la
total 52
drwxrwxrwt  2 u0_a232 u0_a232 4096 Sep 19 17:27 .
drwxr-xr-x 22 u0_a232 u0_a232 4096 Sep 19 17:27 ..
-rw-r--r--  1 u0_a232 u0_a232    0 Aug  5 07:49 .keep
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l10a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l1a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l2a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l3a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l4a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l5a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l6a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l7a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l8a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001
lrwxrwxrwx  1 u0_a232 u0_a232   93 Sep 19 17:27 l9a1 -> /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001

Anyway, it appears to be device (or configuration) specific, as I haven't reproduced it here.

Does this behaviour happen if ln is used only once/twice? (There never should be files with ".l2s..l2s." double prefix created)

Does it happen when just running in proot --link2symlink bash (without specifying chroot)?

Does creating hardlinks works when you're outside proot?

zxq432 commented 3 years ago

it seems the problems is introduced by a running of stage4.

just after gentoo distro stage3 installed whithout massive package rebuild for stage4, link2symlink works fine. git was not in the distro stage3, and it could be emerged successfully for the first time running of emerge. for a try of stage4, 2 workaround need to be done at first:

  1. patch: https://github.com/termux/proot/issues/182
  2. scanelf: https://github.com/termux/proot/issues/187

after a running of stage4, all packages installed were re-emerged with a few failed packages. the git was among the few failed packages, and the ln command not work as expected, addtion of one more link will not increase the counting number, but increase the link hops. it seems after re-emerge some packages, maybe for the rebuilt glibc or coreutils or others, the behavior of link2symlink was changed in the gentoo distro.

"grep termux /var/db/pkg///CONTENTS" revealed only the openrc package installed some files into folder under the termux $PREFIX folder. with PREFIX commented out in /etc/profile.d/termux-proot.sh, the leaked files were get rid of after re-emerge of openrc and a few more failed packages emerged successfully, left perl and git to be the last 2 packages still failed emerge. perl failed in configure phase,

Which of these apply, if any? [linux-android]  
./hints/linux-android.sh: line 317: getprop: command not found
......
What is your architecture name [aarch64-linux-android]  
Add the Perl API version to your archname? [n]  
This architecture is naturally 64-bit, not changing architecture name.
Pathname where the public executables will reside? (~name ok) [/usr/bin]  
Use relocatable @INC? [y]  
Pathname where the private library files will reside? (~name ok) [.../../lib/perl5/5.34.0]  
Where do you want to put the public architecture-dependent libraries? (~name ok)
[.../../lib/perl5/5.34.0/aarch64-linux-android]  
......
Cannot build with both -Duserelocatableinc and -Duseshrplib
See INSTALL for an explanation why that won't work.
+ die 'Unable to configure'
+ [[ -n '' ]]
+ set +x
 * ERROR: dev-lang/perl-5.34.0-r2::gentoo failed (configure phase):

maybe it should be linux instead of linux-andriod, which introduced "Use relocatable @INC? [y]" and -Duserelocatableinc

install another new distro of gentoo, the link2symlink works fine.

zxq432 commented 3 years ago

the attached is a script log with PROOT_VERBOSE=9 for

for i in `seq 7`;do ln a1 l${i}a1;done

v9script.log

root@gentoo:/tmp# grep -E '"a1"|/a1|l[0-9]a1|l2s.a1' v9script.log
proot info: vpid 4: translate("/tmp" + "a1")
proot info: vpid 4:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/a1"
proot info: vpid 4: translate("/tmp" + "l1a1")
proot info: vpid 4:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/l1a1"
proot info: vpid 5: translate("/tmp" + "a1")
proot info: vpid 5:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s.a10001.0002"
proot info: vpid 5: translate("/tmp" + "l2a1")
proot info: vpid 5:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/l2a1"
proot info: vpid 6: translate("/tmp" + "a1")
proot info: vpid 6:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s..l2s.a10001.00020001.0002"
proot info: vpid 6: translate("/tmp" + "l3a1")
proot info: vpid 6:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/l3a1"
proot info: vpid 7: translate("/tmp" + "a1")
proot info: vpid 7:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s..l2s..l2s.a10001.00020001.00020001.0002"
proot info: vpid 7: translate("/tmp" + "l4a1")
proot info: vpid 7:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/l4a1"
proot info: vpid 8: translate("/tmp" + "a1")
proot info: vpid 8:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/.l2s/.l2s..l2s..l2s..l2s.a10001.00020001.00020001.00020001.0002"
proot info: vpid 8: translate("/tmp" + "l5a1")
proot info: vpid 8:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gentoo/tmp/l5a1"
proot info: vpid 9: translate("/tmp" + "a1")
proot info: vpid 9: translate("/tmp" + "a1")
proot info: vpid 10: translate("/tmp" + "a1")
proot info: vpid 10: translate("/tmp" + "a1")
root@gentoo:/tmp#

log for the same script run in stage3 distro gentoo v9script_ok.log

root@gentoo:/tmp# grep -E '"a1"|/a1|l[0-9]a1|l2s.a1' v9script_ok.log
proot info: vpid 5: translate("/tmp" + "a1")
proot info: vpid 5:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 5: translate("/tmp" + "l1a1")
proot info: vpid 5:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l1a1"
proot info: vpid 6: translate("/tmp" + "a1")
proot info: vpid 6:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 6: translate("/tmp" + "l2a1")
proot info: vpid 6:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l2a1"
proot info: vpid 7: translate("/tmp" + "a1")
proot info: vpid 7:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 7: translate("/tmp" + "l3a1")
proot info: vpid 7:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l3a1"
proot info: vpid 8: translate("/tmp" + "a1")
proot info: vpid 8:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 8: translate("/tmp" + "l4a1")
proot info: vpid 8:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l4a1"
proot info: vpid 9: translate("/tmp" + "a1")
proot info: vpid 9:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 9: translate("/tmp" + "l5a1")
proot info: vpid 9:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l5a1"
proot info: vpid 10: translate("/tmp" + "a1")
proot info: vpid 10:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 10: translate("/tmp" + "l6a1")
proot info: vpid 10:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l6a1"
proot info: vpid 11: translate("/tmp" + "a1")
proot info: vpid 11:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/a1"
proot info: vpid 11: translate("/tmp" + "l7a1")
proot info: vpid 11:          -> "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/gp/tmp/l7a1"
root@gentoo:/tmp#

it seems the translate() fuction has some difference.

zxq432 commented 3 years ago

the problem could be resolved by using --isolated for login distro. and comment out /etc/profile.d/termux-proot.sh