projectile icon indicating copy to clipboard operation
projectile copied to clipboard

Failing to get project root for remote projects … sometimes

Open sellout opened this issue 2 years ago • 1 comments

Expected behavior

(projectile-compile-project) executes successfully

Actual behavior

I get an error

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-remote-p(nil)
  (not (file-remote-p dir))
  (let ((meh (message "Remote-p dir: %S" dir)) (is-local (not (file-remote-p dir))) (is-connected (file-remote-p dir nil t))) (if (or is-local is-connected) nil 'none))
  (or (let* […]))
  projectile-project-root(nil)
  projectile-acquire-root()
  projectile-read-command("Compile command: " "make")
  projectile-maybe-read-command(nil "make" "Compile command: ")
  projectile--run-project-cmd("make" #<hash-table equal 1/65 0xb0afac7f> :show-prompt nil :prompt-prefix "Compile command: " :save-buffers t :use-comint-mode nil)
  projectile-compile-project(nil)

I added some debugging output to projectile-project-root to print my default-directory, so when I call it from the project I get

Initial dir: nil
Updated dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Remote-p dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"

where “Updated” is after default-directory has been assigned to the dir. That matches what I expect (although (projectile-project-root) still returns nil here, and I don’t know why yet.

When I call projectile-compile-project, however, I get the following output:

Initial dir: nil
Updated dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Remote-p dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Initial dir: nil
Updated dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Remote-p dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Initial dir: nil
Updated dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Remote-p dir: "/ssh:esarhaddon:/home/greg/Projects/ECC/zcash/tx-builder-take-3/"
Initial dir: nil
Updated dir: nil
Remote-p dir: nil

So, projectile-project-root called four times (presumably the value should be cached after the first time – but the failure cache entry isn’t there, since it’s still printing the third output which should be after the cache lookup). The last time it’s called, default-directory is nil, and that call to (file-remote-p nil) is what ultimately errors.

Steps to reproduce the problem

I’m not sure yet. It works for days, then this happens. I’m trying to deduce what’s going wrong, but wanted to open this so that I have a place to put updates (and maybe it sounds familiar in some way).

Environment & Version information

Projectile version information

Projectile 20221118.1035

Emacs version

GNU Emacs 28.2 (build 1, aarch64-apple-darwin22.3.0, NS appkit-2299.40 Version 13.2 (Build 22D49))

Operating system

MacOS Ventura 13.2.1

sellout avatar Mar 08 '23 21:03 sellout

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed soon if no further activity occurs. Thank you for your contribution and understanding!

github-actions[bot] avatar Feb 01 '25 01:02 github-actions[bot]