summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2025-02-06 12:30:08 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-02-28 11:44:34 -0800
commit9af9c6b5b8fb71be41428a53fab5ec026ae88ee1 (patch)
treea7cd1639b7c0c513f3ba9f7b9cc6777d622e5849
parentf41c0f5436e62108644fdfc4d5768807b499e8a2 (diff)
downloadmeson-9af9c6b5b8fb71be41428a53fab5ec026ae88ee1.tar.gz
Skip symlinks in _make_tree_writable()
Trying to chmod a symlink results in trying to chmod the file or directory it points to, not the symlink itself which has no permissions. Either a symlink points to within the tree we're making writable in which case it'll be handled eventually by os.walk() or it points outside of the tree we're making writable in which case we don't want to touch it. Let's avoid touching files outside of the tree by simply skipping symlinks in _make_tree_writable().
-rw-r--r--mesonbuild/utils/universal.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 538b0bd9f..dda35cc2b 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -1902,7 +1902,7 @@ def _make_tree_writable(topdir: T.Union[str, Path]) -> None:
os.chmod(d, os.stat(d).st_mode | stat.S_IWRITE | stat.S_IREAD)
for fname in files:
fpath = os.path.join(d, fname)
- if os.path.isfile(fpath):
+ if not os.path.islink(fpath) and os.path.isfile(fpath):
os.chmod(fpath, os.stat(fpath).st_mode | stat.S_IWRITE | stat.S_IREAD)