Summary
sysopen() on a mocked path dies with "Some of your permissions are not yet supported by Test::MockFile" whenever O_NONBLOCK (0x800) is part of the mode. O_NONBLOCK is not listed in SUPPORTED_SYSOPEN_MODES, and the mode-validation check confesses on any bit outside that whitelist.
Reproduction
use Fcntl;
use Test::MockFile qw< nostrict >;
my $dir = Test::MockFile->new_dir('/home/bob', { autovivify => 1 });
# Works (0xc1):
sysopen(my $ok, '/home/bob/a', O_WRONLY | O_CREAT | O_EXCL, 0600) or die "sysopen: $!";
# Dies (0x8c1):
# Sorry, can't open /home/bob/b with 0x8c1 permissions.
# Some of your permissions are not yet supported by Test::MockFile
sysopen(my $no, '/home/bob/b', O_WRONLY | O_CREAT | O_EXCL | O_NONBLOCK, 0600);
Cause
use constant SUPPORTED_SYSOPEN_MODES =>
O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_TRUNC | O_EXCL | O_CREAT | O_NOFOLLOW;
...
if ( ( $sysopen_mode & SUPPORTED_SYSOPEN_MODES ) != $sysopen_mode ) {
confess( ... "Some of your permissions are not yet supported ..." );
}
O_NONBLOCK is absent from the whitelist, so any sysopen including it is fatal.
Impact
O_NONBLOCK is routinely OR'd into open flags for lock files and other guarded opens — it prevents blocking on FIFOs/devices and is harmless on regular files. For an in-memory mock it has no meaningful effect and can be safely accepted (and ignored). Today, any code under test that opens files with O_NONBLOCK cannot be exercised against mocked paths.
Suggested fix
Add O_NONBLOCK to SUPPORTED_SYSOPEN_MODES (accept-and-ignore). The same reasoning likely applies to O_CLOEXEC and O_NOCTTY, which are similarly benign for mocked files.
Summary
sysopen()on a mocked path dies with "Some of your permissions are not yet supported by Test::MockFile" wheneverO_NONBLOCK(0x800) is part of the mode.O_NONBLOCKis not listed inSUPPORTED_SYSOPEN_MODES, and the mode-validation checkconfesses on any bit outside that whitelist.Reproduction
Cause
O_NONBLOCKis absent from the whitelist, so anysysopenincluding it is fatal.Impact
O_NONBLOCKis routinely OR'd into open flags for lock files and other guarded opens — it prevents blocking on FIFOs/devices and is harmless on regular files. For an in-memory mock it has no meaningful effect and can be safely accepted (and ignored). Today, any code under test that opens files withO_NONBLOCKcannot be exercised against mocked paths.Suggested fix
Add
O_NONBLOCKtoSUPPORTED_SYSOPEN_MODES(accept-and-ignore). The same reasoning likely applies toO_CLOEXECandO_NOCTTY, which are similarly benign for mocked files.