Re: [Regression] Editting stale symlink removes symlink and creates file symlink points to
- From: Pavel Roskin <proski gnu org>
- To: "Andrew V. Samoilov" <sav bcs zp ua>
- 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: Sat, 07 Dec 2002 19:59:38 -0500 (EST)
> 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
> original symlink.
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.
] [Thread Prev