Bug 13959

Summary: ACLs: setfacl -m on a directory corrupts UID&GID in pseudo
Product: [Yocto Project Subprojects] Pseudo Reporter: Johannes Beisswenger <johannes.beisswenger>
Component: pseudoAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: johannes.beisswenger, richard.purdie, seebs, yp.pseudo.watcher, yp.watcher
Version: master   
Target Milestone: 3.2 M2   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Pseudo testcase that can be used to reproduce the issue none

Description Johannes Beisswenger 2020-06-26 02:02:13 UTC
Preconditions/Environment
-------------------------
Ubuntu 18.04.4 LTS (Bionic Beaver)
pseudo at commit 060058b
With 0001-pseudo_ipc.h-Fix-enum-typedef.patch from poky(http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=b4e1ce1b93b08c77047508f27915073db6315a8e) applied.

Triggering Action/Cause
-----------------------
Run `pseudo`.
Run `mkdir foobar`.
Run `setfacl -m "u:root:rX" foobar`.

Expectation
-----------
UID/GID of foobar should be 0/root.

`stat foobar`:
  File: foobar/
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
...
Access: (0775/drwxrwxr-x)  Uid: (    0/    root)   Gid: (    0/    root)
...

`getfacl foobar`:
# file: foobar/
# owner: root
# group: root
user::rwx
user:root:r-x
group::rwx
mask::rwx
other::r-x

Actual Result
-------------
UID/GID of foobar is 1001/jbe, the user running pseudo.

`getfacl foobar`:
# file: foobar/
# owner: jbe
# group: jbe
user::rwx
user:root:r-x
group::rwx
mask::rwx
other::r-x

`stat foobar`:
  File: foobar/
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
...
Access: (0755/drwxr-xr-x)  Uid: ( 1001/     jbe)   Gid: ( 1001/     jbe)
...


Reproducibility
---------------
This is 100% reproducible when restarting pseudo in between trials or when using a previously not used directory name.

Note: I have a patch fixing this issue which I will submit to the mailing list.
Comment 1 Johannes Beisswenger 2020-06-26 04:18:20 UTC
Created attachment 4696 [details]
Pseudo testcase that can be used to reproduce the issue

This is the testcase from this PATCH https://lists.openembedded.org/g/openembedded-core/message/140009.
Comment 2 Johannes Beisswenger 2020-06-26 04:22:07 UTC
Fix https://lists.openembedded.org/g/openembedded-core/message/140008
Comment 3 Richard Purdie 2020-06-28 00:40:41 UTC
Thanks, we've merged this into s staging branch and applied to OE-Core.

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=704a245460f1802cb83a1a7200d1bbfb5bc0c33c