GNU bug report logs - #20776
25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error

Previous Next

Package: emacs;

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

Date: Tue, 9 Jun 2015 15:06:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 25.0.50

Fixed in version 25.1

Done: Lars 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: 25.0.50; [PATCH] ls-lisp fix for wrong-type-arg error
Date: Tue, 9 Jun 2015 08:05:24 -0700 (PDT)
[Message part 1 (text/plain, inline)]
This bug was described as part of bug #20739, and the fix was mentioned
there.  A patch for the fix is attached.

The bug is that when `dired' is called with a cons DIRNAME argument and
with switch -B you get a wrong-type-argument error.  For example:

(dired-other-window '("foo" "toto.el" "foo.el") "-B")

The problem is at the beginning of `ls-lisp-insert-directory.  There we
see this code on the first line:

(if (or wildcard-regexp full-directory-p)

But that is incorrect, because when switch `B' is used the code does
this (ugly hack) in `ls-lisp--insert-directory':

(if (memq ?B switches) (setq wildcard-regexp "[^~]\\'"))

and this, similarly:

(setq wildcard-regexp  (if (memq ?B switches) "[^~]\\'")
      file             (file-relative-name orig-file))

IOW, we use a pseudo wildcard-regexp, "[^~]\\'", to handle the case of
backup files.

And that doesn't work with this call:
(directory-files-and-attributes
  dir nil wildcard-regexp t (if (memq ?n switches) 'integer 'string))

Debugger entered--Lisp error: (file-error "Opening directory"
 "No such file or directory" "d:/the/path/to/foo.el/foo.el/")
  directory-files-and-attributes("foo.el/" nil "[^~]\\'" t string)
  ls-lisp-insert-directory("foo.el" (66) nil "[^~]\\'" nil)
  ls-lisp--insert-directory(...

The attached patch changes the (if (or wildcard-regexp full-directory-p)
to this, which fixes the problem of raising an error:

 (if (or (and wildcard-regexp
              (not (string= "[^~]\\'" wildcard-regexp)))
         full-directory-p)

(Note that this does not fix bug #20739, which requires that when
DIRNAME is a cons the switches actually do what they are supposed to do.
This patch merely allows Dired to list the files normally without
raising an error, but ignoring the still unsupported -B switch.)


In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2014-10-20 on LEG570
Bzr revision: 118168 rgm <at> gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
[ls-lisp-2015-06-09.patch (application/octet-stream, attachment)]

This bug report was last modified 9 years and 97 days ago.

Previous Next


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