summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Duda <egor.duda@gmail.com>2025-03-06 10:14:44 +0300
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-04-02 06:43:06 -0700
commitf070331a4c9993f4eedcc7fcb1c4b4807db69d02 (patch)
tree60123c8fe0aaa302d1bf5b0f35c7fc7ceba5752e
parent9ecb80ba26649e47c1f357c1a6f48c028ce7689b (diff)
downloadgit-repo-f070331a4c9993f4eedcc7fcb1c4b4807db69d02.tar.gz
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>
-rw-r--r--platform_utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform_utils.py b/platform_utils.py
index e20198ee..45ffec78 100644
--- a/platform_utils.py
+++ b/platform_utils.py
@@ -156,6 +156,12 @@ def remove(path, missing_ok=False):
156 os.rmdir(longpath) 156 os.rmdir(longpath)
157 else: 157 else:
158 os.remove(longpath) 158 os.remove(longpath)
159 elif (
160 e.errno == errno.EROFS
161 and missing_ok
162 and not os.path.exists(longpath)
163 ):
164 pass
159 elif missing_ok and e.errno == errno.ENOENT: 165 elif missing_ok and e.errno == errno.ENOENT:
160 pass 166 pass
161 else: 167 else: