all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: John Magolske <listmail@b79.net>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: counsel-dired-jump error "find: paths must precede expression:"
Date: Thu, 18 Jan 2018 13:46:48 +0700	[thread overview]
Message-ID: <CAP_d_8UivNveBbvgaUydhNddPQYPNsFcHOBs9iWP+_pJdNfQFA@mail.gmail.com> (raw)
In-Reply-To: <20180118023907.ccrcmi6gizigzhr6@s70206.gridserver.com>

On Thu, Jan 18, 2018 at 9:39 AM, John Magolske <listmail@b79.net> wrote:
> When issuing the command counsel-dired-jump from some directories I'll
> get this error message:
>
>     find: paths must precede expression: A1
>     Try 'find --help' for more information.
>
> yet from other directories the command works fine, allowing fuzzy
> searching for a directory to open dired at. I can't sort out why
> this error message comes up in some directories and not others...

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.

For example, on my system the following example breaks with the
message you quoted:

    ~$ mkdir /tmp/foo
    ~$ cd /tmp/foo
    /tmp/foo$ touch -- ! A1
    /tmp/foo$ echo *
    !  A1
    /tmp/foo$ find * -type d -not -path '*/.git*'
    find: paths must precede expression: A1

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



  reply	other threads:[~2018-01-18  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18  2:39 counsel-dired-jump error "find: paths must precede expression:" John Magolske
2018-01-18  6:46 ` Yuri Khan [this message]
2018-01-19  8:13   ` John Magolske
2018-01-19  9:47     ` Robert Pluim
2018-01-19 10:11       ` tomas
2018-01-19 10:07     ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8UivNveBbvgaUydhNddPQYPNsFcHOBs9iWP+_pJdNfQFA@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=listmail@b79.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.