GNU bug report logs - #7112
24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 27 Sep 2010 00:20:03 UTC

Severity: minor

Tags: patch

Found in version 24.0.50

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.50;
	[PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE
Date: Sun, 26 Sep 2010 17:21:58 -0700
You can call `dired' passing a cons arg that includes a list of file
names.  An empty file name causes this ugly error: 
 
(error "Args out of range: \"\", -1")
 
The reason is the following code near the end of
`ls-lisp-insert-directory':
 
;; If not full-directory-p, FILE *must not* end in /, as
;; file-attributes will not recognize a symlink to a directory,
;; so must make it a relative filename as ls does:
(if (file-name-absolute-p file) (setq file (expand-file-name file)))
(if (eq (aref file (1- (length file))) ?/)
    (setq file (substring file 0 -1)))
 
`ls-lisp-insert-directory' should in fact do nothing at all (no-op) if
FILE is "".  The entire body should be wrapped in this:
 
(when (> (length file) 0)
  ...)
 
 
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-09-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
 





This bug report was last modified 13 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.