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 #17 received at 7112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: "'Lars Magne Ingebrigtsen'" <larsi <at> gnus.org>
Cc: 7112 <at> debbugs.gnu.org
Subject: RE: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for
	empty FILE
Date: Tue, 2 Aug 2011 14:25:08 -0700 (PDT)
> dired.el should not be asking ls-lisp to list a directory called "",
> which is obviously something that should generate an error.

`ls-lisp-insert-directory' should not raise a low-level, Args out of range
error.  It should itself DTRT for an empty file name.  Maybe it should raise an
error, but not that low-level error.  Or maybe it should, as the Subject line
suggests, ignore empty file names.  I obviously think the latter is preferable,
but I suppose it's open for discussion.

> >> What's the backtrace for this bug?
> >
> > Why not try it yourself, using the emacs -Q recipe:
> >
> > M-: (dired '("foobar" "111.el" ""))
> 
> Why would you call this function with an empty string as a parameter?

Because you can?  No experienced programmer takes refuge behind the argument
"Why would anyone ever do that?" or "Don't worry; no one would ever do that."

Sooner or later programmers learn that users will do anything they can, and code
should be prepared.  There is never any value in making excuses that blame
"stupid" users (or "stupid" caller code).





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

Previous Next


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