Mercurial > hg > xemacs-beta
changeset 4972:c448f4c38d65
change name of lock file to avoid problems with etags, byte-recompile-directory, etc.
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-04 Ben Wing <ben@xemacs.org>
* filelock.c:
* filelock.c (fill_in_lock_file_name):
Name the lock symlink file .#FN# instead of .#FN for file FN, so
that the link file doesn't have a .c or .el or whatever extension,
which confuses programs/functions that search by extension (e.g.
etags, byte-recompile-directory, etc.).
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 04 Feb 2010 05:58:40 -0600 |
parents | bcdf496e49d0 |
children | 3bf1b0f0c391 16112448d484 4aebb0131297 |
files | src/ChangeLog src/filelock.c |
diffstat | 2 files changed, 28 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Thu Feb 04 05:55:25 2010 -0600 +++ b/src/ChangeLog Thu Feb 04 05:58:40 2010 -0600 @@ -1,3 +1,12 @@ +2010-02-04 Ben Wing <ben@xemacs.org> + + * filelock.c: + * filelock.c (fill_in_lock_file_name): + Name the lock symlink file .#FN# instead of .#FN for file FN, so + that the link file doesn't have a .c or .el or whatever extension, + which confuses programs/functions that search by extension (e.g. + etags, byte-recompile-directory, etc.). + 2010-02-04 Ben Wing <ben@xemacs.org> * symbols.c (defsymbol_massage_name_1):
--- a/src/filelock.c Thu Feb 04 05:55:25 2010 -0600 +++ b/src/filelock.c Thu Feb 04 05:58:40 2010 -0600 @@ -1,5 +1,5 @@ /* Copyright (C) 1985, 86, 87, 93, 94, 96 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2010 Ben Wing. This file is part of XEmacs. @@ -38,7 +38,7 @@ #ifdef CLASH_DETECTION -/* The strategy: to lock a file FN, create a symlink .#FN in FN's +/* The strategy: to lock a file FN, create a symlink .#FN# in FN's directory, with link data `user@host.pid'. This avoids a single mount (== failure) point for lock files. @@ -67,12 +67,18 @@ file names, because those are all the same systems that don't have symlinks. - This is compatible with the locking scheme used by Interleaf (which - has contributed this implementation for Emacs), and was designed by - Ethan Jacobson, Kimbo Mundy, and others. + Originally we used a name .#FN without the final #; this may have been + compatible with the locking scheme used by Interleaf (which has + contributed this implementation for Emacs), and was designed by Ethan + Jacobson, Kimbo Mundy, and others. --karl@cs.umb.edu/karl@hq.ileaf.com. */ +/* NOTE: We added the final # in the name .#FN# so that programs + that e.g. search for all .c files, such as etags, or try to + byte-compile all .el files in a directory (byte-recompile-directory), + won't get tripped up by the bogus symlink file. --ben */ + /* Here is the structure that stores information about a lock. */ @@ -93,10 +99,11 @@ xfree ((i).host, Ibyte *); \ } while (0) -/* Write the name of the lock file for FN into LFNAME. Length will be - that of FN plus two more for the leading `.#' plus one for the null. */ +/* Write the name of the lock file for FN into LFNAME. Length will be that + of FN plus two more for the leading `.#' plus one for the trailing # + plus one for the null. */ #define MAKE_LOCK_NAME(lock, file) \ - (lock = alloca_ibytes (XSTRING_LENGTH (file) + 2 + 1), \ + (lock = alloca_ibytes (XSTRING_LENGTH (file) + 2 + 1 + 1), \ fill_in_lock_file_name (lock, file)) static void @@ -116,7 +123,10 @@ p = lockfile + dirlen; *(p++) = '.'; *(p++) = '#'; - memcpy (p, file_name + dirlen, XSTRING_LENGTH (fn) - dirlen + 1); + memcpy (p, file_name + dirlen, XSTRING_LENGTH (fn) - dirlen); + p += XSTRING_LENGTH (fn) - dirlen; + *(p++) = '#'; + *p = '\0'; } /* Lock the lock file named LFNAME.