Skip to content

"Bad" project git repo leads to error in process sentinel: Wrong type argument: listp, fatal: #1156

@kjcjohnson

Description

@kjcjohnson

As soon as I start treemacs (M-x treemacs), I get an error in *Messages*:
error in process sentinel: Wrong type argument: listp, fatal:
After startup, everything seems to be mostly fine, though.

Treemacs: 20250423.2024
Emacs: GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23
OS: Windows 11 Pro (24H2)

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument listp fatal:)
  cdr(fatal:)
  #f(compiled-function (process status) #<bytecode -0xb89d3bbb9154c58>)(#<process  Pfuture-Callback (c:/Users/<user>/AppData/Local/Microsoft/WindowsApps/python3.exe -O c:/Users/<user>/AppData/Roaming/.emacs.d/elpa/treemacs-20250423.2024/treemacs-find-ignored-files.py git w:/Projects/project1 w:/Projects/project2)> "finished\n")
  accept-process-output(#<process Process Future<1>>)
  pfuture-await-to-finish(#<process Process Future<1>>)
  treemacs--parse-flattened-dirs("w:/project1" #<process Process Future<1>>)
  treemacs--expand-root-node(#<marker (moves after insertion) at 3 in  *Treemacs-Scoped-Buffer-#<frame  *Minibuf-1* - GNU Emacs at COMPUTER 0000029d14def970>*> nil)
  treemacs-toggle-node()
  treemacs--init()
  treemacs(nil)
  funcall-interactively(treemacs nil)
  command-execute(treemacs record)
  execute-extended-command(nil "treemacs" "treemacs")
  funcall-interactively(execute-extended-command nil "treemacs" "treemacs")
  command-execute(execute-extended-command)

I tracked it down to one project that git is complaining about:

PS W:\Projects\project2> git status
fatal: detected dubious ownership in repository at 'W:/Projects/project2'
'W:/Projects/project2' is owned by:
        <...redacted...>
but the current user is:
        <...redacted...>
To add an exception for this directory, call:

        git config --global --add safe.directory W:/Projects/project2

Obviously, I can just fix the git repo, but it would be nice if treemacs didn't throw a lisp error.

Looks like the script treemacs-find-ignored-files.py isn't noticing that the git call failed, and the git error message on STDERR is just being passed back into Emacs. Indeed, after poking around, the variable ignore-pairs is set to the symbol fatal: in treemacs--prefetch-gitignore-cache:

(let ((ignore-pairs (read (pfuture-callback-output)))

As a user, I'd like the script to check the git exit codes and, if any failed, dump the git error to *Messages* so it's visible. It could just ignore the errors, but that means there's presumably broken git functionality with the project in treemacs.

Note that treemacs is using git for Windows (which throws the dubious ownership error), while I normally use git in WSL, which does not throw the dubious ownership error for this repo. I think this is a decently common setup for Windows, and I never even saw the git error until I was troubleshooting treemacs!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions