You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mv: decide overwrite prompts by effective write access - #15282
mv checked the owner write bit instead of write access, so root was prompted
before overwriting a 0555 file, and a symlink to an unwritable file drew a
spurious prompt.
is_writable now uses accessat with AT_EACCESS and treats symlink destinations as
writable, and the prompt wording comes from that same check. Tests cover both.
@anastygnome Symlinks: is_writable still resolves the link and accessat follows it, so a symlink to an unwritable file still draws a spurious prompt; that case reproduces as a plain user. Wording: get_interactive_prompt still keys off 0o200, so the prompt text can disagree with the prompt decision.
❯ mv --version
mv (GNU coreutils) 9.9
Packaged by https://nixos.org
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Parker, David MacKenzie, and Jim Meyering.
❯ cd /tmp && rm -rf repro1 && mkdir repro1 && cd repro1
direnv: unloading
❯ echo OLD > real && chmod 0555 real && ln -s real link && echo NEW > src
❯ printf 'n\n' | script -qec "/tmp/opencode/mv-pr15294 src link" /dev/null
n
mv-pr15294: replace 'link', overriding mode 0555 (r-xr-xr-x)? ⏎ ❯ # but gnu
❯ cd /tmp && rm -rf repro1 && mkdir repro1 && cd repro1
❯ echo OLD > real && chmod 0555 real && ln -s real link && echo NEW > src
❯ script -qec "mv src link"
❯ # no prompt!
❯ cd /tmp && rm -rf repro2 && mkdir repro2 && cd repro2 && echo NEW > src
❯ ls -l /etc/passwd
-rw-r--r-- 1 root root 4658 Oct 13 20:21 /etc/passwd
❯ printf 'n\n' | script -qec "/tmp/opencode/mv-pr15294 src /etc/passwd" /dev/null
n
mv-pr15294: overwrite '/etc/passwd'? ⏎ ❯ # but gnu
❯ script -qec "mv src /etc/passwd"
mv: replace '/etc/passwd', overriding mode 0644 (rw-r--r--)? ^C⏎
❯ # wording is off!
OK, that's a separate issue! I'll focus on the technical aspects
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mv checked the owner write bit instead of write access, so root was prompted
before overwriting a 0555 file, and a symlink to an unwritable file drew a
spurious prompt.
is_writable now uses accessat with AT_EACCESS and treats symlink destinations as
writable, and the prompt wording comes from that same check. Tests cover both.
This failed in NixOS very badly.