Salut bug team:
file-symlink-p just returns nil without running its handler(s) and
make-symbolic-link doesn't exist at all on systems that don't support
symlinks (ie S_IFLNK is undefined) such as MS Windows. This is probably
a bug in emacs, and exists in XEmacs 21.0 & 21.2, FSF Emacs 19.34 &
20.34 and probably all other recent versions of XEmacs and FSF Emacs.
For reference, I've attached a patch against src/fileio.c in XEmacs
21.2. The patch against FSF Emacs 20.3.4 is identical apart from line
numbers.
In particular, this means that file-symlink-p doesn't run its
efs-file-symlink-p handler and merely returns nil. This leads to
infinite recursion in efs-internal-file-directory-p as the attached
backtrace demonstrates.
To reproduce:
* rebuild emacs with S_IFLNK undefined. Actually its only src/fileio.c
that needs recompiling so this can be done by inserting "#undef
S_IFLNK" after the #includes in src/fileio.c.
* xemacs -vanilla
* C-x C-f /ftp.xemacs.org:/pub
* Hit Return on the "xemacs" symlink.
Suggested ugly workaround for efs:
In efs-chase-symlinks replace the call to file-symlink-p with:
(if (efs-ftp-path file)
(efs-file-symlink-p file)
(file-symlink-p file))
There are calls to file-symlink-p in efs-dired-compress-file and
efs-recover-file that look like they should be replaced with an
explicit call efs-file-symlink-p. (efs-internal-file-truename already
contains an explicit call to efs-file-symlink-p).
--
Jonathan.
Emacs : XEmacs 21.2 "Ares" [Lucid] (i586-pc-win32) of Sat Jan 09 1999 on
MARGINAL
Package: efs
efs believes that the host type of
ftp.xemacs.org is unix.
current state:
==============
(setq
efs-cu-version "1.18/1.12"
efs-defun-version "1.18/1.1"
efs-dired-version "1.18/1.32"
efs-dump-version "1.18/1.2"
efs-fnh-version "1.18/1.4"
efs-netrc-version "1.18/1.2"
efs-ovwrt-version "1.18/1.3"
efs-report-version "1.18/1.10"
efs-version "1.18/1.57"
efs-x19.15-version "1.18/1.2"
efs-36-bit-binary-file-name-regexp nil
efs-anonymous-umask nil
efs-auto-save 0
efs-auto-save-remotely nil
efs-backup-by-copying nil
efs-binary-file-host-regexp nil
efs-binary-file-name-regexp
"\\.\\([zZ]\\|t?gz\\|lzh\\|arc\\|zip\\|zoo\\|ta[rz]\\|dvi\\|sit\\|ps\\|elc\\|gif\\|Z-part-..\\|tpz\\|exe\\|[jm]pg\\|TZ[a-z]?\\|lib\\)\\(~\\|~[0-9]+~\\)?$\\|\\.\\(ARC\\|ELC\\|TAGS\\|EXE\\|ZIP\\|DVI|ZOO\\|GIF\\|T?GZ\\|[JM]PG\\)\\([.#;][0-9]+\\)?$"
efs-buffer-name-case nil
efs-compute-remote-buffer-file-truename nil
efs-debug-ftp-connection nil
efs-ding-on-chmod-failure t
efs-ding-on-umask-failure t
efs-disable-netrc-security-check nil
efs-expire-ftp-buffers t
efs-ftp-buffer-expire-time nil
efs-ftp-program-args '("-i" "-n" "-g" "-v")
efs-ftp-prompt-regexp "^\\(ftp\\|Ftp\\|FTP\\)> *"
efs-gateway-ftp-prompt-regexp "^\\(ftp\\|Ftp\\|FTP\\)> *"
efs-gateway-hash-mark-size nil
efs-gateway-incoming-binary-hm-size nil
efs-generate-anonymous-password t
efs-hash-mark-size 2048
efs-high-security-hosts nil
efs-incoming-binary-hm-size nil
efs-local-apollo-unix nil
efs-ls-cache-max 5
efs-make-backup-files '(unix sysV-unix bsd-unix next-unix apollo-unix
dumb-unix dumb-apollo-unix super-dumb-unix)
efs-max-ftp-buffer-size 3000
efs-maximize-idle nil
efs-message-interval 0
efs-nlist-cmd "ls"
efs-nslookup-on-connect nil
efs-nslookup-program nil
efs-prompt-for-transfer-type nil
efs-pty-check-retry-time 5
efs-pty-check-threshold 1000
efs-retry-time 5
efs-root-umask nil
efs-send-hash t
efs-set-modtimes-synchronously nil
efs-short-circuit t
efs-short-circuit-to-remote-root nil
efs-suppress-abort-recursive-edit-and-then nil
efs-text-file-name-regexp ".*"
efs-treat-crlf-as-nl nil
efs-umask nil
efs-use-passive-mode nil
efs-verbose t
efs-verify-anonymous-modtime nil
efs-verify-modtime-host-regexp ".*"
efs-ftp-program-name "ftp"
efs-ftp-program-args '("-i" "-n" "-g" "-v")
efs-local-host-regexp ".*"
efs-ftp-local-host-regexp ".*"
efs-gateway-host nil
efs-gateway-type nil
reporter-version "3.35"
features '(mail-abbrevs sendmail reporter efs-report hyper-apropos efs-dired
cus-face font disp-table dired-faces dired-xemacs dired
efs-x19\.15 efs-fnh passwd advice advice-preload efs-ovwrt efs-cu
efs-netrc efs-defun comint ring efs efs-dump zenirc-autoloads
xemacs-devel-autoloads xemacs-base-autoloads w3-autoloads
vm-autoloads viper-autoloads view-process-autoloads vhdl-autoloads
vc-autoloads tpu-autoloads tooltalk-autoloads tm-autoloads
time-autoloads textools-autoloads text-modes-autoloads
texinfo-autoloads supercite-autoloads strokes-autoloads
speedbar-autoloads slider-autoloads sh-script-autoloads
sgml-autoloads scheme-autoloads rmail-autoloads reftex-autoloads
psgml-autoloads prog-modes-autoloads pcl-cvs-autoloads
pc-autoloads os-utils-autoloads net-utils-autoloads
misc-games-autoloads mine-autoloads mh-e-autoloads mew-autoloads
mailcrypt-autoloads mail-lib-autoloads jde-autoloads
ispell-autoloads ilisp-autoloads igrep-autoloads
hm--html-menus-autoloads gnus-autoloads gnats-autoloads
games-autoloads fsf-compat-autoloads frame-icon-autoloads
forms-autoloads footnote-autoloads eudc-autoloads eterm-autoloads
emerge-autoloads elib-autoloads edt-autoloads edit-utils-autoloads
ediff-autoloads edebug-autoloads dired-autoloads debug-autoloads
crisp-autoloads cookie-autoloads cc-mode-autoloads
calendar-autoloads calc-autoloads c-support-autoloads
bbdb-autoloads auctex-autoloads apel-autoloads ada-autoloads
Sun-autoloads mule-base-autoloads egg-its-autoloads
edict-autoloads efs-autoloads Standard-autoloads loadhist
auto-show fontl-hooks menubar-items x-menubar dragdrop mouse
mode-motion itimer auto-save lisp-mode easymenu iso8859-1 page
buff-menu lib-complete help-nomule derived frame text-props
obsolete cus-start custom widget cl-extra mini-cl cl cl-19
packages backquote very-early-lisp file-coding
mswindows-scrollbars label combo edit button mswindows-resource
bmp mswindows toolbar native-sound scrollbar network-streams
subprocesses menubar md5 xemacs png gif jpeg xpm xbm
lisp-float-type windows-nt dragdrop-api dialog devices
window-system)
)
--
Jonathan Harris | jhar(a)tardis.ed.ac.uk
London, England | Jonathan.Harris(a)symbian.com
Return value: nil
file-symlink-p("/anonymous@ftp.xemacs.org:/pub/xemacs")
* (let ((target ...)) (if target (efs-chase-symlinks ...) file))
)
* efs-chase-symlinks("/anonymous@ftp.xemacs.org:/pub/xemacs")
(efs-internal-file-directory-p nil (efs-chase-symlinks (efs-internal-directory-file-name
path)))
)
(if (stringp file-ent) (efs-internal-file-directory-p nil (efs-chase-symlinks ...))
file-ent)
)
(let ((file-ent ...)) (if (stringp file-ent) (efs-internal-file-directory-p nil ...)
file-ent))
)
(or (string-equal (nth 2 parsed) "/") (let (...) (if ... ... file-ent)))
)
(let ((parsed ...)) (or (string-equal ... "/") (let ... ...)))
)
(lambda (path) (let (...) (or ...
...)))("/anonymous@ftp.xemacs.org:/pub/xemacs")
apply((lambda (path) (let (...) (or ... ...)))
"/anonymous@ftp.xemacs.org:/pub/xemacs")
efs-internal-file-directory-p(nil "/anonymous@ftp.xemacs.org:/pub/xemacs")
(if (stringp file-ent) (efs-internal-file-directory-p nil (efs-chase-symlinks ...))
file-ent)
)
(let ((file-ent ...)) (if (stringp file-ent) (efs-internal-file-directory-p nil ...)
file-ent))
)
(or (string-equal (nth 2 parsed) "/") (let (...) (if ... ... file-ent)))
)
(let ((parsed ...)) (or (string-equal ... "/") (let ... ...)))
)
(lambda (path) (let (...) (or ...
...)))("/anonymous@ftp.xemacs.org:/pub/xemacs")
apply((lambda (path) (let (...) (or ... ...)))
"/anonymous@ftp.xemacs.org:/pub/xemacs")
efs-internal-file-directory-p(unix "/anonymous@ftp.xemacs.org:/pub/xemacs")
(let* ((file ...) (parsed ...)) (efs-internal-file-directory-p (efs-host-type ... ...)
file))
)
efs-file-directory-p("/anonymous@ftp.xemacs.org:/pub/xemacs")
apply(efs-file-directory-p "/anonymous@ftp.xemacs.org:/pub/xemacs")
(if handler (apply handler args) (let (... ...) (apply operation args)))
)
(let ((handler ...)) (if handler (apply handler args) (let ... ...)))
)
efs-file-handler-function(file-directory-p
"/anonymous@ftp.xemacs.org:/pub/xemacs")
file-directory-p("/anonymous@ftp.xemacs.org:/pub/xemacs")
apply(file-directory-p "/anonymous@ftp.xemacs.org:/pub/xemacs")
dired-handler-fn(file-directory-p "/anonymous@ftp.xemacs.org:/pub/xemacs")
file-directory-p("/anonymous@ftp.xemacs.org:/pub/xemacs")
find-file-noselect("/anonymous@ftp.xemacs.org:/pub/xemacs")
find-file("/anonymous@ftp.xemacs.org:/pub/xemacs")
(lambda nil "In dired, visit the file or directory named on this line.\nNote: This
function has been modified to work with efs." (interactive) (find-file (if ... ...
...)))()
call-interactively(dired-advertised-find-file)
--- fileio.c.bak Sat Jan 02 04:42:24 1999
+++ fileio.c Sat Jan 09 22:48:46 1999
@@ -2072,7 +2068,6 @@
return Qnil;
}
-#ifdef S_IFLNK
DEFUN ("make-symbolic-link", Fmake_symbolic_link, 2, 3,
"FMake symbolic link to file: \nFMake symbolic link to file %s: \np",
/*
Make a symbolic link to FILENAME, named LINKNAME. Both args strings.
@@ -2111,6 +2106,7 @@
RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename,
linkname, ok_if_already_exists));
+#ifdef S_IFLNK
if (NILP (ok_if_already_exists)
|| INTP (ok_if_already_exists))
barf_or_query_if_file_exists (linkname, "make it a link",
@@ -2119,6 +2115,7 @@
unlink ((char *) XSTRING_DATA (linkname));
if (0 > symlink ((char *) XSTRING_DATA (filename),
(char *) XSTRING_DATA (linkname)))
+#endif /* S_IFLNK */
{
report_file_error ("Making symbolic link",
list2 (filename, linkname));
@@ -2126,7 +2123,6 @@
UNGCPRO;
return Qnil;
}
-#endif /* S_IFLNK */
#ifdef HPUX_NET
@@ -2353,11 +2349,6 @@
(filename))
{
/* This function can GC. GC checked 1997.04.10. */
-#ifdef S_IFLNK
- char *buf;
- int bufsize;
- int valsize;
- Lisp_Object val;
Lisp_Object handler;
struct gcpro gcpro1;
@@ -2372,25 +2363,33 @@
if (!NILP (handler))
return call2 (handler, Qfile_symlink_p, filename);
- bufsize = 100;
- while (1)
- {
- buf = xnew_array_and_zero (char, bufsize);
- valsize = readlink ((char *) XSTRING_DATA (filename),
- buf, bufsize);
- if (valsize < bufsize) break;
- /* Buffer was not long enough */
- xfree (buf);
- bufsize *= 2;
- }
- if (valsize == -1)
- {
- xfree (buf);
- return Qnil;
- }
- val = make_string ((Bufbyte *) buf, valsize);
- xfree (buf);
- return val;
+#ifdef S_IFLNK
+ {
+ char *buf;
+ int bufsize;
+ int valsize;
+ Lisp_Object val;
+
+ bufsize = 100;
+ while (1)
+ {
+ buf = xnew_array_and_zero (char, bufsize);
+ valsize = readlink ((char *) XSTRING_DATA (filename),
+ buf, bufsize);
+ if (valsize < bufsize) break;
+ /* Buffer was not long enough */
+ xfree (buf);
+ bufsize *= 2;
+ }
+ if (valsize == -1)
+ {
+ xfree (buf);
+ return Qnil;
+ }
+ val = make_string ((Bufbyte *) buf, valsize);
+ xfree (buf);
+ return val;
+ }
#else /* not S_IFLNK */
return Qnil;
#endif /* not S_IFLNK */
@@ -4210,9 +4209,7 @@
DEFSUBR (Fdelete_file);
DEFSUBR (Frename_file);
DEFSUBR (Fadd_name_to_file);
-#ifdef S_IFLNK
DEFSUBR (Fmake_symbolic_link);
-#endif /* S_IFLNK */
#ifdef HPUX_NET
DEFSUBR (Fsysnetunam);
#endif /* HPUX_NET */