Re: [Regression] Editting stale symlink removes symlink and creates file symlink points to
- From: "Andrew V. Samoilov" <sav bcs zp ua>
- To: Pavel Roskin <proski gnu org>
- Cc: GNU Midnight Commander Development team <mc-devel gnome org>
- Subject: Re: [Regression] Editting stale symlink removes symlink and creates file symlink points to
- Date: Wed, 11 Dec 2002 11:46:13 +0200
Pavel Roskin wrote:
Max Derzhak <max /at/linux.zp.ua> reported new regression in mcedit. If
you type F4 on stale symlink and press Esc-Esc or F10 after it (no
editting at all) mcedit creates empty file symlink points to and removes
The problem is not related to VFS, so I'll talk in terms on libc
stat() fails, the file is opened with O_CREAT, creating the link target.
If the file has not been modified, it's removed. open() resolves
symlinks, unlink() doesn't, hence the result.
I think that editing stale symlinks is insane. If stat() fails, then we
expect to create a new file. That's what O_EXCL is for. I'm applying a
patch that uses O_EXCL whenever stat() fails. Editing stale symlinks is
now impossible. I think it's reasonable.
I realize that O_EXCL may not be implemented in every VFS, but it's a
separate problem. Actually, direntry.c knows this flag, so only
filesystems with its own open() need to be changed.
Fine and elegant solution!
Thanks a lot!
Andrew V. Samoilov
] [Thread Prev