meson icon indicating copy to clipboard operation
meson copied to clipboard

Skip symlinks in _make_tree_writable()

Open DaanDeMeyer opened this issue 11 months ago • 1 comments

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().

DaanDeMeyer avatar Feb 06 '25 11:02 DaanDeMeyer

@dcbaker @bonzini Any chance you could take a quick look? Trivial fix for a rather annoying issue

DaanDeMeyer avatar Feb 15 '25 20:02 DaanDeMeyer

@bonzini I can press merge if you think this is the right approach (since you've already looked at it more than I have)

dcbaker avatar Feb 28 '25 19:02 dcbaker

Yeah, follow_symlinks=False is not portable.

bonzini avatar Feb 28 '25 19:02 bonzini

This looks pretty safe to backport, too.

eli-schwartz avatar Feb 28 '25 20:02 eli-schwartz