1

I am running emacs 27.2 on Windows 10.

When I execute the rgrep function, after inserting my choices for REGEXP, FILES and DIR, it hangs.

I have set the variable debug-on-entry and here's what I get:

Debugger entered--Lisp error: (quit)
  call-process("find" nil nil nil "NUL" "-ls")
  apply(call-process "find" nil nil nil ("NUL" "-ls"))
  process-file("find" nil nil nil "NUL" "-ls")
  #f(compiled-function () #<bytecode 0x7e7e8290fd>)()
  funcall(#f(compiled-function () #<bytecode 0x7e7e8290fd>))
  eval((funcall #'#f(compiled-function () #<bytecode 0x7e7e8290fd>)))
  custom-initialize-reset(find-ls-option (funcall #'#f(compiled-function () #<bytecode 0x7e7e8290fd>)))
  custom-declare-variable(find-ls-option (funcall #'#f(compiled-function () #<bytecode 0x7e7e8290fd>)) "A pair of options to produce and parse an `ls -l'-..." :version "27.1" :type (choice (cons :tag "find -ls" (string "-ls") (string "-dilsb")) (cons :tag "find -exec ls -ld" (string "-exec ls -ld {} +") (string "-ld")) (cons :tag "find -print | sort | xargs" (string "-print0 | sort -z | xargs -0 -e ls -ld") (string "-ld")) (cons :tag "Other values" (string :tag "Find Option") (string :tag "Ls Switches"))) :group find-dired)
  byte-code("\303\304\305\306\307DD\310\311\312\313\314\315\316\317\320\10@D\320\10AD\257\5\315\316\321\320\11@D\320\11AD\257\5\315\316\322\320\n@D\320\nAD\257..." [find-ls-option-default-ls find-ls-option-default-exec find-ls-option-default-xargs custom-declare-variable find-ls-option funcall function #f(compiled-function () #<bytecode 0x7e7e8290fd>) "A pair of options to produce and parse an `ls -l'-..." :version "27.1" :type choice cons :tag "find -ls" string "find -exec ls -ld" "find -print | sort | xargs" ((cons :tag "Other values" (string :tag "Find Option") (string :tag "Ls Switches"))) :group find-dired find-ls-subdir-switches #f(compiled-function () #<bytecode 0x7e7e83b00d>) "`ls' switches for inserting subdirectories in `*Fi..." "24.1" find-grep-options #f(compiled-function () #<bytecode 0x7e7e83e03d>) "Option to grep to be as silent as possible.\nOn Ber..." find-name-arg #f(compiled-function () #<bytecode 0x7e7e83e3d9>) "Argument used to specify file name pattern.\nIf `re..." "22.2" find-dired-refine-function #f(compiled-function () #<bytecode 0x7e7e402999>) "If non-nil, a function for refining the *Find* buf..." (choice (const :tag "Sort file names lexicographically" find-dired-sort-by-filename) (function :tag "Refining function") (const :tag "No refining" nil))] 16)
  require(find-dired)
  rgrep-default-command("COEX" "*.[ch]" nil)
  rgrep("COEX" "*.[ch]" "~/Workspace/dev/FW/FW/FW/" nil)
  funcall-interactively(rgrep "COEX" "*.[ch]" "~/Workspace/dev/FW/FW/FW/" nil)
  call-interactively(rgrep nil nil)
  command-execute(rgrep)

REGEX being "COEX", FILES being "*.[ch]" and "~/Workspace/dev/FW/FW/FW/" being DIR.

Under the hood, I am using some GnuWin32 utilities, including find and grep.

Here's the backtrace for M-x load-library RET find-dired.el RET with debug-on-quit set

Debugger entered--Lisp error: (quit)
  call-process("find" nil nil nil "NUL" "-ls")
  apply(call-process "find" nil nil nil ("NUL" "-ls"))
  process-file("find" nil nil nil "NUL" "-ls")
  (progn (process-file find-program nil nil nil null-device "-ls"))
  (condition-case nil (progn (process-file find-program nil nil nil null-device "-ls")) (error nil))
  (eq 0 (condition-case nil (progn (process-file find-program nil nil nil null-device "-ls")) (error nil)))
  (if (eq 0 (condition-case nil (progn (process-file find-program nil nil nil null-device "-ls")) (error nil))) find-ls-option-default-ls find-ls-option-default-exec)
  (closure (t) nil (if (eq 0 (condition-case nil (progn (process-file find-program nil nil nil null-device "-ls")) (error nil))) find-ls-option-default-ls find-ls-option-default-exec))()
  funcall((closure (t) nil (if (eq 0 (condition-case nil (progn (process-file find-program nil nil nil null-device "-ls")) (error nil))) find-ls-option-default-ls find-ls-option-default-exec)))
  eval((funcall #'(closure (t) nil (if (eq 0 (condition-case nil (progn ...) (error nil))) find-ls-option-default-ls find-ls-option-default-exec))))
  custom-initialize-reset(find-ls-option (funcall #'(closure (t) nil (if (eq 0 (condition-case nil (progn ...) (error nil))) find-ls-option-default-ls find-ls-option-default-exec))))
  custom-declare-variable(find-ls-option (funcall #'(closure (t) nil (if (eq 0 (condition-case nil (progn ...) (error nil))) find-ls-option-default-ls find-ls-option-default-exec))) "A pair of options to produce and parse an `ls -l'-..." :version "27.1" :type (choice (cons :tag "find -ls" (string "-ls") (string "-dilsb")) (cons :tag "find -exec ls -ld" (string "-exec ls -ld {} +") (string "-ld")) (cons :tag "find -print | sort | xargs" (string "-print0 | sort -z | xargs -0 -e ls -ld") (string "-ld")) (cons :tag "Other values" (string :tag "Find Option") (string :tag "Ls Switches"))) :group find-dired)
  eval-buffer(#<buffer  *load*> nil "c:/Program Files/emacs-27.2/share/emacs/27.2/lisp/find-dired.el" nil t)  ; Reading at buffer position 3906
  load-with-code-conversion("c:/Program Files/emacs-27.2/share/emacs/27.2/lisp/find-dired.el" "c:/Program Files/emacs-27.2/share/emacs/27.2/lisp/..." nil nil)
  load("find-dired.el")
  load-library("find-dired.el")
  funcall-interactively(load-library "find-dired.el")
  call-interactively(load-library record nil)
  command-execute(load-library record)
  execute-extended-command(nil "load-library" "load-li")
  funcall-interactively(execute-extended-command nil "load-library" "load-li")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Not sure where things are going wrong. Can anyone help?

7
  • Between the rgrep call and the process-file call, things have gone wonky. I would (naively - haven't really checked) have expected the call-process line to look something like this: call-process("find" nil <some-buffer> "/path/to/Workspace/dev/FW/FW/FW" "*.el" "-ls"). Have you tried with emacs -q thereby bypassing your init file? Maybe you are doing something in the init file to cause the wonkiness.
    – NickD
    Feb 22, 2022 at 17:27
  • I get the same output from the debugger with runemacs -q
    – Stefano
    Feb 22, 2022 at 17:37
  • Also find-grep works, even if I edit the command to be what it should be with rgrep, that is find . -type f -name "*.[ch]" -exec grep --color=always -nH --null -e COEX "{}"
    – Stefano
    Feb 22, 2022 at 17:43
  • 1
    Is the find command that it's picking up the MS Windows find command, perhaps? That's a common problem. (I didn't look at your question closely - just mentioning this in case it's relevant.)
    – Drew
    Feb 22, 2022 at 22:43
  • 1
    I have added the backtrace in the post as output is too long for comment
    – Stefano
    Feb 23, 2022 at 10:54

1 Answer 1

1

Looks like find . -ls (using GnuWin32 find version 4.2.20) hangs. I workaround that issue by using ezwinports find.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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