diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2011-02-22 11:30:07 -0800 | 
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-02-22 11:30:07 -0800 | 
| commit | ae0d725005539d9259efac6a81ff8fdd45eb69a6 (patch) | |
| tree | c721b530409b355281537abc7b058bdb2697ee01 /src | |
| parent | 8d40723d1e9661840a67ca7be9c5b073526ab421 (diff) | |
| download | emacs-ae0d725005539d9259efac6a81ff8fdd45eb69a6.tar.gz | |
[ChangeLog]
Work around some portability problems with symlinks.
* Makefile.in (GNULIB_MODULES): Add lstat, readlink, symlink.
* configure.in (lstat, HAVE_LSTAT): Remove special hack.
* lib/lstat.c, lib/readlink.c, lib/stat.c, lib/symlink.c:
* m4/dos.m4, m4/lstat.m4, m4/readlink.m4, m4/stat.m4, m4/symlink.m4:
New files, automatically generated from gnulib.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk:
* lib/stdlib.in.h, m4/gl-comp.m4, m4/stdlib_h.m4: Regenerate.
2011-02-22  Paul Eggert  <eggert@cs.ucla.edu>
[src/ChangeLog]
Work around some portability problems with symlinks.
* fileio.c (Frename_file, Fmake_symbolic_link, Ffile_symlink_p):
Simplify the code by assuming that the readlink and symlink calls
exist, even if they always fail on this host.
(Ffile_readable_p): Likewise, for fifos.
* config.in: Regenerate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/config.in | 40 | ||||
| -rw-r--r-- | src/fileio.c | 35 | 
3 files changed, 54 insertions, 28 deletions
| diff --git a/src/ChangeLog b/src/ChangeLog index 8befb78f91f..6673a25f74f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@  2011-02-22  Paul Eggert  <eggert@cs.ucla.edu> +	Work around some portability problems with symlinks. +	* fileio.c (Frename_file, Fmake_symbolic_link, Ffile_symlink_p): +	Simplify the code by assuming that the readlink and symlink calls +	exist, even if they always fail on this host. +	(Ffile_readable_p): Likewise, for fifos. +	* config.in: Regenerate. +  	* dired.c (Ffile_attributes): Simplify and avoid #ifdef.  2011-02-22  Wolfgang Jenkner  <wjenkner@inode.at>  (tiny change) diff --git a/src/config.in b/src/config.in index ded8c6b292a..2a2a71659f5 100644 --- a/src/config.in +++ b/src/config.in @@ -72,6 +72,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */  /* Enable expensive run-time checking of data types? */  #undef ENABLE_CHECKING +/* Define on systems for which file names may have a so-called `drive letter' +   prefix, define this to compute the length of that prefix, including the +   colon. */ +#undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX + +/* Define if the backslash character may also serve as a file name component +   separator. */ +#undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR + +/* Define if a drive letter prefix denotes a relative path if it is not +   followed by a file name component separator. */ +#undef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +  /* Define this to check for errors in cons list. */  #undef GC_CHECK_CONS_LIST @@ -576,6 +589,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */  /* Define to 1 if you have the `random' function. */  #undef HAVE_RANDOM +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK +  /* Define to 1 if you have the `recvfrom' function. */  #undef HAVE_RECVFROM @@ -696,6 +712,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */  /* Define if struct stat has an st_dm_mode member. */  #undef HAVE_ST_DM_MODE +/* Define to 1 if you have the `symlink' function. */ +#undef HAVE_SYMLINK +  /* Define to 1 if you have the `sync' function. */  #undef HAVE_SYNC @@ -888,6 +907,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */  /* Define to support using a Hesiod database to find the POP server. */  #undef HESIOD +#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define ISSLASH(C) ((C) == '/') +#endif +  /* Define to support Kerberos-authenticated POP mail retrieval. */  #undef KERBEROS @@ -897,6 +922,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */  /* Define to 1 if localtime caches TZ. */  #undef LOCALTIME_CACHE +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing +   slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK +  /* String giving fallback POP mail host. */  #undef MAILHOST @@ -968,10 +997,21 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */     'ptrdiff_t'. */  #undef PTRDIFF_T_SUFFIX +/* Define to 1 if readlink fails to recognize a trailing slash. */ +#undef READLINK_TRAILING_SLASH_BUG +  /* Define REL_ALLOC if you want to use the relocating allocator for buffer     space. */  #undef REL_ALLOC +/* Define to 1 if stat needs help when passed a directory name with a trailing +   slash */ +#undef REPLACE_FUNC_STAT_DIR + +/* Define to 1 if stat needs help when passed a file name with a trailing +   slash */ +#undef REPLACE_FUNC_STAT_FILE +  /* Define as the return type of signal handlers (`int' or `void'). */  #undef RETSIGTYPE diff --git a/src/fileio.c b/src/fileio.c index 0225e0bf3a9..26006d63052 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2178,14 +2178,11 @@ This is what happens in interactive use with M-x.  */)        if (errno == EXDEV)  	{            int count; -#ifdef S_IFLNK            symlink_target = Ffile_symlink_p (file);            if (! NILP (symlink_target))              Fmake_symbolic_link (symlink_target, newname,                                   NILP (ok_if_already_exists) ? Qnil : Qt); -          else -#endif -	  if (!NILP (Ffile_directory_p (file))) +	  else if (!NILP (Ffile_directory_p (file)))  	    call4 (Qcopy_directory, file, newname, Qt, Qnil);  	  else  	    /* We have already prompted if it was an integer, so don't @@ -2197,11 +2194,7 @@ This is what happens in interactive use with M-x.  */)  	  count = SPECPDL_INDEX ();  	  specbind (Qdelete_by_moving_to_trash, Qnil); -	  if (!NILP (Ffile_directory_p (file)) -#ifdef S_IFLNK -	      && NILP (symlink_target) -#endif -	      ) +	  if (!NILP (Ffile_directory_p (file)) && NILP (symlink_target))  	    call2 (Qdelete_directory, file, Qt);  	  else  	    Fdelete_file (file, Qnil); @@ -2311,7 +2304,6 @@ This happens for interactive use with M-x.  */)      RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename,  			   linkname, ok_if_already_exists)); -#ifdef S_IFLNK    encoded_filename = ENCODE_FILE (filename);    encoded_linkname = ENCODE_FILE (linkname); @@ -2338,12 +2330,6 @@ This happens for interactive use with M-x.  */)      }    UNGCPRO;    return Qnil; - -#else -  UNGCPRO; -  xsignal1 (Qfile_error, build_string ("Symbolic links are not supported")); - -#endif /* S_IFLNK */  } @@ -2482,7 +2468,7 @@ See also `file-exists-p' and `file-attributes'.  */)    return Qnil;  #else /* not DOS_NT and not macintosh */    flags = O_RDONLY; -#if defined (S_IFIFO) && defined (O_NONBLOCK) +#ifdef O_NONBLOCK    /* Opening a fifo without O_NONBLOCK can wait.       We don't want to wait.  But we don't want to mess wth O_NONBLOCK       except in the case of a fifo, on a system which handles it.  */ @@ -2584,6 +2570,10 @@ points to a nonexistent file.  */)    (Lisp_Object filename)  {    Lisp_Object handler; +  char *buf; +  int bufsize; +  int valsize; +  Lisp_Object val;    CHECK_STRING (filename);    filename = Fexpand_file_name (filename, Qnil); @@ -2594,13 +2584,6 @@ points to a nonexistent file.  */)    if (!NILP (handler))      return call2 (handler, Qfile_symlink_p, filename); -#ifdef S_IFLNK -  { -  char *buf; -  int bufsize; -  int valsize; -  Lisp_Object val; -    filename = ENCODE_FILE (filename);    bufsize = 50; @@ -2635,10 +2618,6 @@ points to a nonexistent file.  */)    xfree (buf);    val = DECODE_FILE (val);    return val; -  } -#else /* not S_IFLNK */ -  return Qnil; -#endif /* not S_IFLNK */  }  DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0, | 
