[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] 20.6 Cygwin/DOS comint and dirtack completion support

From: Eli Zaretskii
Subject: Re: [patch] 20.6 Cygwin/DOS comint and dirtack completion support
Date: Thu, 14 Dec 2000 12:05:59 +0200 (IST)

On 14 Dec 2000, Jari Aalto+mail.emacs wrote:

>     It is now possible to correctly hit the TAB key and use the comint
>     and dirtarck completions in both the DOS and Cygwin based shell
>     buffers.

A couple of comments:

> +(defvar comint-dos-shell-file-name-regexp "cmd.*\\.exe$"
> +  "*Regexp to match a dos based shell filename in `shell-file-name'.
> +This affects the choice between \ and / in the directory completions.")

Don't you want COMMAND.COM, 4DOS.COM, 4NT.EXE, and NDOS.EXE to be
treated in the same way?  If so, why not use w32-system-shells
variable (defined on w32-fns.el)?

> +(defun dirtrack-path-to-standard (path)
> +  "Convert cygwin-like //c/temp  or /cygdrive/d/temp path to
> +dos notation c:/temp."
> +  (if (or (string-match "//\\(.\\)\\(.*\\)" path)
> +       (string-match "/cygdrive/\\(.\\)\\(.*\\)" path))
> +      (concat (match-string 1 path) ":" (match-string 2 path))
> +    path))

I think your regexps are dangerously unsafe: they match "//foo" and
"/cygdrive/foo/bar", for example.  This will be especially annoying on
Unix, if someone happens to hit these magic file names (since the call
to dirtrack-path-to-standard is unconditional).  But even on a DOSish
system this could bite someone, as nothing prevents a naive user from
creating a /cygdrive directory, even if Cygwin is not installed.

I think you need to make sure there's a single drive letter there,
followed by a slash, and also that the drive letter is in the [A-Za-z]
range.  And even then, this should not be called on anything but
ms-dos and windows-nt systems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]