help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: counsel-dired-jump error "find: paths must precede expression:"


From: John Magolske
Subject: Re: counsel-dired-jump error "find: paths must precede expression:"
Date: Fri, 19 Jan 2018 00:13:02 -0800
User-agent: NeoMutt/20170113 (1.7.2)

Thanks for the clarifying explanation,

* Yuri Khan <address@hidden> [180117 23:14]:
> The source of ‘counsel-dired-jump’:
> 
> https://github.com/abo-abo/swiper/blob/master/counsel.el#L2183
> 
> contains this expression:
> 
>     (shell-command-to-string
>       (concat find-program " * -type d -not -path '*\/.git*'"))
> 
> The * in the first argument will be expanded by the shell to a list of
> all files in the current directory, in unspecified order. If any of
> them happens to look like a ‘find’ option, ‘find’ will try to
> interpret it as one, with unintended consequences.

looking into this further, I found a quoted wildcard resolves the issue:

    (shell-command-to-string
     (concat find-program " -path './*' -type d -not -path '*\/.git*'"))

Seems to behave pretty much the same, except that all the directory
file-paths displayed in the minibuffer are now preceded with a ./

> [...]
>
> I was also able to cause data loss:
> 
>     ~$ mkdir /tmp/bar
>     ~$ cd /tmp/bar
>     /tmp/bar$ touch -- aaa bbb ccc -delete
>     /tmp/bar$ ls
>     aaa  bbb  ccc  -delete
>     /tmp/bar$ find * -type d -not -path '*/.git*'
>     /tmp/bar$ ls
>     -delete


-- 
John Magolske
http://b79.net/contact



reply via email to

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