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#64897: 29.0.91; Bug (and patch) in find-dired-with-command Date: Thu, 27 Jul 2023 17:55:51 +0200 Message-ID: <87sf99l56g.fsf@gmx.de> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23300"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64897@debbugs.gnu.org To: Warren Lynn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 27 18:47:29 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 1qP49A-0005qD-Gz for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jul 2023 18:47:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP3MP-0004fA-6r; Thu, 27 Jul 2023 11:57:05 -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 1qP3MN-0004ej-1t for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 11:57:03 -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 1qP3MM-0008AB-NX for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 11:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qP3MM-0008Hx-BA for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 11:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jul 2023 15:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64897 X-GNU-PR-Package: emacs Original-Received: via spool by 64897-submit@debbugs.gnu.org id=B64897.169047336431793 (code B ref 64897); Thu, 27 Jul 2023 15:57:02 +0000 Original-Received: (at 64897) by debbugs.gnu.org; 27 Jul 2023 15:56:04 +0000 Original-Received: from localhost ([127.0.0.1]:42916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qP3LP-0008Gi-Kz for submit@debbugs.gnu.org; Thu, 27 Jul 2023 11:56:03 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:50911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qP3LL-0008GD-RH for 64897@debbugs.gnu.org; Thu, 27 Jul 2023 11:56:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1690473353; x=1691078153; i=michael.albinus@gmx.de; bh=5oxV6fLaOmA4GOcDLceqIs24JANBRsNnSMbYGHZTWLs=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=h8ZVA26oButUiQJi8Vin2XABmpumIycvgiKVNgVFn5i2+2ORWTMgiYpWvBRsMs2o4Rb/i5c DFO+P//1ETD4ltUzvSXflMfo8bLHMEYk3yRjpxfGxtY3/3fVCWlnquAFBWdmkqA87dvV686LT 6IT3feOEUvomWpfF1ZyC+Lqxzs1wA7lqqo6LzCTLYASjYEludGrIjebucRvCBt4g6Gg0C34CG C8guKlmEdm4KKxrZXUSyRcd8MrlP3u+kjBubky+MsthAaJI3CKnnNMc4VTthCy41M/fFU56qL fIPgh/CGZ7/VFqpXyua4YCzE3Of5D4oxahLTKbxCY04qv1N0lieA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.27]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MO9zH-1qEO7E0C4n-00OVwP; Thu, 27 Jul 2023 17:55:53 +0200 In-Reply-To: (Warren Lynn's message of "Thu, 27 Jul 2023 10:24:37 -0400") X-Provags-ID: V03:K1:uGyZRMyyqm69AkCR6DNdEHa37QFW4DauYDwUR/zsGJIZEYp61AG rs82Y0HPawzLyOYkIkKeNeab1bXKEShqmc5wYIBBI26u0X0XEnGPAEfWcmgsF5un19RXZZO fkg08FDpwPTN0NDEl7/0DGSOMztNHtPJVgjsP4qXJ3EHx4eVSSIFefgKwjosQUOd6NnDqny a8dDewfMVrBOzNYX8kT/A== UI-OutboundReport: notjunk:1;M01:P0:lWKd5NFdXdA=;xPMdKkKy8Gy0QjIb4XGDHED73PC +urHQIIGagd8Sj9wDQLtjMyZe4/is4XMxjdSBDkc6NwmykaUwJfjRUTNGIxMASXpudNFBjURe NUPyHRoJFD+5Rf9ZQohxyDQBt9ER8s0XQfzk1q65EB+jmVVHv+PiM1LDbhaPErpr9jr6JqgtE CYpkyUbW9e5USNPxLATMkRWnAjVPqODXSHGTzo2Ubmseiud0OwBMvxl1P5d3S22eCaZ/dolnL V9p0U5KYY8Xc4KrKxViVyZNG6XFDHWySxrRRPA8QvVOE8OnK9uRghC5DI2fUwrwPy07Wk3vJc p5zB3wWEYizaxfkO4rbhMEq+aroRgMotik3XG7BQyMAUK0XQLbWNIW6anIEf53bDB3jhThVJo DdSa817Hh8YkX6stbT5ehk8GKhlKRqhco0IXZbFJDcylkpbFkCK76TEy9dVTj3NGrIPvLojnM yYLhYQaMcDTDssOjMfrn0eNSZE8WT6ZkLt0egCy1rVYqXqpwC4hsDjTc/KzvL7LNOpQpfFruB sNysFLlc3ZHxGKItSJXoHUJLs3ZubpKbedQMH/6m2ThOLcdTbdMhCuR6aA9lCZc9iyEiX4dmC PNd4djqNxVtR6WgLZQLT3fqMMElJ8JjzsMeI5qLvWHBbsBEBY3p6fvNHHLBesqjl34JXX4/hZ Ndz0ndePWbtwh9SNiCQeLtaFmTwmZFbcytjspSMhTpG1bXQXqJdLnwcwW919mgfUoBPNUrS5v 0bY4YwVflNfjQtGnY3reh6iUeLAIkTj7ieqV6Sn/rm+Q6j2RpBrwdq+eixqljfjhldJw1HAw 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:266204 Archived-At: Warren Lynn writes: Hi Warren, > On Linux. When I call "find-name-dired" command, which in turn invokes > "find-dired-with-command" function, in a multi-hop tramp remote > directory, an error will occur in side the function, with backtrace > (only shown lowest level): > > Debugger entered--Lisp error: (wrong-type-argument processp nil) > process-mark(nil) > (move-marker (process-mark proc) (point) (current-buffer)) I confirm the bug (tested on Emacs 30.0.50). It happens even on a simple remote connection; no multi-hop needed. > The issue is around this part of the code: > > ;; Start the find process. > (shell-command (concat command "&") (current-buffer)) > (let ((proc (get-buffer-process (current-buffer)))) ;; !!!!!!!! > proc could be nil here !!!!!!!!!! > ;; Initialize the process marker; it is used by the filter. > (move-marker (process-mark proc) (point) (current-buffer)) > > After changing the code to: > > ;; Start the find process. > (let ((proc (shell-command (concat command "&") > (current-buffer)))) > ;; Initialize the process marker; it is used by the filter. > (move-marker (process-mark proc) (point) (current-buffer)) > > I do not have the error any more. That patch isn't correct. It assumes, that an async shell-command returns the process object. However, the documentation doesn't specify the return value. And indeed, the type is different in the local and the remote case: =2D-8<---------------cut here---------------start------------->8--- (let ((default-directory "/")) (shell-command "ls &")) =3D> # (let ((default-directory "/ssh::")) (shell-command "ls &")) =3D> # =2D-8<---------------cut here---------------end--------------->8--- It is sheer luck for you, that in the remote case the process object is returned. > However, I observe that even with my fix above, the behavior is not > completely right. Sometimes, the (found) file entries appear before > the dired buffer header line. My impression of the code is it does not > handle asynchronous timing in a robust way, and that is more of a > problem when the command is invoked from a remote directory. Probably > some serious revamp is needed here, which is beyond my expertise. > Maybe Emacs should include the "aio" package and rely on that for > asynchronous event handling. There seem to be timing problems, indeed. And I believe using make-process instead of shell-command would give us better control over the process. Best regards, Michael.