<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13483</bug_id>
          
          <creation_ts>2019-08-14 20:46:04 +0000</creation_ts>
          <short_desc>pseudo prevents using /dev/fd/*</short_desc>
          <delta_ts>2019-08-15 15:44:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Pseudo</product>
          <component>pseudo</component>
          <version>master</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>13288</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>2.8 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sam Liddicott">sam</reporter>
          <assigned_to name="Seebs">seebs</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>yp.pseudo.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84667</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Liddicott">sam</who>
    <bug_when>2019-08-14 20:46:04 +0000</bug_when>
    <thetext>pseudo insists on dereferencing /proc/*/fd/* filenames which means that /dev/fd/62 or /proc/$$/fd/62 or /proc/self/fd/62 don&apos;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&apos;t work.

This example works under normal system or with fakeroot, but fails under pseudo:

bash -c &apos;cat &lt;( echo hello )&apos;

strace shows what is going on:

bash -c &apos;strace -f cat &lt;( echo hello )&apos;

without pseudo (or even just using fakeroot), it&apos;s as simple as:

openat(AT_FDCWD, &quot;/dev/fd/63&quot;, O_RDONLY) = 3


but with pseudo we get this link de-referencing and failure:


lstat(&quot;/dev&quot;, {st_mode=S_IFDIR|0755, st_size=4040, ...}) = 0

lstat(&quot;/dev/fd&quot;, {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(&quot;/dev/fd&quot;, &quot;/proc/self/fd&quot;, 4096) = 13

rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0

lstat(&quot;/proc&quot;, {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0

lstat(&quot;/proc/self&quot;, {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(&quot;/proc/self&quot;, &quot;6724&quot;, 4096)    = 4

rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0

lstat(&quot;/proc/6724&quot;, {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0

lstat(&quot;/proc/6724/fd&quot;, {st_mode=S_IFDIR|0500, st_size=0, ...}) = 0

lstat(&quot;/proc/6724/fd/63&quot;, {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(&quot;/proc/6724/fd/63&quot;, &quot;pipe:[21346885]&quot;, 4096) = 15

rt_sigprocmask(SIG_SETMASK, [HUP USR1 USR2 ALRM TERM CHLD], NULL, 8) = 0

lstat(&quot;/proc/6724/fd/pipe:[21346885]&quot;, 0x7ffe0f16e040) = -1 ENOENT (No such file or directory)

newfstatat(AT_FDCWD, &quot;/proc/6724/fd/pipe:[21346885]&quot;, 0x7ffe0f16e080, 0) = -1 ENOENT (No such file or directory)

openat(AT_FDCWD, &quot;/proc/6724/fd/pipe:[21346885]&quot;, O_RDONLY) = -1 ENOENT (No such file or directory)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84668</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Liddicott">sam</who>
    <bug_when>2019-08-15 05:28:10 +0000</bug_when>
    <thetext>NOTE: it is pipe and socket fd&apos;s that fail to open under linux because they appear to be dangling symlinks, but the kernel successfully opens them anyway</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84672</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-15 14:49:28 +0000</bug_when>
    <thetext>Seebs, should this work under pseudo?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84687</commentid>
    <comment_count>3</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2019-08-15 15:44:20 +0000</bug_when>
    <thetext>This looks to be the same underlying issue as 13288.

*** This bug has been marked as a duplicate of bug 13288 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>