Subject: Re: bug#36940: tests slowness and failure after recent Tramp changes

From: Michael Albinus <[email-masked]>
Date: Mon, 26 Aug 2019 13:47:02 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> The error happens while searching in a process buffer, which is set properly:
>>
>> 14:40:39.573073 tramp-open-connection-setup-interactive-shell (5) #
>> Setting coding system to `utf-8-hfs' and `utf-8-hfs-mac'
>>
>> But the search string needs to be normalized as proposed by you. Will do.
>
> Sorry for bothering you, but now I am confused.  If the process
> buffer's contents is decoded with utf-8-hfs, then decoding should have
> composed the characters back, I believe.  So the text to be searched
> in the buffer should use the precomposed character U+03AF GREEK SMALL
> LETTER IOTA WITH TONOS.  Is that so?  And if so, is the problem with
> the regexp you pass to re-search-forward?  Then where did that regexp
> come from -- maybe the problem happens while you produce that regexp?

Now I start to understand what happens. In tramp--test-check-files,
there is a loop over the test strings, which are used for different test
purposes. At the very end, an environment variable is set as

		  (setenv envvar elt)

When the failing regexp search is applied, the original string is not
taken, but the set environment variable

		    (should
		     (re-search-forward
		      (format
		       "^%s=%s$"
		       (regexp-quote envvar)
		       (regexp-quote (getenv envvar))))))))))

Likely, (getenv envvar) returns the encoded string, which fails. Using
the original string shall work.

> Feel free to ignore my questions if they are just a distraction, due
> to my unfamiliarity with the text internals.

No, you're very helpful as usual! Thanks!

Stefan, does the following patch solves the problem for you?

diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 557536a0eb..6ce1afa4a7 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5288,7 +5288,7 @@ tramp--test-check-files
 		      (format
 		       "^%s=%s$"
 		       (regexp-quote envvar)
-		       (regexp-quote (getenv envvar))))))))))
+		       (regexp-quote elt)))))))))

 	;; Cleanup.
 	(ignore-errors (delete-directory tmp-name1 'recursive))

Best regards, Michael.