Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file-missing "Setting current directory" "No such file or directory" #1302

Closed
manuel-uberti opened this issue Oct 1, 2018 · 17 comments
Closed
Labels

Comments

@manuel-uberti
Copy link

manuel-uberti commented Oct 1, 2018

Expected behavior

projectile-find-file lets me browse my project files.

Actual behavior

Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "/home/manuel/7bridges/code/gaypa-docs/conf/docker/...")
  call-process("/bin/bash" nil t nil "-c" "git submodule --quiet foreach 'echo $path' | tr '\\...")
  call-process-shell-command("git submodule --quiet foreach 'echo $path' | tr '\\..." nil t)
  #f(compiled-function (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any.\nWith prefix argument, insert the COMMAND's output at point.\n\nInteractively, prompt for COMMAND in the minibuffer.\n\nIf COMMAND ends in `&', execute it asynchronously.\nThe output appears in the buffer `*Async Shell Command*'.\nThat buffer is in shell mode.  You can also use\n`async-shell-command' that automatically adds `&'.\n\nOtherwise, COMMAND is executed synchronously.  The output appears in\nthe buffer `*Shell Command Output*'.  If the output is short enough to\ndisplay in the echo area (which is determined by the variables\n`resize-mini-windows' and `max-mini-window-height'), it is shown\nthere, but it is nonetheless available in buffer `*Shell Command\nOutput*' even though that buffer is not automatically displayed.\n\nTo specify a coding system for converting non-ASCII characters\nin the shell command output, use \\[universal-coding-system-argument] before this command.\n\nNoninteractive callers can specify coding systems by binding\n`coding-system-for-read' and `coding-system-for-write'.\n\nThe optional second argument OUTPUT-BUFFER, if non-nil,\nsays to put the output in some other buffer.\nIf OUTPUT-BUFFER is a buffer or buffer name, erase that buffer\nand insert the output there; a non-nil value of\n`shell-command-dont-erase-buffer' prevents the buffer from being\nerased.  If OUTPUT-BUFFER is not a buffer and not nil, insert the\noutput in current buffer after point leaving mark after it.  This\ncannot be done asynchronously.\n\nIf the command terminates without error, but generates output,\nand you did not specify \"insert it in the current buffer\",\nthe output can be displayed in the echo area or in its buffer.\nIf the output is short enough to display in the echo area\n(determined by the variable `max-mini-window-height' if\n`resize-mini-windows' is non-nil), it is shown there.\nOtherwise, the buffer containing the output is displayed.\n\nIf there is output and an error, and you did not specify \"insert it\nin the current buffer\", a message about the error goes at the end\nof the output.\n\nIf the optional third argument ERROR-BUFFER is non-nil, it is a buffer\nor buffer name to which to direct the command's standard error output.\nIf it is nil, error output is mingled with regular output.\nIn an interactive call, the variable `shell-command-default-error-buffer'\nspecifies the value of ERROR-BUFFER.\n\nIn Elisp, you will often be better served by calling `call-process' or\n`start-process' directly, since they offer more control and do not\nimpose the use of a shell (with its need to quote arguments)." (interactive #f(compiled-function () #<bytecode 0x2de6b45>)) #<bytecode 0x24f6ad>)("git submodule --quiet foreach 'echo $path' | tr '\\..." t nil)
  shell-command--shell-command-with-editor-mode(#f(compiled-function (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any.\nWith prefix argument, insert the COMMAND's output at point.\n\nInteractively, prompt for COMMAND in the minibuffer.\n\nIf COMMAND ends in `&', execute it asynchronously.\nThe output appears in the buffer `*Async Shell Command*'.\nThat buffer is in shell mode.  You can also use\n`async-shell-command' that automatically adds `&'.\n\nOtherwise, COMMAND is executed synchronously.  The output appears in\nthe buffer `*Shell Command Output*'.  If the output is short enough to\ndisplay in the echo area (which is determined by the variables\n`resize-mini-windows' and `max-mini-window-height'), it is shown\nthere, but it is nonetheless available in buffer `*Shell Command\nOutput*' even though that buffer is not automatically displayed.\n\nTo specify a coding system for converting non-ASCII characters\nin the shell command output, use \\[universal-coding-system-argument] before this command.\n\nNoninteractive callers can specify coding systems by binding\n`coding-system-for-read' and `coding-system-for-write'.\n\nThe optional second argument OUTPUT-BUFFER, if non-nil,\nsays to put the output in some other buffer.\nIf OUTPUT-BUFFER is a buffer or buffer name, erase that buffer\nand insert the output there; a non-nil value of\n`shell-command-dont-erase-buffer' prevents the buffer from being\nerased.  If OUTPUT-BUFFER is not a buffer and not nil, insert the\noutput in current buffer after point leaving mark after it.  This\ncannot be done asynchronously.\n\nIf the command terminates without error, but generates output,\nand you did not specify \"insert it in the current buffer\",\nthe output can be displayed in the echo area or in its buffer.\nIf the output is short enough to display in the echo area\n(determined by the variable `max-mini-window-height' if\n`resize-mini-windows' is non-nil), it is shown there.\nOtherwise, the buffer containing the output is displayed.\n\nIf there is output and an error, and you did not specify \"insert it\nin the current buffer\", a message about the error goes at the end\nof the output.\n\nIf the optional third argument ERROR-BUFFER is non-nil, it is a buffer\nor buffer name to which to direct the command's standard error output.\nIf it is nil, error output is mingled with regular output.\nIn an interactive call, the variable `shell-command-default-error-buffer'\nspecifies the value of ERROR-BUFFER.\n\nIn Elisp, you will often be better served by calling `call-process' or\n`start-process' directly, since they offer more control and do not\nimpose the use of a shell (with its need to quote arguments)." (interactive #f(compiled-function () #<bytecode 0x11bf99d>)) #<bytecode 0x24f6ad>) "git submodule --quiet foreach 'echo $path' | tr '\\..." t)
  apply(shell-command--shell-command-with-editor-mode #f(compiled-function (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any.\nWith prefix argument, insert the COMMAND's output at point.\n\nInteractively, prompt for COMMAND in the minibuffer.\n\nIf COMMAND ends in `&', execute it asynchronously.\nThe output appears in the buffer `*Async Shell Command*'.\nThat buffer is in shell mode.  You can also use\n`async-shell-command' that automatically adds `&'.\n\nOtherwise, COMMAND is executed synchronously.  The output appears in\nthe buffer `*Shell Command Output*'.  If the output is short enough to\ndisplay in the echo area (which is determined by the variables\n`resize-mini-windows' and `max-mini-window-height'), it is shown\nthere, but it is nonetheless available in buffer `*Shell Command\nOutput*' even though that buffer is not automatically displayed.\n\nTo specify a coding system for converting non-ASCII characters\nin the shell command output, use \\[universal-coding-system-argument] before this command.\n\nNoninteractive callers can specify coding systems by binding\n`coding-system-for-read' and `coding-system-for-write'.\n\nThe optional second argument OUTPUT-BUFFER, if non-nil,\nsays to put the output in some other buffer.\nIf OUTPUT-BUFFER is a buffer or buffer name, erase that buffer\nand insert the output there; a non-nil value of\n`shell-command-dont-erase-buffer' prevents the buffer from being\nerased.  If OUTPUT-BUFFER is not a buffer and not nil, insert the\noutput in current buffer after point leaving mark after it.  This\ncannot be done asynchronously.\n\nIf the command terminates without error, but generates output,\nand you did not specify \"insert it in the current buffer\",\nthe output can be displayed in the echo area or in its buffer.\nIf the output is short enough to display in the echo area\n(determined by the variable `max-mini-window-height' if\n`resize-mini-windows' is non-nil), it is shown there.\nOtherwise, the buffer containing the output is displayed.\n\nIf there is output and an error, and you did not specify \"insert it\nin the current buffer\", a message about the error goes at the end\nof the output.\n\nIf the optional third argument ERROR-BUFFER is non-nil, it is a buffer\nor buffer name to which to direct the command's standard error output.\nIf it is nil, error output is mingled with regular output.\nIn an interactive call, the variable `shell-command-default-error-buffer'\nspecifies the value of ERROR-BUFFER.\n\nIn Elisp, you will often be better served by calling `call-process' or\n`start-process' directly, since they offer more control and do not\nimpose the use of a shell (with its need to quote arguments)." (interactive #f(compiled-function () #<bytecode 0x10e4cb9>)) #<bytecode 0x24f6ad>) ("git submodule --quiet foreach 'echo $path' | tr '\\..." t))
  shell-command("git submodule --quiet foreach 'echo $path' | tr '\\..." t)
  shell-command-to-string("git submodule --quiet foreach 'echo $path' | tr '\\...")
  projectile-files-via-ext-command("/home/manuel/7bridges/code/gaypa-docs/conf/docker/..." "git submodule --quiet foreach 'echo $path' | tr '\\...")
  projectile-get-immediate-sub-projects("/home/manuel/7bridges/code/gaypa-docs/conf/docker/...")
  projectile-get-all-sub-projects("/home/manuel/7bridges/code/gaypa-docs/conf/docker/...")
  #f(compiled-function (s) #<bytecode 0x222a845>)("/home/manuel/7bridges/code/gaypa-docs/conf/docker/...")
  mapcar(#f(compiled-function (s) #<bytecode 0x222a845>) ("/home/manuel/7bridges/code/gaypa-docs/conf/docker/..."))
  projectile-get-all-sub-projects("/home/manuel/7bridges/code/gaypa-docs/")
  projectile-get-sub-projects-files("/home/manuel/7bridges/code/gaypa-docs/" git)
  projectile-dir-files-external("/home/manuel/7bridges/code/gaypa-docs/")
  projectile-dir-files("/home/manuel/7bridges/code/gaypa-docs/" "/home/manuel/7bridges/code/gaypa-docs/")
  #f(compiled-function (dir) #<bytecode 0x2172989>)("/home/manuel/7bridges/code/gaypa-docs/")
  mapcan(#f(compiled-function (dir) #<bytecode 0x2172989>) ("/home/manuel/7bridges/code/gaypa-docs/"))
  cl-mapcan(#f(compiled-function (dir) #<bytecode 0x2172989>) ("/home/manuel/7bridges/code/gaypa-docs/"))
  projectile-project-files("/home/manuel/7bridges/code/gaypa-docs/")
  projectile-current-project-files()
  counsel-projectile-find-file(nil)
  funcall-interactively(counsel-projectile-find-file nil)
  call-interactively(counsel-projectile-find-file nil nil)
  command-execute(counsel-projectile-find-file)

Steps to reproduce the problem

Given a project with at least a Git submodule in it, run projectile-find-file.

Environment & Version information

GNU Emacs 27.0.50 (build 1, x86_64-debian-linux-gnu, GTK+ Version 3.22.30)
 of 2018-10-01

Repository revision: 87d0007499d8434f40926c99f1edc3c4a700a79d
Configured using:
--host=x86_64-debian-linux-gnu --with-modules

Emacs uptime: 11 minutes, 27 seconds
Colour theme: sanityinc-tomorrow-night
Operating system: Ubuntu 18.04.1 LTS
Window system: x11
Desktop environment: GNOME Shell 3.28.3

Projectile version information

Projectile 20180930.1853
@manuel-uberti
Copy link
Author

manuel-uberti commented Oct 1, 2018

Further info. If I run the command specified in projectile-git-submodule-command via the command line, I get:

~/7bridges/code/gaypa-docs/docker dev* 
❯ git submodule --quiet foreach 'echo $path' | tr '\\n' '\\0'
rest-api-explorer

Which is correct.

@bbatsov bbatsov added the Bug label Oct 1, 2018
@bbatsov
Copy link
Owner

bbatsov commented Oct 1, 2018

I likely broke this during my massive round of refactoring over the weekend. I try to investigate it later this week. My assumption is that some default-directory binding I deleted was probably required for this to work. I've been trying to reduce the need for dynamic var bindings and make the API more in line with modern development practices (explicit param passing everywhere). Unfortunately the codebase is relatively big and dynamic bindings were used pretty much everywhere for a very long time...

@bbatsov
Copy link
Owner

bbatsov commented Oct 1, 2018

Might be a good idea to step through the code and see what's the default-directory when this shell-command gets executed.

DamienCassou added a commit to DamienCassou/projectile that referenced this issue Oct 2, 2018
The call to `projectile-files-ext-command` returns filenames relative
to the project root, not to the current directory.
@DamienCassou
Copy link
Contributor

Please check if PR #1308 fixes your issue.

@bbatsov bbatsov closed this as completed in f78c8c9 Oct 2, 2018
@manuel-uberti
Copy link
Author

Thanks @DamienCassou, it works fine now.

@altschuler
Copy link

I'm having a very similar issue. Error given is this

In ‘Projectile files’ source: ‘#[0 \301 \205;r\302!\203\206p\211q\210\303 \304 \305\211:\2036@\262\306"BB\262A\262\202\211\237\266\204)\207 [helm-current-buffer projectile-project-p buffer-live-p projectile-project-root projectile-current-project-files nil expand-file-name] 8]’ 
 (file-error "Setting current directory" "No such file or directory" "<path-to-project-root>/’tr’ is not recognized as an internal or external command,
operable program or batch file.
/")

Backtrace is hard to copy here since it clears everytime I try to focus on the buffer, but the gist of it is that it happens in process-file -> shell-command-to-string -> projectile-files-via-ext-command -> projectile-get-immediate-sub-projects -> projectile-get-all-sub-projects -> projectile-get-sub-projects-files -> ....

It seems that projectile is not finding tr (works fine in a PowerShell terminal), and the error message it gets from that is being used as a file name.

I've tried the above fix but to no avail (it's possible I'm doing something wrong, just edited the file manually and byte compiled the file). I also tried removing the tr pipe, but no luck either.

I'm on Windows 10 and using spacemacs.

@timav
Copy link

timav commented Oct 17, 2018

After trying M-x projectile-find-file I get

apply: Setting current directory: No such file or directory, /home/tima/build/the_silver_searcher/bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

The path "/home/tima/build/the_silver_searcher/bash" is, indeed, incorrect: "bash" is added to the root of the project.

projectile-20181015.1723

@didibus
Copy link

didibus commented Oct 29, 2018

This doesn't seem to be fixed for me with Projectile 20181028.838 in GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30

Running on Windows 10.

I get error:

apply: Setting current directory: No such file or directory, c:/workplace/logic/'tr' is not recognized as an internal or external command, operable program or batch file.apply: Setting current directory: No such file or directory, c:/workplace/logic/'tr' is not recognized as an internal or external command, operable program or batch file.

When running projectile-find-file or counsel-projectile-switch-project.

@altschuler
Copy link

As a workaround, set projectile-git-submodule-command to nil.

@cmatzenbach
Copy link

cmatzenbach commented Nov 2, 2018

I (emacs user) was helping my co-worker setup spacemacs for the first time, and we were getting the error in a project without submodules. @altschuler fix above worked perfectly, thanks for saving my sanity

@seagle0128
Copy link

I am experiencing the same issue on Windows 10 with GNU Emacs 26.1.

apply: Setting current directory: No such file or directory, c:/Users/admin/AppData/Roaming/.emacs.d/error: no program name specified.

and M-x counsel-projectile-find-file got this error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("^/tmp_mnt/" nil)
  abbreviate-file-name(nil)
  projectile-locate-dominating-file(nil ".git")
  projectile-project-vcs()
  projectile-get-repo-files()
  projectile-dir-files-external(nil "")
  projectile-dir-files(nil "")
  #f(compiled-function (dir) #<bytecode 0x3105c81>)("")
  mapcan(#f(compiled-function (dir) #<bytecode 0x3105c81>) (""))
  cl-mapcan(#f(compiled-function (dir) #<bytecode 0x3105c81>) (""))
  projectile-project-files(nil)
  projectile-current-project-files()
  counsel-projectile-find-file(nil)
  funcall-interactively(counsel-projectile-find-file nil)
  call-interactively(counsel-projectile-find-file nil nil)
  command-execute(counsel-projectile-find-file)

seagle0128 added a commit to seagle0128/.emacs.d that referenced this issue Nov 19, 2018
@seagle0128
Copy link

Confirm: the issue disappear in the latest version. And the workaround (setq projectile-git-submodule-command nil) works as well.

@jueqingsizhe66
Copy link

Confirm: the issue disappear in the latest version. And the workaround (setq projectile-git-submodule-command nil) works as well.

It works on Windows 10 with GNU Emacs 25.3

@dstcruz
Copy link

dstcruz commented Mar 8, 2019

Confirm: the issue disappear in the latest version. And the workaround (setq projectile-git-submodule-command nil) works as well.

It works on Windows 10 with GNU Emacs 25.3

Do you have tr installed on Windows 10 somehow? I'm still seeing the issue.

@jmromer
Copy link
Contributor

jmromer commented Mar 11, 2019

I'm possibly seeing an upstream issue here, but the (setq projectile-git-submodule-command nil) workaround is effective:

git submodule --quiet foreach 'echo $path' | tr '\\n' '\\0'
# GNU gettext shell script function library version 0.19.8.1
# Usage: . gettext.sh
git submodule 
# GNU gettext shell script function library version 0.19.8.1
# Usage: . gettext.sh

git --version
# git version 2.21.0

gettext --version
# gettext (GNU gettext-runtime) 0.19.8.1
# Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc.

Update:

Worked around this issue without setting (setq projectile-git-submodule-command nil) by installing gettext using homebrew and adding it to PATH:

% brew install gettext
% export PATH="/usr/local/opt/gettext/bin:$PATH"

% git submodule
 3f2bb2d2401cf5876fc2d806ecab462984619a79 home/spacemacs.d/layers/w3m (heads/master)
 734d9a11b5a6354e6a66e152dee5d311233e033c home/vim/vim-plug (0.9.1-84-g734d9a1)
 9a06c28ddc2c6efbabc0e4d5806d89b0d63c8b8e home/zsh/zsh-syntax-highlighting (0.6.0-223-g9a06c28)

🤔

@lexnewgate
Copy link

Confirm: the issue disappear in the latest version. And the workaround (setq projectile-git-submodule-command nil) works as well.

It works on Windows 10 with GNU Emacs 25.3

Do you have tr installed on Windows 10 somehow? I'm still seeing the issue.

I install tr by install gitforWin.

@Ethergeist
Copy link

@jmromer 's solution of adding gettext to the path worked for me in the current spacemacs develop branch. (I'm also on OSX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests