UnixFile.open should be defined as variadic
Categories
(Toolkit Graveyard :: OS.File, defect)
Tracking
(firefox81 fixed)
Tracking | Status | |
---|---|---|
firefox81 | --- | fixed |
People
(Reporter: glandium, Assigned: glandium)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
The definition of the function is variadic like the following on at least Linux and OSX:
int open(const char *, int, ...)
We're lucky that things are lined up in a way where it just works on all our current platforms, but it falls short on Apple Silicon macs because the ABI in that case is that the mode needs to end up on the stack which it doesn't if the function is not defined as variadic on the ctypes side.
Fortunately, variadic functions are supported by ctypes, although that's not documented. See https://bugzilla.mozilla.org/show_bug.cgi?id=554790#c22.
Additional complication, though: ctypes doesn't actually implement variadic functions correctly. Will file a seperate bug for the ctypes side of things.
Assignee | ||
Comment 1•5 years ago
|
||
Oh, I should mention, the result of this problem is that files opened with O_CREAT end up with garbage permissions, and we're lucky if they're readable at all after that.
Assignee | ||
Comment 2•5 years ago
|
||
That is how it is actually defined in fcntl.h, and thus how C code calls
it. It so happens that in many cases, it just works out fine because
variadic arguments end up at the same place as if they weren't variadic
in registers/stack, but that's not actually true on all platforms. Most
notably, that's not true on Apple Silicon.
Comment 5•5 years ago
•
|
||
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=313725726&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/e8d3ae8df154
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•