I tried.

$ find . -name .git -type d -execdir git pull {};
find: The relative path ‘%ANDROID_HOME%/tools’ is
included in the PATH environment variable,
which is insecure in combination with the
-execdir action of find.  Please remove that entry from $PATH

How can I solve this?

  • 1
    1. You should use '*.git' with -iname. 2. Your PATH shouldn't have %ANDROID_HOME% - that's a Windows variable. – muru Feb 7 '16 at 19:23
  • @muru Sorry, cygwin tag added. – Jin Kwon Feb 7 '16 at 19:24

Replace ; with + at the end.

From the manpage:

   -execdir command {} +
          Like -exec, but the specified command is run from the subdirectory  containing
          the  matched  file,  which  is not normally the directory in which you started
          find.  This a much more secure method for invoking commands, as it avoids race
          conditions  during  resolution of the paths to the matched files.  As with the
          -exec action, the `+' form of -execdir will build a command  line  to  process
          more than one matched file, but any given invocation of command will only list
          files that exist in the same subdirectory.  If you use this option,  you  must
          ensure that your $PATH environment variable does not reference `.'; otherwise,
          an attacker can run any commands they like by leaving  an  appropriately-named
          file  in a directory in which you will run -execdir.  The same applies to hav‐
          ing entries in $PATH which are empty  or  which  are  not  absolute  directory
          names.   If  find  encounters  an error, this can sometimes cause an immediate
          exit, so some pending commands may not be run at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.