>>>> "Stephen" == Stephen J Turnbull
<stephen(a)xemacs.org> writes:
>>>> "APA" == Adrian Aichner
<adrian(a)xemacs.org> writes:
APA> with this patch
APA> (file-truename "c:\\*.txt")
APA> => "c:\\B-r-Backtrace.txt"
APA> (the first of my many *.txt files).
APA> XEmacs 21.1.14, however does not expand the wildcard:
APA> (file-truename "c:\\*.txt")
APA> => "c:\\*.txt"
Stephen> Thanks. Especially for the confirmation about 21.1.14,
Stephen> this is the same thing (modulo the drive-spec and
Stephen> directory-sep-char differences) that the Unix version
Stephen> does.
Stephen> I bet somebody "simplified" some function to not separate
Stephen> the directory path from the basename (which might be a
Stephen> glob), since file-truename is supposed to handle this.
Stephen> It looks to me like win32_readlink should return EINVAL,
Stephen> meaning "not a symlink", when passed "*.txt" or
"?.txt".
Stephen> How about this patch?
Hi Stephen, this patch leads
(file-truename "c:\\*.txt")
"c:\\*.txt"
Adrian
M-x recover-session
also works again, which was broken too.
I'll do more testing.
Best regards,
Adrian
Stephen> (Sorry to send you so many half-baked patches, Adrian,
Stephen> but I don't understand this stuff very well.)
Stephen> This is pretty bad style (somebody who understands what
Stephen> the code at ll. 117--137 is doing should fix this), but
Stephen> should DTRT. Except that
Stephen> (a) the author of the code seems to think that "readlink"
Stephen> is supposed
Stephen> to correct case, and that's not possible for a glob, and
Stephen> (b) as the comments say, this will not handle a symlink
Stephen> whose real name contains glob (or shell op) characters
Stephen> correctly. But neither of those is handled correctly in
Stephen> the existing code, anyway, so....
Stephen> It looks like Cygwin (and Unix) readlink will, when
Stephen> passed "*.txt", actually try to find a directory entry
Stephen> for "*.txt". Since normally no such entry exists, Cygwin
Stephen> returns ENOENT (this is a documented return value for
Stephen> Linux) and thus does not invoke win32_readlink (see
Stephen> l. 156).
Stephen> Index: src/realpath.c
Stephen> ===================================================================
Stephen> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/realpath.c,v
Stephen> retrieving revision 1.7.2.2
Stephen> diff -u -r1.7.2.2 realpath.c
Stephen> --- src/realpath.c 22 Aug 2002 10:58:34 -0000 1.7.2.2
Stephen> +++ src/realpath.c 8 Oct 2002 02:36:10 -0000
Stephen> @@ -90,9 +90,16 @@
Stephen> assert (*name);
Stephen> /* Sort of check we have a valid filename. */
Stephen> - if (strpbrk (name, "*?|<>\"") || strlen (name)
>= MAX_PATH)
Stephen> + /* #### can we have escaped shell operators in a Windows filename? */
Stephen> + if (strpbrk (name, "|<>\"") || strlen (name) >=
MAX_PATH)
Stephen> {
Stephen> errno = EIO;
Stephen> return -1;
Stephen> }
Stephen> + /* #### can we have escaped wildcards in a Windows filename? */
Stephen> + else if (strpbrk (name, "*?"))
Stephen> + {
Stephen> + errno = EINVAL; /* this valid path can't be a symlink */
Stephen> + return -1;
Stephen> + }
Stephen> --
Stephen> Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
Stephen> University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573
JAPAN
Stephen> My nostalgia for Icon makes me forget about any of the bad things. I
don't
Stephen> have much nostalgia for Perl, so its faults I remember. Scott Gilbert
c.l.py
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/