Skip to content

Commit f070331

Browse files
egor-dudaLUCI
authored and
LUCI
committed
Fix EROFS error when root fs is mounted read-only
repo attempts to create /etc/.repo_gitconfig.json file, and fails if root file system is mounted read-only. Removing non-existing file on read-only filesystem results in EROFS instead of ENOENT. Bug: 401018409 Change-Id: I64edc0567fb88649f3fd8cacb65a8780744640d4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/458821 Reviewed-by: Mike Frysinger <[email protected]> Tested-by: Egor Duda <[email protected]> Commit-Queue: Egor Duda <[email protected]>
1 parent 9ecb80b commit f070331

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: platform_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ def remove(path, missing_ok=False):
156156
os.rmdir(longpath)
157157
else:
158158
os.remove(longpath)
159+
elif (
160+
e.errno == errno.EROFS
161+
and missing_ok
162+
and not os.path.exists(longpath)
163+
):
164+
pass
159165
elif missing_ok and e.errno == errno.ENOENT:
160166
pass
161167
else:

0 commit comments

Comments
 (0)