From: Lennart Borgman <lennart.borgman@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 6299@debbugs.gnu.org
Subject: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3)
Date: Sun, 30 May 2010 02:10:38 +0200 [thread overview]
Message-ID: <AANLkTikCnYc4VX7iwHVvn3obdcWXtZfheNmZHQgG6bnN@mail.gmail.com> (raw)
In-Reply-To: <jwv7hmm2tk7.fsf-monnier+emacs@gnu.org>
On Sun, May 30, 2010 at 1:29 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> BOUNDARIES string="c:" table=read-file-name-internal pred=file-exists-p suffix=""
>> BOUNDARIES boundaries=(boundaries 3)
>
> This appears to be the problem.
>
> (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:
>
> (let ((start (length (file-name-directory string)))
> (end (string-match-p "/" (cdr action))))
> (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:/") => t
*nix: (directory-root-p "/") => t
w32: (directory-root-p "/") => nil (or signal error, but that would
fit badly with file-directory-p)
*nix: (directory-root-p "c;/") => nil -"-
> I guess we should just use (or (string-match "[^/]*\\'" string) 0)
> instead of (length (file-name-directory string)) but it has N^2
> complexity :-(
>
>
> Stefan
>
next prev parent reply other threads:[~2010-05-30 0:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-29 1:35 bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Lennart Borgman
2010-05-29 16:12 ` Eli Zaretskii
2010-05-29 21:18 ` Stefan Monnier
2010-05-29 21:24 ` Lennart Borgman
2010-05-29 22:07 ` Lennart Borgman
2010-05-29 23:29 ` Stefan Monnier
2010-05-30 0:10 ` Lennart Borgman [this message]
2010-05-30 3:34 ` Stefan Monnier
2010-05-30 4:27 ` Juanma Barranquero
2010-05-30 10:11 ` Lennart Borgman
2010-05-30 14:18 ` Stefan Monnier
2010-05-30 17:40 ` Lennart Borgman
2010-05-30 21:18 ` Stefan Monnier
2010-05-30 13:39 ` Lennart Borgman
2010-05-30 14:05 ` Stefan Monnier
2010-05-30 17:39 ` Lennart Borgman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikCnYc4VX7iwHVvn3obdcWXtZfheNmZHQgG6bnN@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=6299@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).