| Summary: | pseudo prevents using /dev/fd/* | ||
|---|---|---|---|
| Product: | [Yocto Project Subprojects] Pseudo | Reporter: | Sam Liddicott <sam> |
| Component: | pseudo | Assignee: | Seebs <seebs> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | major | ||
| Priority: | Medium+ | CC: | randy.macleod, yp.pseudo.watcher, yp.watcher |
| Version: | master | ||
| Target Milestone: | 2.8 M4 | ||
| Hardware: | x86 | ||
| OS: | x86_64 | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
NOTE: it is pipe and socket fd's that fail to open under linux because they appear to be dangling symlinks, but the kernel successfully opens them anyway Seebs, should this work under pseudo? |
pseudo insists on dereferencing /proc/*/fd/* filenames which means that /dev/fd/62 or /proc/$$/fd/62 or /proc/self/fd/62 don't work. This means the pseudo environment can break any program or script that depends on /dev/fd/* working I think the easiest fix is to attempt to open the last symlink where lstat worked, not the one where it doesn't work. This example works under normal system or with fakeroot, but fails under pseudo: bash -c 'cat <( echo hello )' strace shows what is going on: bash -c 'strace -f cat <( echo hello )' without pseudo (or even just using fakeroot), it's as simple as: openat(AT_FDCWD, "/dev/fd/63", O_RDONLY) = 3 but with pseudo we get this link de-referencing and failure: lstat("/dev", {st_mode=S_IFDIR|0755, st_size=4040, ...}) = 0 lstat("/dev/fd", {st_mode=S_IFLNK|0777, st_size=13, ...}) = 0 rt_sigprocmask(SIG_BLOCK, [HUP USR1 USR2 ALRM TERM CHLD], [HUP USR1 USR2 ALRM TERM CHLD], 8) = 0 readlink("/dev/fd", "/proc/self/fd", 4096) = 13 rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0 lstat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0 lstat("/proc/self", {st_mode=S_IFLNK|0777, st_size=0, ...}) = 0 rt_sigprocmask(SIG_BLOCK, [HUP USR1 USR2 ALRM TERM CHLD], [HUP USR1 USR2 ALRM TERM CHLD], 8) = 0 readlink("/proc/self", "6724", 4096) = 4 rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0 lstat("/proc/6724", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0 lstat("/proc/6724/fd", {st_mode=S_IFDIR|0500, st_size=0, ...}) = 0 lstat("/proc/6724/fd/63", {st_mode=S_IFLNK|0500, st_size=64, ...}) = 0 rt_sigprocmask(SIG_BLOCK, [HUP USR1 USR2 ALRM TERM CHLD], [HUP USR1 USR2 ALRM TERM CHLD], 8) = 0 readlink("/proc/6724/fd/63", "pipe:[21346885]", 4096) = 15 rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0 lstat("/proc/6724/fd/pipe:[21346885]", 0x7ffe0f16e040) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/proc/6724/fd/pipe:[21346885]", 0x7ffe0f16e080, 0) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/proc/6724/fd/pipe:[21346885]", O_RDONLY) = -1 ENOENT (No such file or directory)