Skip to content

Commit 56ac737

Browse files
asmacdoclaude
andauthored
Fix writable check for NFS/ACL filesystems (#348)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d945730 commit 56ac737

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

babs/bootstrap.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import os.path as op
55
import subprocess
6+
import tempfile
67
from pathlib import Path
78

89
import datalad.api as dlapi
@@ -77,8 +78,11 @@ def babs_bootstrap(
7778
f"The parent folder '{parent_dir}' does not exist! `babs init` won't proceed."
7879
)
7980

80-
# check if parent directory is writable:
81-
if not os.access(parent_dir, os.W_OK):
81+
# check if parent directory is writable (os.access unreliable on NFS/ACL):
82+
try:
83+
with tempfile.TemporaryFile(dir=parent_dir):
84+
pass
85+
except OSError:
8286
raise ValueError(
8387
f"The parent folder '{parent_dir}' is not writable! `babs init` won't proceed."
8488
)

0 commit comments

Comments
 (0)