From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.bugs Subject: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Date: Sun, 30 May 2010 15:39:00 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1275227869 25143 80.91.229.12 (30 May 2010 13:57:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 May 2010 13:57:49 +0000 (UTC) Cc: 6299@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 30 15:57:47 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OIj1M-0002Nq-G1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 May 2010 15:57:44 +0200 Original-Received: from localhost ([127.0.0.1]:34357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIj1M-0000nn-2h for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 May 2010 09:57:44 -0400 Original-Received: from [140.186.70.92] (port=43501 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIj1F-0000ni-3Y for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 09:57:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OIj1D-00069I-On for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 09:57:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40230) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIj1D-00069B-Lp for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 09:57:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OIikF-0000iv-9E; Sun, 30 May 2010 09:40:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lennart Borgman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2010 13:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6299 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6299-submit@debbugs.gnu.org id=B6299.12752267682770 (code B ref 6299); Sun, 30 May 2010 13:40:03 +0000 Original-Received: (at 6299) by debbugs.gnu.org; 30 May 2010 13:39:28 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIijg-0000id-24 for submit@debbugs.gnu.org; Sun, 30 May 2010 09:39:28 -0400 Original-Received: from mail-gw0-f44.google.com ([74.125.83.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIijd-0000iW-Rc for 6299@debbugs.gnu.org; Sun, 30 May 2010 09:39:26 -0400 Original-Received: by gwj19 with SMTP id 19so1968399gwj.3 for <6299@debbugs.gnu.org>; Sun, 30 May 2010 06:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=XFFVn+u9AnDmfqUXwrTsvfiFmNtSiXOZYbHD2ltwsrU=; b=s9SEwo00x55r87ilC9MBaAV3zlCHP9+Hfvj67sOQHldKx3aKVE11VKav3YgEUlYylZ a3mlnd9YL8YmPtdWoaMVMAAc8Bv6r15BaDEn5Uunze/J3J0XP4Ui29t1aOhPPPm0W8te wwvdniaeXz/R45wj9vSHdXdmar7keYm9FYSDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=LFc7hOVkq+lcBp0pAnrke0cFPlYmtFlaymJcUSEADi4QDciF1wVb1qseCmoTJovn+N /xck7zXKwY1CALFG/tfacgvBSwJfE4Ug9Y3cAWxkss1WCPoN6d2N5JOJ4sJf7+gXvnvF o7meikIiqZjhn5i36qn8RHtNta6PMXQ+qiKic= Original-Received: by 10.100.245.4 with SMTP id s4mr3349500anh.224.1275226760189; Sun, 30 May 2010 06:39:20 -0700 (PDT) Original-Received: by 10.100.44.20 with HTTP; Sun, 30 May 2010 06:39:00 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 30 May 2010 09:40:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37419 Archived-At: On Sun, May 30, 2010 at 2:10 AM, Lennart Borgman wrote: > On Sun, May 30, 2010 at 1:29 AM, Stefan Monnier > wrote: >>> BOUNDARIES string=3D"c:" table=3Dread-file-name-internal pred=3Dfile-ex= ists-p suffix=3D"" >>> BOUNDARIES boundaries=3D(boundaries 3) >> >> This appears to be the problem. >> >> =C2=A0(read-file-name-internal "c:" nil '(boundaries . "")) >> >> seems to return (boundaries 3 . 0). >> Since the code that does that is most likely the one in >> completion--file-name-table which does: >> >> =C2=A0 =C2=A0(let ((start (length (file-name-directory string))) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (string-match-p "/" (cdr action))= )) >> =C2=A0 =C2=A0 =C2=A0(list* 'boundaries start end))) >> >> my guess is that (file-name-directory "c:") return "c:/". > > Yes, that is the case, it returns "c:/". > > But I think that is can't return something. However in my opinion it > should return an error because "c:" is not a file path. It is just a > device. It it signaled an error code that tries something like this > would be more easily found and cured. > > So I think the problem is that (file-name-directory "c:") is called. > There must be some bad assumption somewhere in the code behind that. > > > Another suggestion that might help cleaning the code logic in > different places: Add a function directory-root-p > > w32: (directory-root-p "c:/") =3D> t > *nix: (directory-root-p "/") =3D> t > > w32: (directory-root-p "/") =3D> nil (or signal error, but that would > fit badly with file-directory-p) > *nix: (directory-root-p "c;/") =3D> nil -"- I am looking around at the code a bit. I do not understand the comment in completion--file-name-table: (cond ((eq (car-safe action) 'boundaries) ;; For the boundaries, we can't really delegate to ;; completion-file-name-table and then fix them up, because it ;; would require us to track the relationship between `str' and ;; `string', which is difficult. And in any case, if ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba", there's ;; no way for us to return proper boundaries info, because the ;; boundary is not (yet) in `string'. AFAICS it is doing exactly the same as completion-file-name-table here. What am I missing? BTW the doc string for action in completing read etc should be fixed. >> I guess we should just use (or (string-match "[^/]*\\'" string) 0) >> instead of (length (file-name-directory string)) but it has N^2 >> complexity :-( >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Stefan >> >