From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#65324: "make check" hangs on NetBSD 9.3 Date: Tue, 12 Sep 2023 22:12:18 +0200 Message-ID: <871qf3qhgd.fsf@gmx.de> References: <4712060.QObxxYdZWr@nimes> <874jk88px7.fsf@gmx.de> <87zg1shp57.fsf@gmx.de> <1784710.DirUC8aPjC@nimes> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1496"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65324@debbugs.gnu.org, Stefan Kangas To: Bruno Haible Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 22:13:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qg9l1-00009q-U7 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 22:13:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qg9ko-0003lY-V6; Tue, 12 Sep 2023 16:12:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qg9kn-0003lQ-LR for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 16:12:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qg9kn-00030q-Dm for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 16:12:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qg9kr-0001v2-Mo for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 16:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 20:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65324 X-GNU-PR-Package: emacs Original-Received: via spool by 65324-submit@debbugs.gnu.org id=B65324.16945495577344 (code B ref 65324); Tue, 12 Sep 2023 20:13:01 +0000 Original-Received: (at 65324) by debbugs.gnu.org; 12 Sep 2023 20:12:37 +0000 Original-Received: from localhost ([127.0.0.1]:60125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg9kR-0001uN-R1 for submit@debbugs.gnu.org; Tue, 12 Sep 2023 16:12:36 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:33013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg9kM-0001u5-UW for 65324@debbugs.gnu.org; Tue, 12 Sep 2023 16:12:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1694549539; x=1695154339; i=michael.albinus@gmx.de; bh=561fvXzWz0zJNF2uquu8G7EFQXtMg/mcU2tqhybx7eA=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=ZANaXImCngOdtH3RVSlc2adU+E+OrBB1aRKTYM4lMnViuICsvCcFMKTY5Fe7iqSiaqoXgM3 YlbPr0w28qlXTOyM1CiVrzmoVH1w2SV1oV2mePbgDq4+WTFVciGqmurl5d6GCPJdH60RquRhT SdFMpYS7p69aEclS7PAwnCqWttYARdIPSRbasDNu1QgYSDosiVwG/BcjsfeqwD+uR1RgqxFBK r+Acp+SKZc184TtEe8LZhzwp3CBZaf9u9J3MNYv9Uwy6Ee0NyBHtFL8+viJ9B5FCMeniadHpQ 9/v6PLcdHPOFm3YqtgCBxJPR4KUZR2VSfmAv/SlWc8s6wVLAnaMg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.17]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHXFr-1qtgOp41x3-00DZbO; Tue, 12 Sep 2023 22:12:19 +0200 In-Reply-To: <1784710.DirUC8aPjC@nimes> (Bruno Haible's message of "Tue, 12 Sep 2023 16:31:12 +0200") X-Provags-ID: V03:K1:DRNSC0WrdraDSSG7tBwQ/A7RzcUchep4YJ6FJAorrClbBn5UW94 XAVsgQXlU5j/PsW9sieWmyWYVU0GbqWXP1rzVKlkMQG8m4rGmrcYlMcbMQl6lQaPMv8yZ7x rrBiHi9qAaVSwiqkUmyyhFWVuLolq4BzRfSiDGkzKLV2IH7zJlM7PySbsH3annauhnmJaV8 NuJH54flESew3sseKDiTg== UI-OutboundReport: notjunk:1;M01:P0:ITreqn5cp0I=;WFECFqtFWA2aDnEE75/9Ljnh7SF o1wxeFwZiArL/5wpTFYTamW6AUZekBRm/kKWMyFEXQ/5uPsn44sgLyFh5Pz6patIJBmYpntg9 54dPL6wYQ++U6ATDxQtd/F36nszPFdnz67TxLx4zNOwkWOChPk/bTSxB1IJ2OImhBmqxjdIkE bqBKZplb0dO5HsaGluffZ4N8H4riQVagZDO/d5NMteiR1UhFN45v7uVtqNOt7+mpKsLVQQSsd bxObh0Mvqad3wnI5L98xZjq/lVR4tZm/AS0ng1oobAVbNj1jALLR8PTJlkAFksDpExZ48IEiK UuHmO/Vn2FUGCH7Sazh9HcEP59EGoT3EeJeiEQ6DRZ6yFsR207e/2f54HkzPwVkhL9sCL7PJn Q5B8Mt5wvZcV7KFDgHmXxS/GLRpeJjmf7zgy4Iy4CY9Mnig79IxJOKqIwL5Laz6krhPEIjYed yu9GWW4yxtIM7xhkoCmjoIq/6meSOfFf5qkqiTfh+O2oD6XQZ38GsEGD9MqJZioq0Qw/24njc /QO+eTldOpNAMO6EzwpzCO/DaYb+hyjfXVRZi5fIphGO/Eh38BRe3Ul3m57pOWjfx7sCX3tzZ okr+tpGOPvgi/cStmZdAxNNLJGRsJ7GA+hh+J+2y4UvCgROhZpsb5qS0aQcTKtf5yBeXBmqh2 WSBrnZ+tjkDoFbeNGMVbNHwa1n9OlQSIExtmcFnBormW853/0NTojSz7NipWNuVkB03EAUEin 5mhzJ/ZYGI+cwCyDBULrLEGi1ldoKDvcoStA/BYrs2imAalp4hS1MHPnohi+d8f8aQ+WuiCI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270218 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Bruno Haible writes: Hi Bruno, > Ah, you meant, I made a mistake while applying your patch? Indeed, I had > not noticed the change from tramp-test-instrument-test-case to > tramp--test-instrument-test-case. Now I fixed that. Find attached the two > output files. I truncated the file '*debug tramp mock netbsd93.bruno.haib= le.de*' > to 10000 lines, since it starts to repeat itself (modulo time stamps) aft= er > line 6499. Thanks, this has told us the story, indeed. The last command Tramp has sent is --8<---------------cut here---------------start------------->8--- 16:04:12.381001 tramp-send-command (6) # /bin/ls -ild -w /tmp/tramp-testXwo= 544/foo/\ foo\ bar\ baz\ \@foo\@bar\@baz\@\$foo\$bar\$\$baz\$-foo-bar-baz-\= %foo\%bar\%baz\%\&foo\&bar\&baz\&\?foo\?bar\?baz\?\*foo\+bar\*baz\+\'foo\"b= ar\'baz\"\#foo\~bar\#baz\~\!foo\|bar\!baz\|\:foo\;bar\:baz\;\bar\\(foo\)bar\(baz\)\[foo\]bar\[baz\]\{foo\}bar\{baz\}/\ foo\ bar\ baz\ \@fo= o\@bar\@baz\@\$foo\$bar\$\$baz\$-foo-bar-baz-\%foo\%bar\%baz\%\&foo\&bar\&b= az\&\?foo\?bar\?baz\?\*foo\+bar\*baz\+\'foo\"bar\'baz\"\#foo\~bar\#baz\~\!f= oo\|bar\!baz\|\:foo\;bar\:baz\;\bar\\(foo\)bar\(baz\)\[foo\]bar= \[baz\]\{foo\}bar\{baz\}; /bin/ls -lnd -w /tmp/tramp-testXwo544/foo/\ foo\ = bar\ baz\ \@foo\@bar\@baz\@\$foo\$bar\$\$baz\$-foo-bar-baz-\%foo\%bar\%baz\= %\&foo\&bar\&baz\&\?foo\?bar\?baz\?\*foo\+bar\*baz\+\'foo\"bar\'baz\"\#foo\= ~bar\#baz\~\!foo\|bar\!baz\|\:foo\;bar\:baz\;\bar\\(foo\)bar\(b= az\)\[foo\]bar\[baz\]\{foo\}bar\{baz\}/\ foo\ bar\ baz\ \@foo\@bar\@baz\@\$= foo\$bar\$\$baz\$-foo-bar-baz-\%foo\%bar\%baz\%\&foo\&bar\&baz\&\?foo\?bar\= ?baz\?\*foo\+bar\*baz\+\'foo\"bar\'baz\"\#foo\~bar\#baz\~\!foo\|bar\!baz\|\= :foo\;bar\:baz\;\bar\\(foo\)bar\(baz\)\[foo\]bar\[baz\]\{foo\}b= ar\{baz\} --8<---------------cut here---------------end--------------->8--- Yes, one line. This is too long for your shell. I have modified tramp-sh.el (see appended), could you pls give it a test? > Bruno Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el index 05cd2778..7b289053 100644 =2D-- a/lisp/tramp-sh.el +++ b/lisp/tramp-sh.el @@ -1295,43 +1295,93 @@ Operations not mentioned here will be handled by t= he normal Emacs functions.") (defun tramp-do-file-attributes-with-ls (vec localname) "Implement `file-attributes' for Tramp files using the ls(1) command." - (let (symlinkp dirp + (let ((optimized (tramp-compat-length< localname 255)) + symlinkp dirp res-inode res-filemodes res-numlinks res-uid-string res-gid-string res-uid-integer res-gid-integer res-size res-symlink-target res-context) (tramp-message vec 5 "file attributes with ls: %s" localname) - ;; We cannot send both commands combined, it could exceed NAME_MAX - ;; or PATH_MAX. Happened on macOS, for example. - (when (tramp-send-command-and-check - vec - (format "cd %s && (%s %s || %s -h %s)" - (tramp-shell-quote-argument - (tramp-run-real-handler - #'file-name-directory (list localname))) - (tramp-get-file-exists-command vec) - (if (string-empty-p (file-name-nondirectory localname)) - "." - (tramp-shell-quote-argument - (file-name-nondirectory localname))) - (tramp-get-test-command vec) - (if (string-empty-p (file-name-nondirectory localname)) - "." - (tramp-shell-quote-argument - (file-name-nondirectory localname))))) - (tramp-send-command - vec - (format "%s -ild %s %s; %s -lnd%s %s %s" - (tramp-get-ls-command vec) - ;; On systems which have no quoting style, file names - ;; with special characters could fail. - (tramp-sh--quoting-style-options vec) - (tramp-shell-quote-argument localname) - (tramp-get-ls-command vec) - (if (tramp-remote-selinux-p vec) "Z" "") - ;; On systems which have no quoting style, file names - ;; with special characters could fail. - (tramp-sh--quoting-style-options vec) - (tramp-shell-quote-argument localname))) + ;; We cannot send both commands combined, it could exceed + ;; NAME_MAX, LINE_MAX or PATH_MAX. Happened on macOS or NetBSD, + ;; for example. As a heuristic, we check whether the file name is + ;; less than 255. See Bug#65324. + (when (if optimized + (tramp-send-command-and-check + vec + (format "cd %s && (%s %s || %s -h %s)" + (tramp-shell-quote-argument + (tramp-run-real-handler + #'file-name-directory (list localname))) + (tramp-get-file-exists-command vec) + (if (string-empty-p (file-name-nondirectory localname)) + "." + (tramp-shell-quote-argument + (file-name-nondirectory localname))) + (tramp-get-test-command vec) + (if (string-empty-p (file-name-nondirectory localname)) + "." + (tramp-shell-quote-argument + (file-name-nondirectory localname))))) + + ;; Send single commands. + (or (tramp-send-command-and-check + vec + (format "cd %s && %s %s" + (tramp-shell-quote-argument + (tramp-run-real-handler + #'file-name-directory (list localname))) + (tramp-get-file-exists-command vec) + (if (string-empty-p (file-name-nondirectory localname)) + "." + (tramp-shell-quote-argument + (file-name-nondirectory localname))))) + (tramp-send-command-and-check + vec + (format "%s -h %s" + (tramp-get-test-command vec) + (if (string-empty-p (file-name-nondirectory localname)) + "." + (tramp-shell-quote-argument + (file-name-nondirectory localname))))))) + + (if optimized + (tramp-send-command + vec + (format "%s -ild %s %s; %s -lnd%s %s %s" + (tramp-get-ls-command vec) + ;; On systems which have no quoting style, file + ;; names with special characters could fail. + (tramp-sh--quoting-style-options vec) + (tramp-shell-quote-argument localname) + (tramp-get-ls-command vec) + (if (tramp-remote-selinux-p vec) "Z" "") + ;; On systems which have no quoting style, file + ;; names with special characters could fail. + (tramp-sh--quoting-style-options vec) + (tramp-shell-quote-argument localname))) + + ;; Send single commands. + (with-current-buffer (tramp-get-buffer vec) + (tramp-send-command + vec + (format "%s -ild %s %s" + (tramp-get-ls-command vec) + ;; On systems which have no quoting style, file + ;; names with special characters could fail. + (tramp-sh--quoting-style-options vec) + (tramp-shell-quote-argument localname))) + (narrow-to-region (point-max) (point-max)) + (tramp-send-command + vec + (format "%s -lnd%s %s %s" + (tramp-get-ls-command vec) + (if (tramp-remote-selinux-p vec) "Z" "") + ;; On systems which have no quoting style, file + ;; names with special characters could fail. + (tramp-sh--quoting-style-options vec) + (tramp-shell-quote-argument localname))) + (widen))) + ;; Parse `ls -l' output ... (with-current-buffer (tramp-get-buffer vec) (when (> (buffer-size) 0) --=-=-=--