[PATCH] Make CDPATH handling portable, accept entries not matching "/$".
15 years, 6 months
Aidan Kehoe
2009-03-07 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el (cd):
Make CDPATH handling portable, accept entries without trailing
slashes within it.
--- lisp/files.el~ 2009-02-20 17:22:47.000000000 +0000
+++ lisp/files.el 2009-03-07 12:37:57.000000000 +0000
@@ -595,12 +595,14 @@
(null (getenv "CDPATH"))))))
(if (file-name-absolute-p dir)
(cd-absolute (expand-file-name dir))
- ;; XEmacs
+ ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to
+ ;; do under Windows.
(unless (and cd-path (equal (getenv "CDPATH") cdpath-previous))
- ;;#### Unix-specific
- (let ((trypath (parse-colon-path
- (setq cdpath-previous (getenv "CDPATH")))))
- (setq cd-path (or trypath (list "./")))))
+ (let ((trypath (split-string (setq cdpath-previous (getenv "CDPATH"))
+ path-separator)))
+ (setq cd-path (or (and trypath
+ (mapcar #'file-name-as-directory trypath))
+ (string ?. directory-sep-char)))))
(or (catch 'found
(mapcar #'(lambda (x)
(let ((f (expand-file-name (concat x dir))))
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghe, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Make CDPATH handling portable, accept entries not matching "/$".
15 years, 6 months
Aidan Kehoe
changeset: 4640:8cef85a39d2c
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Jun 06 17:20:21 2009 +0100
files: lisp/ChangeLog lisp/files.el
description:
Make CDPATH handling portable, accept entries not matching "/$".
2009-06-06 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el (cd):
Make CDPATH handling portable, accept entries without trailing
slashes within it. Some style corrections from Stephen Turnbull,
thank you Stephen.
diff -r 7757334005ae -r 8cef85a39d2c lisp/ChangeLog
--- a/lisp/ChangeLog Sat Jun 06 12:59:31 2009 +0100
+++ b/lisp/ChangeLog Sat Jun 06 17:20:21 2009 +0100
@@ -1,3 +1,10 @@
+2009-06-06 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * files.el (cd):
+ Make CDPATH handling portable, accept entries without trailing
+ slashes within it. Some style corrections from Stephen Turnbull,
+ thank you Stephen.
+
2009-05-29 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-lambda):
diff -r 7757334005ae -r 8cef85a39d2c lisp/files.el
--- a/lisp/files.el Sat Jun 06 12:59:31 2009 +0100
+++ b/lisp/files.el Sat Jun 06 17:20:21 2009 +0100
@@ -595,12 +595,13 @@
(null (getenv "CDPATH"))))))
(if (file-name-absolute-p dir)
(cd-absolute (expand-file-name dir))
- ;; XEmacs
+ ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to
+ ;; do under Windows.
(unless (and cd-path (equal (getenv "CDPATH") cdpath-previous))
- ;;#### Unix-specific
- (let ((trypath (parse-colon-path
- (setq cdpath-previous (getenv "CDPATH")))))
- (setq cd-path (or trypath (list "./")))))
+ (let ((trypath (split-path (setq cdpath-previous (getenv "CDPATH")))))
+ (setq cd-path (or (and trypath
+ (mapcar #'file-name-as-directory trypath))
+ (file-name-as-directory "")))))
(or (catch 'found
(mapcar #'(lambda (x)
(let ((f (expand-file-name (concat x dir))))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Always check code in (interactive SEXP) for sanity
15 years, 6 months
Aidan Kehoe
Applying this patch uncovers at least the following bug for me:
Loading cl-macs...
While compiling set-face-background-pixmap-file in file /home/aidan/xemacs-21.5-checked-out/lisp/faces.el:
** (image-instance-file-name (face-background-pixmap-instance face)) is a malformed function
Wrote /home/aidan/xemacs-21.5-checked-out/lisp/faces.elc
I’m sure it will uncover many more in the packages. The issue is that
#'call-interactively wants uncompiled code in the sexp for some (not
particularly sane, as far as I can tell) reason; the byte compiler up to now
has not examined this code for well-formedness. This patch changes that.
2009-05-29 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-lambda):
Even if we are going to store uncompiled interactive forms in the
compiled-function object, byte compile (and discard) the code, for
the sake of the warnings generated.
--- bytecomp.el~ 2009-01-13 14:56:25.000000000 +0000
+++ bytecomp.el 2009-05-29 15:17:59.000000000 +0100
@@ -2507,7 +2507,7 @@
;; only if it is not the only element of the body.
(if (cdr body)
(setq body (cdr body))))))
- (int (assq 'interactive body)))
+ (int (assq 'interactive body)) compiled-int)
(dolist (arg arglist)
(cond ((not (symbolp arg))
(byte-compile-warn "non-symbol in arglist: %S" arg))
@@ -2526,9 +2526,11 @@
(if (cdr (cdr int))
(byte-compile-warn "malformed interactive spec: %s"
(prin1-to-string int)))
- ;; If the interactive spec is a call to `list',
- ;; don't compile it, because `call-interactively'
- ;; looks at the args of `list'.
+ ;; If the interactive spec is a call to `list', don't
+ ;; store the compiled form, because `call-interactively'
+ ;; looks at the args of `list' and treats certain
+ ;; functions specially. Compiling it is nonetheless
+ ;; useful for warnings.
(let ((form (nth 1 int)))
(while (or (eq (car-safe form) 'let)
(eq (car-safe form) 'let*)
@@ -2536,9 +2538,10 @@
(while (consp (cdr form))
(setq form (cdr form)))
(setq form (car form)))
+ (setq compiled-int
+ (byte-compile-top-level (nth 1 int)))
(or (eq (car-safe form) 'list)
- (setq int (list 'interactive
- (byte-compile-top-level (nth 1 int)))))))
+ (setq int (list 'interactive compiled-int)))))
((cdr int)
(byte-compile-warn "malformed interactive spec: %s"
(prin1-to-string int))))))
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghe, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: bytecomp.el: always check code in (interactive SEXP) for sanity
15 years, 6 months
Aidan Kehoe
changeset: 4639:7757334005ae
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Jun 06 12:59:31 2009 +0100
files: lisp/ChangeLog lisp/bytecomp.el
description:
bytecomp.el: always check code in (interactive SEXP) for sanity
2009-05-29 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-lambda):
Even if we are going to store uncompiled interactive forms in the
compiled-function object, byte compile (and discard) the code, for
the sake of the warnings generated.
diff -r 5bbff3553494 -r 7757334005ae lisp/ChangeLog
--- a/lisp/ChangeLog Fri Jun 05 21:48:41 2009 +0900
+++ b/lisp/ChangeLog Sat Jun 06 12:59:31 2009 +0100
@@ -1,3 +1,10 @@
+2009-05-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-lambda):
+ Even if we are going to store uncompiled interactive forms in the
+ compiled-function object, byte compile (and discard) the code, for
+ the sake of the warnings generated.
+
2009-05-18 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.29 "garbanzo" is released.
diff -r 5bbff3553494 -r 7757334005ae lisp/bytecomp.el
--- a/lisp/bytecomp.el Fri Jun 05 21:48:41 2009 +0900
+++ b/lisp/bytecomp.el Sat Jun 06 12:59:31 2009 +0100
@@ -2541,7 +2541,7 @@
;; only if it is not the only element of the body.
(if (cdr body)
(setq body (cdr body))))))
- (int (assq 'interactive body)))
+ (int (assq 'interactive body)) compiled-int)
(dolist (arg arglist)
(cond ((not (symbolp arg))
(byte-compile-warn "non-symbol in arglist: %S" arg))
@@ -2560,9 +2560,11 @@
(if (cdr (cdr int))
(byte-compile-warn "malformed interactive spec: %s"
(prin1-to-string int)))
- ;; If the interactive spec is a call to `list',
- ;; don't compile it, because `call-interactively'
- ;; looks at the args of `list'.
+ ;; If the interactive spec is a call to `list', don't
+ ;; store the compiled form, because `call-interactively'
+ ;; looks at the args of `list' and treats certain
+ ;; functions specially. Compiling it is nonetheless
+ ;; useful for warnings.
(let ((form (nth 1 int)))
(while (or (eq (car-safe form) 'let)
(eq (car-safe form) 'let*)
@@ -2570,9 +2572,10 @@
(while (consp (cdr form))
(setq form (cdr form)))
(setq form (car form)))
+ (setq compiled-int
+ (byte-compile-top-level (nth 1 int)))
(or (eq (car-safe form) 'list)
- (setq int (list 'interactive
- (byte-compile-top-level (nth 1 int)))))))
+ (setq int (list 'interactive compiled-int)))))
((cdr int)
(byte-compile-warn "malformed interactive spec: %s"
(prin1-to-string int))))))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Off-by-one in mswindows_link
15 years, 6 months
Stephen J. Turnbull
Reply-To set to xemacs-patches; please check that your MUA DTRTs.
Ron, do you have a test case? I guess that would be hard given that
you need to control layout of memory, but maybe if you do it in a loop
you get it fairly frequently?
Reviewers: could somebody confirm the problem and that the patch works
as expected? (I can't test, I'm Windows-free at the moment.) I trust
Ron and the theory, so if no test, I'll commit in a couple of days.
Please check the ChangeLog in the patch.
Ron Isaacson writes:
> Not sure if anyone is using (add-name-to-file) on Windows, as this bug
> looks to have been here for a while... the mswindows_link function in
> nt.c does:
>
> wcscpy (data.wid.cStreamName, newuni);
> data.wid.dwStreamId = BACKUP_LINK;
> data.wid.dwStreamAttributes = 0;
> data.wid.Size.LowPart = wlen; /* in bytes, not chars! */
> data.wid.Size.HighPart = 0;
> data.wid.dwStreamNameSize = 0;
>
> The comment about bytes is correct, but is missing one important
> detail: wlen contains wcslen(newuni), but BackupWrite expects the Size
> to include the trailing null. So depending on what happens to follow
> in memory, the new file might have a garbage name.
>
> When I started seeing these garbage filenames, I copied mswindows_link
> out to a standalone program and was able to consistently reproduce the
> problem.
>
> This is fixed by changing it to:
>
> data.wid.Size.LowPart = wlen + sizeof(WCHAR); /* including the trailing null. in bytes, not chars! */
diff -r 00dca3ddee6d src/ChangeLog
--- a/src/ChangeLog Mon May 18 23:04:48 2009 +0900
+++ b/src/ChangeLog Tue Jun 02 12:16:27 2009 +0900
@@ -1,3 +1,8 @@
+2009-06-02 Ron Isaacson <Ron.Isaacson(a)morganstanley.com>
+
+ * nt.c (mswindows_link): Fix off-by-one bug in mswindows_link:
+ need to include trailing NUL in length of file name.
+
2009-05-18 Stephen J. Turnbull <stephen(a)xemacs.org>
* XEmacs 21.5.29 "garbanzo" is released.
diff -r 00dca3ddee6d src/nt.c
--- a/src/nt.c Mon May 18 23:04:48 2009 +0900
+++ b/src/nt.c Tue Jun 02 12:16:27 2009 +0900
@@ -1127,7 +1127,8 @@
wcscpy (data.wid.cStreamName, newuni);
data.wid.dwStreamId = BACKUP_LINK;
data.wid.dwStreamAttributes = 0;
- data.wid.Size.LowPart = wlen; /* in bytes, not chars! */
+ /* Include the trailing null. In bytes, not chars! */
+ data.wid.Size.LowPart = wlen + sizeof (WCHAR);
data.wid.Size.HighPart = 0;
data.wid.dwStreamNameSize = 0;
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches