Subject: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3)

From: Stefan Monnier <[email-masked]>
Date: Sat, 29 May 2010 19:29:45 -0400

> 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:/".
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