[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27986: 26.0.50; 'rename-file' can rename files without confirmation
From: |
Paul Eggert |
Subject: |
bug#27986: 26.0.50; 'rename-file' can rename files without confirmation |
Date: |
Mon, 14 Aug 2017 16:03:13 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
Philipp Stephani wrote:
there's no way to special-case
casing changes while keeping atomicity intact. So I'd rather have Emacs
react conservatively and skip the casing check entirely.
Yes, that makes sense, at least for macOS.
Note that the manpage says:
RENAME_EXCL On file systems that support it (see getattrlist(2)
VOL_CAP_INT_RENAME_EXCL), it will cause EEXIST to be returned if the
destination already exists.
I interpret this such that if the filesystem doesn't support RENAME_EXCL
the rename will succeed even if the destination exists.
I interpret it to mean that if the filesystem doesn't support RENAME_EXCL, the
rename will fail with errno == EINVAL or ENOSYS. At least, that's how it works
under GNU/Linux. If it behaved the way you suggest, there'd be no good way to
emulate RENAME_EXCL on filesystems lacking it, which would surely not be Apple's
intent.
Please check this, though. I installed the patch on 'master' to help you do
that.
Now that renameat_noreplace works on DOS_NT, would it make sense to apply the
attached further patch as well? If we can get renameat_noreplace to work on
Cygwin the we could simplify the fileio.c code even further.
Since we probably won't be able to solve all issues across operating
systems and filesystems, probably we should have at least a warning in the
documentation that rename-file attempts to be race-free and atomic, but
only on a best-effort basis.
True. I'd like to get the directory issue fixed before worrying about this,
though. (That way I don't have to document the security holes in the current
implementation. :-) I'll follow up separately about that.
0001-Improve-rename-file-behavior-on-DOS_NT.patch
Description: Text Data
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, (continued)
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Paul Eggert, 2017/08/13
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Eli Zaretskii, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Eli Zaretskii, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Philipp Stephani, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Eli Zaretskii, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Philipp Stephani, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation,
Paul Eggert <=
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Paul Eggert, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Eli Zaretskii, 2017/08/14
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Paul Eggert, 2017/08/15
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Eli Zaretskii, 2017/08/15
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Ken Brown, 2017/08/16
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Ken Brown, 2017/08/19
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Paul Eggert, 2017/08/19
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Ken Brown, 2017/08/19
- bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Paul Eggert, 2017/08/19
bug#27986: 26.0.50; 'rename-file' can rename files without confirmation, Andy Moreton, 2017/08/15