Skip to content

Commit 328001e

Browse files
[8.2.x] Fixes crashing under a squashfuse_ll read-only mount (#12302)
Co-authored-by: Yutian Li <[email protected]>
1 parent 8fdb729 commit 328001e

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ Yao Xiao
441441
Yoav Caspi
442442
Yuliang Shao
443443
Yusuke Kadowaki
444+
Yutian Li
444445
Yuval Shimon
445446
Zac Hatfield-Dodds
446447
Zachary Kneupper

changelog/12300.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed handling of 'Function not implemented' error under squashfuse_ll, which is a different way to say that the mountpoint is read-only.

src/_pytest/assertion/rewrite.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,10 @@ def try_makedirs(cache_dir: Path) -> bool:
11711171
return False
11721172
except OSError as e:
11731173
# as of now, EROFS doesn't have an equivalent OSError-subclass
1174-
if e.errno == errno.EROFS:
1174+
#
1175+
# squashfuse_ll returns ENOSYS "OSError: [Errno 38] Function not
1176+
# implemented" for a read-only error
1177+
if e.errno in {errno.EROFS, errno.ENOSYS}:
11751178
return False
11761179
raise
11771180
return True

testing/test_assertrewrite.py

+5
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,11 @@ def fake_mkdir(p, exist_ok=False, *, exc):
19741974
monkeypatch.setattr(os, "makedirs", partial(fake_mkdir, exc=err))
19751975
assert not try_makedirs(p)
19761976

1977+
err = OSError()
1978+
err.errno = errno.ENOSYS
1979+
monkeypatch.setattr(os, "makedirs", partial(fake_mkdir, exc=err))
1980+
assert not try_makedirs(p)
1981+
19771982
# unhandled OSError should raise
19781983
err = OSError()
19791984
err.errno = errno.ECHILD

0 commit comments

Comments
 (0)