From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#53644: 29.0.50; xref-search-program breaks if programm not installed on a remote host Date: Tue, 15 Feb 2022 16:32:05 +0000 Message-ID: <87a6esozui.fsf@posteo.net> References: <87v8y0rdz3.fsf@posteo.net> <87iltvnj3g.fsf@gmx.de> <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@yandex.ru> <87leypml9i.fsf@gmx.de> <01015f05-e40c-c18a-8b03-5012a3cb44ba@yandex.ru> <875ypp624b.fsf@posteo.net> <87iltptnem.fsf@gmx.de> <87k0e5uvtp.fsf@posteo.net> <87a6f1tdlt.fsf@gmx.de> <87bkzhrrd2.fsf@posteo.net> <875ypotqwj.fsf@gmx.de> <878ruk4cwo.fsf@posteo.net> <828ff352-8a6c-b768-a4cc-427f6fd955f7@yandex.ru> <87leydy2iz.fsf@posteo.net> <877d9xxsjd.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4950"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Albinus , 53644@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 17:34:19 2022 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 1nK0mQ-00015H-C2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 17:34:18 +0100 Original-Received: from localhost ([::1]:42612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nK0mP-0005QX-Fx for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 11:34:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nK0lC-0004WU-Ea for bug-gnu-emacs@gnu.org; Tue, 15 Feb 2022 11:33:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nK0lC-0002cT-46 for bug-gnu-emacs@gnu.org; Tue, 15 Feb 2022 11:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nK0lC-0005df-2G for bug-gnu-emacs@gnu.org; Tue, 15 Feb 2022 11:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Feb 2022 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53644 X-GNU-PR-Package: emacs Original-Received: via spool by 53644-submit@debbugs.gnu.org id=B53644.164494274121607 (code B ref 53644); Tue, 15 Feb 2022 16:33:02 +0000 Original-Received: (at 53644) by debbugs.gnu.org; 15 Feb 2022 16:32:21 +0000 Original-Received: from localhost ([127.0.0.1]:46250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK0kX-0005cR-0n for submit@debbugs.gnu.org; Tue, 15 Feb 2022 11:32:21 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:58403) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK0kQ-0005c2-5T for 53644@debbugs.gnu.org; Tue, 15 Feb 2022 11:32:19 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F3F2E240105 for <53644@debbugs.gnu.org>; Tue, 15 Feb 2022 17:32:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1644942727; bh=53BrVDX0FDfJI59UPw8t66Vn/mfO5t2TncibNL6GU2o=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=G+ORvzZuqrW4AF0t5XhpeEMFS91rkS0r97En0g7B0/ZU8Rmv55XEt6K3oNssR6tun c3i4g+Sb+921bHr3cgQMphV7dyApceWSaLfAbGOr+zU/NV3GAj/gHh6z7A/eJSdda0 IvVh4iA7fTF7+cSESJ5bgUUSz2zFjBwyC3eUEB2w3eo8B/PqWDUhN9kR//vbPGOKuF TeUtMTI68bGAhyzG+SZ8KScQrTXGm9q8blXldTv0K9O8JUoaiq3Xqjs8jUTJebDna/ 3C+8eRjujOMqTUMyyqIO7Cvk90B0yT5/jbi6VLSjRLGG18MmA6ZLadhuqaDjauBevs p6qxZqtIWUArw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Jymny1Z0kz6tlh; Tue, 15 Feb 2022 17:32:05 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: (Dmitry Gutov's message of "Tue, 15 Feb 2022 03:27:48 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:226994 Archived-At: Dmitry Gutov writes: > On 14.02.2022 19:32, Philip Kaludercic wrote: >> Dmitry Gutov writes: >> >>> On 14.02.2022 15:57, Philip Kaludercic wrote: >>>>> And use a simpler test: (only when the host is remote) write some text >>>>> to a file in the temp dir, then search through it. Only doing it once, >>>>> of course, when the connection-local value is initialized. >>>> I am afraid I don't understand what you mean here, specifically "some >>>> text". >>>> >>> >>> Well, we need some file to search and some knowledge about its >>> contents in advance (so the search can succeed). >> I guess this is what confuses me, what about the contents is >> relevant to >> the query? `xref-matches-in-files' is already passed a list of files >> that can be concatenated into the input for xargs. The current version >> already works and is reasonably fast, so I don't recognise the >> improvement. > > Sorry, I guess I wasn't clear enough. > > When I said "extract the detection logic", I meant implement something > similar to 'grep-compute-defaults' where there is a bunch of "probing" > code which detects which commands work on the given system (and which > arguments, etc). But a shorter function, of course, since it would > only need to choose between two alternatives -- and return it. > > And it seems to be it would be simpler (conceptually) if the said > function didn't itself depend on xref-matches-in-files (the > implementation or the return type). Though it's certainly possible to > use it as well. > > ...so that function (let's call it xref--choose-search-program, > perhaps) would write to a file in the temporary directory on the > remote system, and then search in it using the configured search > program, and then fall back to the default one if the first one fails. > > WDYT? The current design (subsuming probing into executing by speculatively starting a process) was intentional, mainly to avoid the overhead of executable-find calls. I guess one could argue that this is only necessary once, and after that can be stored as a connection local variable. Setting this aside, I see little difference to the xref--choose-search-program approach, unless there is some other context that might want to use this function. >>> Since we don't know anything about the remote system, we probably have >>> to create the file ourselves. Put something like "aaa\nbbb\nccc" in >>> it, and then search for "bbb". >> My apologies, I feel stupid for not understanding, but what would >> aaa, >> bbb and ccc be? > > Those are characters. "aaa\nbbb\nccc" would be the temporary file's > contents, verbatim. > > To clarify, I think your code quality is just fine, but the way the > main function gets two responsibilities intertwined (both program > detection and the actual search) seems a bit too much for me, > clarity-wise. I am biased, but I do prefer the current state of the patch. If you think it would help, I could comment it out more? -- Philip Kaludercic