diff options
| author | Paul Eggert | 2013-03-02 12:41:53 -0800 |
|---|---|---|
| committer | Paul Eggert | 2013-03-02 12:41:53 -0800 |
| commit | b5029e230d10ea412e4ff1d4867a0c884d130039 (patch) | |
| tree | 98c424b27b043f8289e215d06ec6a09de6c7e2c3 /etc | |
| parent | 06b583dec7cbde714c8fb991a1e123f612b66e3a (diff) | |
| download | emacs-b5029e230d10ea412e4ff1d4867a0c884d130039.tar.gz emacs-b5029e230d10ea412e4ff1d4867a0c884d130039.zip | |
The lock for FILE is now .#FILE or .#-FILE.
The old approach, which fell back on DIR/.#FILE.0 through
DIR/.#FILE.9, had race conditions that could not be easily fixed.
If DIR/.#FILE is a non-symlink file, Emacs now does not create a
lock file for DIR/FILE; that is, DIR/FILE is no longer partly
protected by a lock if DIR/.#FILE is a non-symlink file ("partly"
because the locking mechanism was never reliable in that case).
This patch fixes this and other bugs discovered by a code
inspection that was prompted by
<http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00531.html>.
Also, this patch switches to .#-FILE (not .#FILE) on MS-Windows,
to avoid interoperability problems between the MS-Windows and
non-MS-Windows implementations. MS-Windows and non-MS-Windows
instances of Emacs now ignore each others' locks.
* etc/NEWS: Document this.
* src/filelock.c (defined_WINDOWSNT): New constant.
(MAKE_LOCK_NAME, fill_in_lock_file_name):
Don't create DIR/.#FILE.0 through DIR/.#FILE.9. Instead, create
DIR/.#FILE symlinks on non-MS-Windows hosts, and DIR/.#-FILE
regular files on MS-Windows hosts.
(MAKE_LOCK_NAME, unlock_file, Ffile_locked_p):
Use SAFE_ALLOCA to avoid problems with long file names.
(MAX_LFINFO): Now a local constant, not a global macro.
(IS_LOCK_FILE): Remove.
(lock_file_1): Don't inspect errno if symlink call succeeds;
that's not portable.
(lock_file): Document that this function can return if lock
creation fails.
Fixes: debbugs:13807
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog index a13ab60be36..7ebb2a751ab 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-03-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * NEWS: The lock for FILE is now .#FILE or .#-FILE (Bug#13807). | ||
| 4 | |||
| 1 | 2013-03-01 Michael Albinus <michael.albinus@gmx.de> | 5 | 2013-03-01 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * NEWS: Fix Tramp "adb" entry. Extend list of discontinued Tramp | 7 | * NEWS: Fix Tramp "adb" entry. Extend list of discontinued Tramp |
| @@ -320,6 +320,18 @@ text-property on the first char. | |||
| 320 | ** The `defalias-fset-function' property lets you catch calls to defalias | 320 | ** The `defalias-fset-function' property lets you catch calls to defalias |
| 321 | and redirect them to your own function instead of `fset'. | 321 | and redirect them to your own function instead of `fset'. |
| 322 | 322 | ||
| 323 | ** The lock for 'DIR/FILE' is now 'DIR/.#FILE' or 'DIR/.#-FILE'. | ||
| 324 | When you edit DIR/FILE, Emacs normally creates a symbolic link | ||
| 325 | DIR/.#FILE as a lock that warns other instances of Emacs that DIR/FILE | ||
| 326 | is being edited. Formerly, if there was already a non-symlink file | ||
| 327 | named DIR/.#FILE, Emacs fell back on the lock names DIR/.#FILE.0 | ||
| 328 | through DIR/.#FILE.9. These fallbacks have been removed, so that | ||
| 329 | Emacs now no longer locks DIR/FILE in that case. | ||
| 330 | |||
| 331 | On MS-Windows the lock is a regular file DIR/.#-FILE, not a symlink. | ||
| 332 | MS-Windows and non-MS-Windows implementations of Emacs ignore each | ||
| 333 | other's locks. | ||
| 334 | |||
| 323 | ** The 9th element returned by `file-attributes' is now unspecified. | 335 | ** The 9th element returned by `file-attributes' is now unspecified. |
| 324 | Formerly, it was t if the file's gid would change if file were deleted | 336 | Formerly, it was t if the file's gid would change if file were deleted |
| 325 | and recreated. This value has been inaccurate for years on many | 337 | and recreated. This value has been inaccurate for years on many |