ananthakumaran / monky

Magit for Hg
http://ananthakumaran.in/monky/index.html
GNU General Public License v3.0
154 stars 30 forks source link

Running monky-status brings up "Removing old name: No such file or directory" #40

Closed bestchai closed 9 years ago

bestchai commented 9 years ago

I just installed monky.el from the latest in master (5e133). When I run monky-status from a buffer in dired mode pointed to a directory with an existing hg repo I get the following message:

call-process: Removing old name: No such file or directory, /var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file30190kB8

All of the other monky commands bring up the same message.

Platform: OSX 10.9.4, GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)

ananthakumaran commented 9 years ago

Can you post the stack trace. you can get it using toggle-debug-on-quit.

bestchai commented 9 years ago

Here it is:

Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "hg")
  call-process("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/emacs35463yDc") nil "--config" "diff.git=Off" "root")
  apply(call-process "hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/emacs35463yDc") nil ("--config" "diff.git=Off" "root"))
  process-file("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil "--config" "diff.git=Off" "root")
  apply(process-file ("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil "--config" "diff.git=Off" "root"))
  (let ((process-environment (append monky-hg-process-environment process-environment))) (apply (quote process-file) args))
  monky-process-file-single("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil "--config" "diff.git=Off" "root")
  apply(monky-process-file-single ("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil "--config" "diff.git=Off" "root"))
  monky-process-file("hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil "--config" "diff.git=Off" "root")
  apply(monky-process-file "hg" nil (t "/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/monky-temp-file35463l5V") nil ("--config" "diff.git=Off" "root"))
  (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args)))
  (if (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args))) nil (error (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents stderr) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
  (progn (if (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args))) nil (error (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents stderr) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (buffer-string))
  (unwind-protect (progn (if (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args))) nil (error (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))))) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args))) nil (error (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))))) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if (eq 0 (apply (function monky-process-file) monky-hg-executable nil (list t stderr) nil (append monky-hg-standard-options args))) nil (error (let (...) (save-current-buffer ... ...)))) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (save-current-buffer (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if (eq 0 (apply ... monky-hg-executable nil ... nil ...)) nil (error (let ... ...))) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  (progn (save-current-buffer (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if (eq 0 ...) nil (error ...)) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
  (unwind-protect (progn (save-current-buffer (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if ... nil ...) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (delete-file stderr))
  (let ((stderr (expand-file-name (make-temp-name "monky-temp-file") temporary-file-directory))) (unwind-protect (progn (save-current-buffer (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))))) (delete-file stderr)))
  monky-hg-output(("root"))
  (monky-trim-line (monky-hg-output args))
  monky-hg-string("root")
  (let ((root (monky-hg-string "root"))) (if root (concat root "/") (error "Not inside a hg repo")))
  monky-get-root-dir()
  (setq monky-root-dir (monky-get-root-dir))
  (let (monky-process monky-process-type) (setq monky-root-dir (monky-get-root-dir)))
  (if monky-root-dir nil (let (monky-process monky-process-type) (setq monky-root-dir (monky-get-root-dir))))
  monky-cmdserver-start()
  (setq monky-cmd-process (monky-cmdserver-start))
  (progn (setq monky-cmd-process (monky-cmdserver-start)))
  (if (and outer (eq monky-process-type (quote cmdserver))) (progn (setq monky-cmd-process (monky-cmdserver-start))))
  (let ((outer (not monky-cmd-process))) (if (and outer (eq monky-process-type (quote cmdserver))) (progn (setq monky-cmd-process (monky-cmdserver-start)))) (unwind-protect (progn (let* ((rootdir (or directory (monky-get-root-dir))) (buf (or (monky-find-status-buffer rootdir) (generate-new-buffer ...)))) (pop-to-buffer buf) (monky-mode-init rootdir (quote status) (function monky-refresh-status)) (monky-status-mode t))) (if (and monky-cmd-process outer (eq monky-process-type (quote cmdserver))) (progn (delete-process monky-cmd-process) (setq monky-cmd-process nil)))))
  monky-status()
  call-interactively(monky-status record nil)
  command-execute(monky-status record)
  execute-extended-command(nil "monky-status")
  call-interactively(execute-extended-command nil nil)
bestchai commented 9 years ago

Some more information:

I'm on OSX. I noticed that if I start emacs using open /Applications/Emacs.app, then monky works fine (i.e., I don't get the error above when I run monky-status). However, if I run emacs using the dock shortcut then monky fails with the above error.

This might be an environment vars issue. I checked emacs' initial-environment variable value and it's very stripped down for emacs when it is run from the dock, here it is:

("CHECKFIX1436934=1" "CF_USER_TEXT_ENCODING=0x1F5:0:0" "Apple_PubSub_Socket_Render=/tmp/launch-pATKtv/Render" "SSH_AUTH_SOCK=/tmp/launch-y1uMnH/Listeners" "LOGNAME=ivan" "USER=ivan" "HOME=/Users/ivan" "SHELL=/bin/bash" "TMPDIR=/var/folders/7n/p4x3tkhd4kj1krmdt18r3nhh0000gn/T/" "PATH=/usr/bin:/bin:/usr/sbin:/sbin")

Does monky rely on some of the env vars that are not in the above list? (I checked that the TMPDIR var value is identical between the two emacs instantiations).

ananthakumaran commented 9 years ago

Can you compare the exec-path between the two. Normally OSX starts gui applications with different PATH than the one in shell.

I use the following config to make sure the path is same irrespective of how you start emacs.

  ;; set the PATH properly
  (let* ((path (shell-command-to-string "/bin/zsh -c 'source ~/.zshrc && printf $PATH'")))
    (setenv "PATH" path)
    (mapc (lambda (p)
        (add-to-list 'exec-path p))
      (split-string path ":")))
bestchai commented 9 years ago

Perfect, thanks for the hint.

I resolved this with a slightly cleaner solution, using an exec-path-from-shell library: https://github.com/purcell/exec-path-from-shell