Open jtyler76 opened 4 days ago
On 11/25/24 14:09, jtyler76 wrote:
The
mode
bits passed toopenat()
in the aforementioned line should be filtered down to only the file permission bits as listed on the<sys/stat.h>
page of the POSIX spec.
What use case broke on which system?
In
cp
, the newly created object (the copy) is created using the mode bits of the source object (https://github.com/landley/toybox/blob/fb3ca98e2faaa11512061cdd3fc946ddf0c2696b/toys/posix/cp.c#L296). The issue is that themode
of the source object may have bits set that are not file permission bits, and POSIX states that the effect of setting such bits inopen()
/openat()
is unspecified (see the POSIX spec page foropen()
/openat()
when it describesO_CREAT
).The
mode
bits passed toopenat()
in the aforementioned line should be filtered down to only the file permission bits as listed on the<sys/stat.h>
page of the POSIX spec.