Subject: 30.0.50; Two Eglot-over-Tramp tests are failing on master, passing on emacs-29
From: João Távora <[email-masked]>
To: [email-masked]
Date: Tue, 14 Mar 2023 23:08:17 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Michael,

I've noticd that these two Eglot tests are passing on emacs-29 but
failing on emacs master.  I haven't checked if this is due to your
recent work on Tramp or some other factor.

Sometimes one of the tests passes, but having the two of them pass is
rare.  In emacs-29, they always pass.  Both emacs-master and emacs-29
have the version of Eglot _with_ the ControlMaster-neutering workaround.

To reproduce, you need the "clangd" language server installed (which is
one of the easiest to get language servers, should be available in your
package manager).

Then:

   make -C test lisp/progmodes/eglot-tests SELECTOR=\"tramp\"

The error output is after my sig.  Let me know if you need more info.

João

make: Entering directory '/home/capitaomorte/Source/Emacs/emacs-master/test'
make[1]: Entering directory '/home/capitaomorte/Source/Emacs/emacs-master/test'
  GEN      lisp/progmodes/eglot-tests.log
Running 2 tests (2023-03-14 23:04:34+0000, selector ‘"tramp"’)
[eglot-tests] [eglot-test-tramp-test]: test start

[eglot] Connected! Server `clangd' now managing `(c-mode c-ts-mode c++-mode c++-ts-mode)' buffers in project `project'.

File error: Couldn’t find exit status of ‘\readlink --canonicalize-missing /tmp/eglot--fixturezQyQYv/project/merdix.c’

[eglot-tests] [eglot-test-tramp-test]: FAILED
[eglot] Asking EGLOT (project/(c-mode c-ts-mode c++-mode c++-ts-mode)) politely to terminate
[jsonrpc] Server exited with status 9
[eglot-tests] contents of ` *EGLOT (project/(c-mode c-ts-mode c++-mode c++-ts-mode)) output*':
[eglot-tests] contents of ` *EGLOT (project/(c-mode c-ts-mode c++-mode c++-ts-mode)) stderr*':
I[23:04:35.143] clangd version 15.0.7
I[23:04:35.143] Features: linux
I[23:04:35.143] PID: 251491
I[23:04:35.143] Working directory: /tmp/eglot--fixturezQyQYv/project
I[23:04:35.143] argv[0]: /usr/bin/clangd
I[23:04:35.143] Starting LSP over stdin/stdout
I[23:04:35.143] <-- initialize(1)
I[23:04:35.144] --> reply:initialize(1) 0 ms
I[23:04:35.145] <-- initialized
I[23:04:35.153] <-- textDocument/didOpen
I[23:04:35.153] <-- workspace/didChangeConfiguration
I[23:04:35.153] Failed to find compilation database for /tmp/eglot--fixturezQyQYv/project/coiso.c
I[23:04:35.153] ASTWorker building file /tmp/eglot--fixturezQyQYv/project/coiso.c version 0 with command clangd fallback
[/tmp/eglot--fixturezQyQYv/project]
/usr/bin/clang -resource-dir=/usr/lib/clang/15.0.7 -- /tmp/eglot--fixturezQyQYv/project/coiso.c
I[23:04:35.163] --> textDocument/publishDiagnostics
I[23:04:35.184] <-- textDocument/didOpen
I[23:04:35.184] Failed to find compilation database for /tmp/eglot--fixturezQyQYv/project/merdix.c
I[23:04:35.184] ASTWorker building file /tmp/eglot--fixturezQyQYv/project/merdix.c version 0 with command clangd fallback
[/tmp/eglot--fixturezQyQYv/project]
/usr/bin/clang -resource-dir=/usr/lib/clang/15.0.7 -- /tmp/eglot--fixturezQyQYv/project/merdix.c
I[23:04:35.194] --> textDocument/publishDiagnostics
I[23:04:35.274] <-- shutdown(2)
I[23:04:35.274] --> reply:shutdown(2) 0 ms
I[23:04:35.274] <-- exit
I[23:04:35.274] LSP finished, exiting with status 0
[eglot-tests] contents of `*EGLOT (project/(c-mode c-ts-mode c++-mode c++-ts-mode)) events*':
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] foo
[stderr] foo
[stderr] foo
[stderr] 
[stderr] foo
[stderr] bar
[stderr] nil
[stderr] bar
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] "/dev/pts/8"
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] "/dev/pts/8"
[stderr] 
[stderr] nil
[stderr] 
[stderr] nil
[stderr] 
[stderr] 251483
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] 251483
[stderr] 
[internal] Tue Mar 14 23:04:35 2023:
(:message "Running language server: /bin/sh -c stty raw > /dev/null; /usr/bin/clangd")
[client-request] (id:1) Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId nil :rootPath "/tmp/eglot--fixturezQyQYv/project/" :rootUri "file:///tmp/eglot--fixturezQyQYv/project" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																				  ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges t)
				   :didChangeWatchedFiles
				   (:dynamicRegistration :json-false)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t :workspaceFolders t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :resolveSupport
							       (:properties
								["documentation" "details" "additionalTextEdits"])
							       :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)
					       :activeParameterSupport t))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false :linkSupport t)
			:declaration
			(:dynamicRegistration :json-false :linkSupport t)
			:implementation
			(:dynamicRegistration :json-false :linkSupport t)
			:typeDefinition
			(:dynamicRegistration :json-false :linkSupport t)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
					      (:valueSet
					       [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
					      :isPreferredSupport t)
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:inlayHint
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :general
		       (:positionEncodings
			["utf-32" "utf-8" "utf-16"])
		       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))
		      :workspaceFolders
		      [(:uri "file:///tmp/eglot--fixturezQyQYv/project" :name "/mock:krug:/tmp/eglot--fixturezQyQYv/project/")]))
[stderr] I[23:04:35.143] clangd version 15.0.7
[stderr] I[23:04:35.143] Features: linux
[stderr] I[23:04:35.143] PID: 251491
[stderr] I[23:04:35.143] Working directory: /tmp/eglot--fixturezQyQYv/project
[stderr] I[23:04:35.143] argv[0]: /usr/bin/clangd
[stderr] I[23:04:35.143] Starting LSP over stdin/stdout
[stderr] I[23:04:35.143] <-- initialize(1)
[server-reply] (id:1) Tue Mar 14 23:04:35 2023:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:astProvider t :callHierarchyProvider t :clangdInlayHintsProvider t :codeActionProvider
		    (:codeActionKinds
		     ["quickfix" "refactor" "info"])
		    :compilationDatabase
		    (:automaticReload t)
		    :completionProvider
		    (:resolveProvider :json-false :triggerCharacters
				      ["." "<" ">" ":" "\"" "/" "*"])
		    :declarationProvider t :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentLinkProvider
		    (:resolveProvider :json-false)
		    :documentOnTypeFormattingProvider
		    (:firstTriggerCharacter "\n" :moreTriggerCharacter
					    [])
		    :documentRangeFormattingProvider t :documentSymbolProvider t :executeCommandProvider
		    (:commands
		     ["clangd.applyFix" "clangd.applyTweak"])
		    :hoverProvider t :implementationProvider t :inlayHintProvider t :memoryUsageProvider t :referencesProvider t :renameProvider t :selectionRangeProvider t :semanticTokensProvider
		    (:full
		     (:delta t)
		     :legend
		     (:tokenModifiers
		      ["declaration" "deprecated" "deduced" "readonly" "static" "abstract" "virtual" "dependentName" "defaultLibrary" "usedAsMutableReference" "functionScope" "classScope" "fileScope" "globalScope"]
		      :tokenTypes
		      ["variable" "variable" "parameter" "function" "method" "function" "property" "variable" "class" "interface" "enum" "enumMember" "type" "type" "unknown" "namespace" "typeParameter" "concept" "type" "macro" "comment"])
		     :range :json-false)
		    :signatureHelpProvider
		    (:triggerCharacters
		     ["(" ")" "{" "}" "<" ">" ","])
		    :standardTypeHierarchyProvider t :textDocumentSync
		    (:change 2 :openClose t :save t)
		    :typeDefinitionProvider t :typeHierarchyProvider t :workspaceSymbolProvider t)
      :serverInfo
      (:name "clangd" :version "clangd version 15.0.7 linux x86_64-pc-linux-gnu")))
[client-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[stderr] I[23:04:35.144] --> reply:initialize(1) 0 ms
[stderr] I[23:04:35.145] <-- initialized
[client-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/eglot--fixturezQyQYv/project/coiso.c" :version 0 :languageId "c" :text "bla")))
[client-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
				   ())))
[stderr] I[23:04:35.153] <-- textDocument/didOpen
[stderr] I[23:04:35.153] <-- workspace/didChangeConfiguration
[stderr] I[23:04:35.153] Failed to find compilation database for /tmp/eglot--fixturezQyQYv/project/coiso.c
[stderr] I[23:04:35.153] ASTWorker building file /tmp/eglot--fixturezQyQYv/project/coiso.c version 0 with command clangd fallback
[stderr] [/tmp/eglot--fixturezQyQYv/project]
[stderr] /usr/bin/clang -resource-dir=/usr/lib/clang/15.0.7 -- /tmp/eglot--fixturezQyQYv/project/coiso.c
[server-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   [(:code "unknown_typename" :message "Unknown type name 'bla'" :range
		   (:end
		    (:character 3 :line 0)
		    :start
		    (:character 0 :line 0))
		   :severity 1 :source "clang")
	    (:code "expected_either" :message "Expected identifier or '('" :range
		   (:end
		    (:character 3 :line 0)
		    :start
		    (:character 3 :line 0))
		   :severity 1 :source "clang")]
	   :uri "file:///tmp/eglot--fixturezQyQYv/project/coiso.c" :version 0))
[stderr] I[23:04:35.163] --> textDocument/publishDiagnostics
[client-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/eglot--fixturezQyQYv/project/merdix.c" :version 0 :languageId "c" :text "bla")))
[stderr] I[23:04:35.184] <-- textDocument/didOpen
[stderr] I[23:04:35.184] Failed to find compilation database for /tmp/eglot--fixturezQyQYv/project/merdix.c
[stderr] I[23:04:35.184] ASTWorker building file /tmp/eglot--fixturezQyQYv/project/merdix.c version 0 with command clangd fallback
[stderr] [/tmp/eglot--fixturezQyQYv/project]
[stderr] /usr/bin/clang -resource-dir=/usr/lib/clang/15.0.7 -- /tmp/eglot--fixturezQyQYv/project/merdix.c
[server-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   [(:code "unknown_typename" :message "Unknown type name 'bla'" :range
		   (:end
		    (:character 3 :line 0)
		    :start
		    (:character 0 :line 0))
		   :severity 1 :source "clang")
	    (:code "expected_either" :message "Expected identifier or '('" :range
		   (:end
		    (:character 3 :line 0)
		    :start
		    (:character 3 :line 0))
		   :severity 1 :source "clang")]
	   :uri "file:///tmp/eglot--fixturezQyQYv/project/merdix.c" :version 0))
[stderr] I[23:04:35.194] --> textDocument/publishDiagnostics
[client-request] (id:2) Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :id 2 :method "shutdown" :params nil)
[server-reply] (id:2) Tue Mar 14 23:04:35 2023:
(:id 2 :jsonrpc "2.0" :result nil)
[client-notification] Tue Mar 14 23:04:35 2023:
(:jsonrpc "2.0" :method "exit" :params nil)
[internal] Tue Mar 14 23:04:35 2023:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr] I[23:04:35.274] <-- shutdown(2)
[stderr] I[23:04:35.274] --> reply:shutdown(2) 0 ms
[stderr] I[23:04:35.274] <-- exit
[stderr] I[23:04:35.274] LSP finished, exiting with status 0
[eglot-tests] Killing (coiso.c merdix.c), wiping /mock:krug:/tmp/eglot--fixturezQyQYv, restoring nil
Test eglot-test-tramp-test backtrace:
  signal(wrong-type-argument ("listp /tmp/tramp.G0HtZ3"))
  tramp-error((tramp-file-name "mock" nil nil "krug" nil "/tmp/eglot--
  tramp-signal-hook-function(wrong-type-argument ("listp /tmp/tramp.G0
  signal(wrong-type-argument ("listp /tmp/tramp.G0HtZ3"))
  tramp-handle-insert-file-contents("/mock:krug:/tmp/eglot--fixturezQy
  apply(tramp-handle-insert-file-contents ("/mock:krug:/tmp/eglot--fix
  tramp-sh-file-name-handler(insert-file-contents "/mock:krug:/tmp/egl
  apply(tramp-sh-file-name-handler insert-file-contents ("/mock:krug:/
  tramp-file-name-handler(insert-file-contents "/mock:krug:/tmp/eglot-
  insert-file-contents("/mock:krug:/tmp/eglot--fixturezQyQYv/project/R
  vc-insert-file("/mock:krug:/tmp/eglot--fixturezQyQYv/project/RCS/m..
  vc-rcs-fetch-master-state("/mock:krug:/tmp/eglot--fixturezQyQYv/proj
  vc-rcs-state("/mock:krug:/tmp/eglot--fixturezQyQYv/project/merdi..."
  apply(vc-rcs-state "/mock:krug:/tmp/eglot--fixturezQyQYv/project/mer
  vc-call-backend(RCS state "/mock:krug:/tmp/eglot--fixturezQyQYv/proj
  vc-state-refresh("/mock:krug:/tmp/eglot--fixturezQyQYv/project/merdi
  vc-state("/mock:krug:/tmp/eglot--fixturezQyQYv/project/merdi..." RCS
  vc-rcs-find-file-hook()
  apply(vc-rcs-find-file-hook nil)
  vc-call-backend(RCS find-file-hook)
  vc-refresh-state()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<killed buffer> "/mock:krug:/tmp/eglot--fixtur
  find-file-noselect("project/merdix.c")
  eglot--find-file-noselect("project/merdix.c")
  (set-buffer (eglot--find-file-noselect "project/merdix.c"))
  (save-current-buffer (set-buffer (eglot--find-file-noselect "project
  (closure ((server . #<eglot-lsp-server eglot-lsp-server-15755b2a4d56
  funcall((closure ((server . #<eglot-lsp-server eglot-lsp-server-1575
  (prog1 (funcall fn) (setq test-body-successful-p t))
  (let* ((process-environment (append (list "XDG_CONFIG_HOME=/dev/null
  (unwind-protect (let* ((process-environment (append (list "XDG_CONFI
  (let* ((fixture-directory (make-nearby-temp-file "eglot--fixture" t)
  eglot--call-with-fixture((("project" ("coiso.c" . "bla") ("merdix.c"
  (let (server) (eglot--call-with-fixture '(("project" ("coiso.c" . "b
  eglot-tests--auto-detect-running-server-1()
  funcall(eglot-tests--auto-detect-running-server-1)
  (let* ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-
  eglot--call-with-tramp-test(eglot-tests--auto-detect-running-server-
  (closure (tramp-histfile-override company-candidates typescript-mode
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name eglot-test-tramp-test :documentation 
  ert-run-or-rerun-test(#s(ert--stats :selector "tramp" :tests ... :te
  ert-run-tests("tramp" #f(compiled-function (event-type &rest event-a
  ert-run-tests-batch("tramp")
  ert-run-tests-batch-and-exit("tramp")
  eval((ert-run-tests-batch-and-exit '"tramp") t)
  command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/progmodes/eglot-test
  command-line()
  normal-top-level()
Test eglot-test-tramp-test condition:
    (wrong-type-argument "listp /tmp/tramp.G0HtZ3")
   FAILED  1/2  eglot-test-tramp-test (0.744733 sec) at lisp/progmodes/eglot-tests.el:1285
[eglot-tests] [eglot-test-tramp-test-2]: test start

[eglot] Connected! Server `clangd' now managing `(c-mode)' buffers in project `project'.
[eglot-tests] waiting for `(should (equal 71 (cadddr (cadadr (aref (cadddr params) 0)))))'
[eglot-tests] detected: textDocument/didChange
[eglot-tests] [eglot-test-tramp-test-2]: OK
[eglot] Asking EGLOT (project/(c-mode)) politely to terminate
[jsonrpc] Server exited with status 9
[eglot-tests] Killing (foo.c), wiping /mock:krug:/tmp/eglot--fixtureQ3JgHX, restoring nil
File is missing: /mock:krug:/tmp/eglot--fixtureQ3JgHX/project/foo.c~
   passed  2/2  eglot-test-tramp-test-2 (0.618120 sec)

Ran 2 tests, 1 results as expected, 1 unexpected (2023-03-14 23:04:36+0000, 1.444125 sec)

1 unexpected results:
   FAILED  eglot-test-tramp-test

make[1]: *** [Makefile:174: lisp/progmodes/eglot-tests.log] Error 1
make[1]: Leaving directory '/home/capitaomorte/Source/Emacs/emacs-master/test'
make: *** [Makefile:240: lisp/progmodes/eglot-tests] Error 2
make: Leaving directory '/home/capitaomorte/Source/Emacs/emacs-master/test'