From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 26 20:19:33 2010 Received: (at submit) by debbugs.gnu.org; 27 Sep 2010 00:19:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P01RM-0008OK-DF for submit@debbugs.gnu.org; Sun, 26 Sep 2010 20:19:32 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P01RK-0008OF-Qh for submit@debbugs.gnu.org; Sun, 26 Sep 2010 20:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P01U0-0001e2-7v for submit@debbugs.gnu.org; Sun, 26 Sep 2010 20:22:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:36437) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P01U0-0001dy-67 for submit@debbugs.gnu.org; Sun, 26 Sep 2010 20:22:16 -0400 Received: from [140.186.70.92] (port=33214 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P01Tz-0006BS-6t for bug-gnu-emacs@gnu.org; Sun, 26 Sep 2010 20:22:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P01Ty-0001do-1Z for bug-gnu-emacs@gnu.org; Sun, 26 Sep 2010 20:22:15 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:37180) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P01Tx-0001dg-Pv for bug-gnu-emacs@gnu.org; Sun, 26 Sep 2010 20:22:13 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o8R0MBWP032237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 27 Sep 2010 00:22:12 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o8QMWhST025977 for ; Mon, 27 Sep 2010 00:22:11 GMT Received: from abhmt012.oracle.com by acsmt354.oracle.com with ESMTP id 631233361285546911; Sun, 26 Sep 2010 17:21:51 -0700 Received: from dradamslap1 (/10.159.219.230) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 26 Sep 2010 17:21:51 -0700 From: "Drew Adams" To: 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 Message-ID: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Actd2f9MaGri1c/kQ2yEHhVgTGt67w== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) 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' From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 13 09:40:29 2011 Received: (at 7112) by debbugs.gnu.org; 13 Jul 2011 13:40:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qgzft-0008Em-AU for submit@debbugs.gnu.org; Wed, 13 Jul 2011 09:40:29 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qgzfn-0008EE-9T for 7112@debbugs.gnu.org; Wed, 13 Jul 2011 09:40:23 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=quimbies.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1QgzfZ-00007C-I9; Wed, 13 Jul 2011 15:40:05 +0200 From: Lars Magne Ingebrigtsen To: "Drew Adams" Subject: Re: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE In-Reply-To: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> (Drew Adams's message of "Sun, 26 Sep 2010 17:21:58 -0700") Date: Wed, 13 Jul 2011 15:18:43 +0200 Message-ID: References: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-Now-Playing: Talking Heads's _More Songs About Buildings and Food_: "Warning Sign" X-Hashcash: 1:23:110713:drew.adams@oracle.com::wTMLYbq7D6d/Rwq4:00000000000000000000000000000000000000000WMM X-Hashcash: 1:23:110713:7112@debbugs.gnu.org::E8nwMxwzcasGZrTb:00000000000000000000000000000000000000000IFck X-Hashcash: 1:23:110713:bug-gnu-emacs@gnu.org::F/ZBOKF3Zx6Pb/8o:0000000000000000000000000000000000000001O3/4 MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1QgzfZ-00007C-I9 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1311169205.64404@dVmYKK83836+a0e4TdKmRA X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7112 Cc: 7112@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) "Drew Adams" writes: > 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': I think this should most likely be fixed in the caller (i.e., in dired.el). What's the backtrace for this bug? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 13 11:14:19 2011 Received: (at 7112) by debbugs.gnu.org; 13 Jul 2011 15:14:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh18k-0006eS-JJ for submit@debbugs.gnu.org; Wed, 13 Jul 2011 11:14:19 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh18h-0006eF-Ih for 7112@debbugs.gnu.org; Wed, 13 Jul 2011 11:14:16 -0400 Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p6DFE6gC026980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Jul 2011 15:14:09 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p6DFE56b012945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 13 Jul 2011 15:14:06 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p6DFDxxs015852; Wed, 13 Jul 2011 10:13:59 -0500 Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Jul 2011 08:13:59 -0700 From: "Drew Adams" To: "'Lars Magne Ingebrigtsen'" References: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> Subject: RE: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE Date: Wed, 13 Jul 2011 08:13:59 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcxBYmog2j+ZTje9Ry2Pr2pjskeW2QACwdVg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: rtcsinet21.oracle.com [66.248.204.29] X-CT-RefId: str=0001.0A090208.4E1DB641.00CC:SCFSTAT5015188, ss=1, re=-6.300, fgs=0 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 7112 Cc: 7112@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) > > 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': > > I think this should most likely be fixed in the caller (i.e., in > dired.el). What does that mean? dired.el is a file, not a caller. > What's the backtrace for this bug? Why not try it yourself, using the emacs -Q recipe: M-: (dired '("foobar" "111.el" "")) Anyway: Debugger entered--Lisp error: (args-out-of-range "" -1) aref("" -1) (eq (aref file (1- (length file))) 47) (if (eq (aref file (1- (length file))) 47) (setq file (substring file 0 -1))) (if (or wildcard-regexp full-directory-p) (let* ((dir (file-name-as-directory file)) (default-directory dir) (file-alist (directory-files-and-attributes dir nil wildcard-regexp t (if (memq 110 switches) (quote integer) (quote string)))) (sum 0) (max-uid-len 0) (max-gid-len 0) (max-file-size 0) total-line files elt short file-size attr fuid fgid uid-len gid-len) (cond ((memq 65 switches) (setq file-alist (ls-lisp-delete-matching "^\\.\\.?$" file-alist))) ((not (memq 97 switches)) (setq file-alist (ls-lisp-delete-matching "^\\." file-alist)))) (setq file-alist (ls-lisp-handle-switches file-alist switches)) (if (memq 67 switches) (ls-lisp-column-format file-alist) (setq total-line (cons (point) (car-safe file-alist))) (dolist (elt file-alist) (setq attr (cdr elt) fuid (nth 2 attr) uid-len (if (stringp fuid) (string-width fuid) (length (format "%d" fuid))) fgid (nth 3 attr) gid-len (if (stringp fgid) (string-width fgid) (length (format "%d" fgid))) file-size (nth 7 attr)) (if (> uid-len max-uid-len) (setq max-uid-len uid-len)) (if (> gid-len max-gid-len) (setq max-gid-len gid-len)) (if (> file-size max-file-size) (setq max-file-size file-size))) (setq ls-lisp-uid-d-fmt (format " %%-%dd" max-uid-len)) (setq ls-lisp-uid-s-fmt (format " %%-%ds" max-uid-len)) (setq ls-lisp-gid-d-fmt (format " %%-%dd" max-gid-len)) (setq ls-lisp-gid-s-fmt (format " %%-%ds" max-gid-len)) (setq ls-lisp-filesize-d-fmt (format " %%%dd" (if (memq 115 switches) (length (format "%.0f" ...)) (length (format "%.0f" max-file-size))))) (setq ls-lisp-filesize-f-fmt (format " %%%d.0f" (if (memq 115 switches) (length (format "%.0f" ...)) (length (format "%.0f" max-file-size))))) (setq files file-alist) (while files (setq elt (car files) files (cdr files) short (car elt) attr (cdr elt) file-size (nth 7 attr)) (and attr (setq sum (+ file-size (if ... sum ...))) (insert (ls-lisp-format short attr file-size switches time-index)))) (save-excursion (goto-char (car total-line)) (or (cdr total-line) (insert "(No match)\n")) (insert (format "total %.0f\n" (fceiling (/ sum 1024.0)))))) (if (memq 82 switches) (while file-alist (setq elt (car file-alist) file-alist (cdr file-alist)) (when (and (eq (cadr elt) t) (not (string-match "\\`\\.\\.?/?\\'" ...))) (setq elt (expand-file-name (car elt) dir)) (insert "\n" elt ":\n") (ls-lisp-insert-directory elt switches time-index wildcard-regexp full-directory-p))))) (if (file-name-absolute-p file) (setq file (expand-file-name file))) (if (eq (aref file (1- (length file))) 47) (setq file (substring file 0 -1))) (let ((fattr (file-attributes file (quote string)))) (if fattr (insert (ls-lisp-format (if (memq 70 switches) (ls-lisp-classify-file file fattr) file) fattr (nth 7 fattr) switches time-index)) (message "%s: doesn't exist or is inaccessible" file) (ding) (sit-for 2)))) ls-lisp-insert-directory("" (97 108) nil nil nil) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp (if (memq 66 switches) "[^~]\\'") file (file-relative-name orig-file)) (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) (signal (car err) (cdr err))))) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq (aref file (1- ...)) 47)) (setq file (substring file 0 (1- (length file))))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp (if (memq 66 switches) "[^~]\\'") file (file-relative-name orig-file)) (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available (get-free-disk-space "."))) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available)))))) (let ((handler (find-file-name-handler (expand-file-name file) (quote insert-directory))) (orig-file file) wildcard-regexp) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq (aref file ...) 47)) (setq file (substring file 0 (1- ...)))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp (if ... "[^~]\\'") file (file-relative-name orig-file)) (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available (get-free-disk-space "."))) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available))))))) (if ls-lisp-use-insert-directory-program (funcall original-insert-directory file switches wildcard full-directory-p) (let ((handler (find-file-name-handler (expand-file-name file) (quote insert-directory))) (orig-file file) wildcard-regexp) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq ... 47)) (setq file (substring file 0 ...))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp ... file ...) (ls-lisp-insert-directory file switches ... nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available ...)) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available)))))))) insert-directory("" "-al" nil nil) apply(insert-directory ("" "-al" nil nil)) (let* ((inhibit-file-name-handlers (\` (tramp-completion-file-name-handler cygwin-mount-name-hook-function cygwin-mount-map-drive-hook-function \, (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers)))) (inhibit-file-name-operation operation)) (apply operation args)) tramp-completion-run-real-handler(insert-directory ("" "-al" nil nil)) (if (and fn tramp-mode (or (eq tramp-syntax (quote sep)) (featurep (quote tramp)) (and (boundp (quote partial-completion-mode)) (symbol-value (quote partial-completion-mode))) (featurep (quote ido)) (featurep (quote icicles)))) (save-match-data (apply (cdr fn) args)) (tramp-completion-run-real-handler operation args)) (let ((directory-sep-char 47) (fn (assoc operation tramp-completion-file-name-handler-alist))) (if (and fn tramp-mode (or (eq tramp-syntax (quote sep)) (featurep (quote tramp)) (and (boundp (quote partial-completion-mode)) (symbol-value (quote partial-completion-mode))) (featurep (quote ido)) (featurep (quote icicles)))) (save-match-data (apply (cdr fn) args)) (tramp-completion-run-real-handler operation args))) tramp-completion-file-name-handler(insert-directory "" "-al" nil nil) funcall(tramp-completion-file-name-handler insert-directory "" "-al" nil nil) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq (aref file (1- ...)) 47)) (setq file (substring file 0 (1- (length file))))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp (if (memq 66 switches) "[^~]\\'") file (file-relative-name orig-file)) (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available (get-free-disk-space "."))) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available)))))) (let ((handler (find-file-name-handler (expand-file-name file) (quote insert-directory))) (orig-file file) wildcard-regexp) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq (aref file ...) 47)) (setq file (substring file 0 (1- ...)))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp (if ... "[^~]\\'") file (file-relative-name orig-file)) (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available (get-free-disk-space "."))) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available))))))) (if ls-lisp-use-insert-directory-program (funcall original-insert-directory file switches wildcard full-directory-p) (let ((handler (find-file-name-handler (expand-file-name file) (quote insert-directory))) (orig-file file) wildcard-regexp) (if handler (funcall handler (quote insert-directory) file switches wildcard full-directory-p) (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) (setq switches (delete 32 (delete 45 (append switches nil)))) (if (and ls-lisp-support-shell-wildcards (string-match "[[?*]" file) (not (file-exists-p file))) (progn (or (not (eq ... 47)) (setq file (substring file 0 ...))) (setq wildcard t))) (if wildcard (setq wildcard-regexp (if ls-lisp-support-shell-wildcards (wildcard-to-regexp (file-name-nondirectory file)) (file-name-nondirectory file)) file (file-name-directory file)) (if (memq 66 switches) (setq wildcard-regexp "[^~]\\'"))) (condition-case err (ls-lisp-insert-directory file switches (ls-lisp-time-index switches) wildcard-regexp full-directory-p) (invalid-regexp (if (equal (cadr err) "Unmatched [ or [^") (progn (setq wildcard-regexp ... file ...) (ls-lisp-insert-directory file switches ... nil full-directory-p)) (signal (car err) (cdr err))))) (save-excursion (goto-char (point-min)) (when (re-search-forward "^total" nil t) (let ((available ...)) (when available (replace-match "total used in directory") (end-of-line) (insert " available " available)))))))) insert-directory("" "-al" nil nil) dired-insert-directory("c:/drews-lisp-20/foobar" "-al" ("111.el" "") nil t) dired-readin-insert() dired-readin() dired-internal-noselect(("c:/drews-lisp-20/foobar" "111.el" "") nil) dired-noselect(("foobar" "111.el" "") nil) dired(("foobar" "111.el" "")) eval((dired (quote ("foobar" "111.el" ""))) nil) eval-expression((dired (quote ("foobar" "111.el" ""))) nil) call-interactively(eval-expression nil nil) But I already pointed you to the code that needs to be changed. And I already provided the fix: > `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) ...) Simply wrap the body of `ls-lisp-insert-directory' with (when (> (length file) 0) ...), and the problem is fixed. And that is the right way to fix it. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 02 16:09:46 2011 Received: (at 7112) by debbugs.gnu.org; 2 Aug 2011 20:09:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoLHb-0002nV-NX for submit@debbugs.gnu.org; Tue, 02 Aug 2011 16:09:46 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoLHZ-0002nN-3T for 7112@debbugs.gnu.org; Tue, 02 Aug 2011 16:09:42 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1QoLGy-0000DB-2S; Tue, 02 Aug 2011 22:09:04 +0200 From: Lars Magne Ingebrigtsen To: "Drew Adams" Subject: Re: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE In-Reply-To: (Drew Adams's message of "Wed, 13 Jul 2011 08:13:59 -0700") Date: Tue, 02 Aug 2011 22:06:46 +0200 Message-ID: References: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-Now-Playing: Ultra Vivid Scene's _Mercy Seat_ MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1QoLGy-0000DB-2S X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1312920544.23653@yUWEY7RxzFdzshwTXUYj/w X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7112 Cc: 7112@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) "Drew Adams" writes: >> > (error "Args out of range: \"\", -1") >> > The reason is the following code near the end of >> > `ls-lisp-insert-directory': >> >> I think this should most likely be fixed in the caller (i.e., in >> dired.el). > > What does that mean? dired.el is a file, not a caller. dired.el should not be asking ls-lisp to list a directory called "", which is obviously something that should generate an error. >> 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? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 02 17:26:58 2011 Received: (at 7112) by debbugs.gnu.org; 2 Aug 2011 21:26:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoMUL-0005UZ-8w for submit@debbugs.gnu.org; Tue, 02 Aug 2011 17:26:58 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoMUI-0005UQ-Me for 7112@debbugs.gnu.org; Tue, 02 Aug 2011 17:26:55 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p72LQLt3027123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Aug 2011 21:26:23 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p72LQLlB001106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Aug 2011 21:26:21 GMT Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p72LQFUL001615; Tue, 2 Aug 2011 16:26:15 -0500 Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Aug 2011 14:25:07 -0700 THREAD-INDEX: AcxRUBDrcgb3s8p4TyKlnahkqtNnxQACQMew X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 MIME-Version: 1.0 Message-ID: <4B2D12A22D88427F8DD7DFA8BBFC10DA@us.oracle.com> Date: Tue, 2 Aug 2011 14:25:08 -0700 (PDT) From: Drew Adams To: "'Lars Magne Ingebrigtsen'" Subject: RE: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE References: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> In-Reply-To: X-Mailer: Microsoft Office Outlook 11 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4E386B7F.006F:SCFMA922111,ss=1,re=-4.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 7112 Cc: 7112@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > 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). From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 02 17:33:12 2011 Received: (at 7112-close) by debbugs.gnu.org; 2 Aug 2011 21:33:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoMaO-0005di-Kl for submit@debbugs.gnu.org; Tue, 02 Aug 2011 17:33:12 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QoMaL-0005dZ-Pv for 7112-close@debbugs.gnu.org; Tue, 02 Aug 2011 17:33:11 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1QoMZk-0001Sq-5U; Tue, 02 Aug 2011 23:32:32 +0200 From: Lars Magne Ingebrigtsen To: Drew Adams Subject: Re: 24.0.50; [PATCH] `ls-lisp-insert-directory' should be no-op for empty FILE In-Reply-To: <4B2D12A22D88427F8DD7DFA8BBFC10DA@us.oracle.com> (Drew Adams's message of "Tue, 2 Aug 2011 14:25:08 -0700 (PDT)") Date: Tue, 02 Aug 2011 23:32:07 +0200 Message-ID: References: <68BA79A0F7304F01870834FE12F89A36@us.oracle.com> <4B2D12A22D88427F8DD7DFA8BBFC10DA@us.oracle.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEXk49wgFxqmnYhSPTx2 bl9MMLAFAAACSElEQVQ4jVWUYZbrIAiFObYLqEMW4BAXMAYXkAj7X9O7aNqZx48e4yeIcCkRUVUh ktoybLhl3bGgMD3x88i5WeYTu+0DjgmaWhvSsubMYwJW/OyZt8Zlz40zO4I/fh5s9UXWNpyknRvr Jgknt52tM6nohSue2E5HAXhmZdVefIhcvZDakWwIcs3Yb1oMm3tB8lsh80Qme9ZRvVu8JkxwD9YH 8uyjVm9MtyVXPugkQ0TZVfPXDXZjjVOXn0kUIJflYE2n+6VDcAZleE1QUZjWCKlod2QG9FoOhnXD HRRRVH20rwWGoor0Q8KIoj3KVyY4eoBNrtmHKqlxx/6wuI4p22zQGSBzoereFlh2mCAUYj3V0Sr+ AOYZIZ4tiKEfcBtAqtz+hFqNjk6nPef/wMoFZvG1LTBf0lZNksV3p3UWfe7XkkZyPIwNgA/Hw+2w 827UFYUjlM+H7939ePcp3D1Axy7sfIOQFQBa5CHYXj4e+UyN2A0OdSrnBhdDB9QFZXMpdXxA6CjT SNOl1Pq+43ujBSp0iNts6hJuUXxRkgRNuYjF7SWVSOoHLiQCNOChCo8U4aE2sgCwSMAAnkRo+EA3 IxTVABYlAdsvxkHGcnpoTAKdJ2aUB5QWM5ZmoABxBDKEGrTPcoJY5FyeJN+KzugEEcsdRUa4Upcs McelxENwKCIwz2GOC/FUkWe/wv1ucYzehndQkdQbzznIb9AbjVJGTGi/PtLTmCJCkg6RZW432KJz mCiMqtVRf8WIfVTckWyJWf4FTfFHIv4PAU6GAOdDya0AAAAASUVORK5CYII= X-Now-Playing: Pale Saints's _The Comforts of Madness_: "You Tear the World in Two" MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1QoMZk-0001Sq-5U X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1312925552.25573@qc0poc+afosnpvtgQEXpyg X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7112-close Cc: 7112-close@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Drew Adams writes: > `ls-lisp-insert-directory' should not raise a low-level, Args out of > range error. It should itself DTRT for an empty file name. Which is to give an error. It's a nonsensical input. >> > 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." It gives an error. If you call `dired' with `t', you get Debugger entered--Lisp error: (wrong-type-argument stringp t) file-name-as-directory(t) dired-noselect(t nil) Don't do that, then. I'm closing this report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From unknown Mon Aug 18 14:16:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 31 Aug 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator