mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-04-10 14:09:29 +00:00
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 <vapier@google.com> Tested-by: Egor Duda <egor.duda@gmail.com> Commit-Queue: Egor Duda <egor.duda@gmail.com>
This commit is contained in:
parent
9ecb80ba26
commit
f070331a4c
@ -156,6 +156,12 @@ def remove(path, missing_ok=False):
|
|||||||
os.rmdir(longpath)
|
os.rmdir(longpath)
|
||||||
else:
|
else:
|
||||||
os.remove(longpath)
|
os.remove(longpath)
|
||||||
|
elif (
|
||||||
|
e.errno == errno.EROFS
|
||||||
|
and missing_ok
|
||||||
|
and not os.path.exists(longpath)
|
||||||
|
):
|
||||||
|
pass
|
||||||
elif missing_ok and e.errno == errno.ENOENT:
|
elif missing_ok and e.errno == errno.ENOENT:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user