From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames Date: Sun, 18 Apr 2021 22:06:43 +0200 Message-ID: References: <658a3e61-9511-5502-43de-8f591cec7387@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20280"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47799@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 18 22:08:10 2021 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 1lYDiD-0005B7-82 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 22:08:09 +0200 Original-Received: from localhost ([::1]:48272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYDiC-0006eA-81 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 16:08:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYDi6-0006e2-0v for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYDi5-0001PE-PL for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:08:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYDi5-0002MZ-KJ for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Apr 2021 20:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47799 X-GNU-PR-Package: emacs Original-Received: via spool by 47799-submit@debbugs.gnu.org id=B47799.16187764219000 (code B ref 47799); Sun, 18 Apr 2021 20:08:01 +0000 Original-Received: (at 47799) by debbugs.gnu.org; 18 Apr 2021 20:07:01 +0000 Original-Received: from localhost ([127.0.0.1]:47915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYDh6-0002L2-US for submit@debbugs.gnu.org; Sun, 18 Apr 2021 16:07:01 -0400 Original-Received: from mail-oi1-f173.google.com ([209.85.167.173]:40499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYDh5-0002Kq-QN for 47799@debbugs.gnu.org; Sun, 18 Apr 2021 16:07:00 -0400 Original-Received: by mail-oi1-f173.google.com with SMTP id u16so16182971oiu.7 for <47799@debbugs.gnu.org>; Sun, 18 Apr 2021 13:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=aZkVLmVhnj7mgW6sa7Zvmf7xw7pDhHHddKWhdGkg60A=; b=Ya9nzu+jcS05f1bRKOKPY8TdcU2H7RX7v0cZ8mAIuF3yGl4Bc9S5vW3fXTNWxqIBKI LQGB4fEkMCUAQW90FDoAYKCP7MCPxsGyyC4rKceCjGH3wUy0LtD/ti5xtoxKqN0G0KYi xzkoGW57vlkuysSFtoOzf7PO+00uRJUjJH6IhnMXJUW/9i/u37h+pCCjnVaVZFhayHN2 3aTFrsuzD5zB2x1swqzHU4GsMlKCc5X642jy6AhZefo316RU409tVelG4hIi0IrCU3tf nBqh3srIO2xWPLpjtjCH+FZhwt7kUPsxqr0M79MpXsfIsSpMF7O+UJ0OFT+4HnGpq6bh DK6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=aZkVLmVhnj7mgW6sa7Zvmf7xw7pDhHHddKWhdGkg60A=; b=K/0CU+UmMMhKUkw9SLmTygz035gepjbgtuAoH47+pHyTqRp5mJrOaKKUdW/RMpwvEw 2OxI6Fu5D7Bn+E54fhxRSF1XuwKQObVnRNyMODT5m0VCWr/rOindtixnHW86wDo4Ar91 ndHM6gjLS0IuIhOFcwW75p7KG/ZOAbQG+LjyLu09jddnvcGzBnNAweEShojHIptkfyVr ZqV+wlv8YaoGP2juKJKzkCY5KaoSXlCkXVam7aCedu+jh52eSiulc/yqsgp/2oQfHUeT h3i+7SIvqc8rv9FNwVLABZkfF9GO98nxGbofzreyrQUVfW6x2kxEVzYzUXtsXuwigsLV 7SIQ== X-Gm-Message-State: AOAM5322OJZxpcl70/H/3+bq/Hn3sYFXo5dN09gaUXQiZHXy1co0RmBy 57Q1o40Nu/c0otboBjxGaaVgdxLmDMrpKS2IstY= X-Google-Smtp-Source: ABdhPJxi9QQVydENe37oKKOuA9bTIgmcDvyG2DGxDLp6ZB+ezcO6FkJM+L/t9WhQfZm735z8gAkYRnNxIbvyyDQdk+Y= X-Received: by 2002:aca:1814:: with SMTP id h20mr13390314oih.150.1618776414156; Sun, 18 Apr 2021 13:06:54 -0700 (PDT) In-Reply-To: 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:204405 Archived-At: Am Fr., 16. Apr. 2021 um 03:08 Uhr schrieb Dmitry Gutov : > > On 15.04.2021 19:44, Philipp Stephani wrote: > > Am Do., 15. Apr. 2021 um 18:15 Uhr schrieb Dmitry Gutov : > >> > >> Hi Philipp, > >> > >> On 15.04.2021 16:43, Philipp Stephani wrote: > >>> emacs -Q -batch -l project -eval '(print (project-files (quote (trans= ient . "/:/"))))' > >>> > >>> ("find: =E2=80=98/:/=E2=80=99: No such file or directory > >>> ") > >>> > >>> Note that the error message is listed as a file. > >>> > >>> 1. `project-files' should unquote local filenames before passing them= to > >>> `find'. > >>> > >>> 2. `project-files' should check for errors returned from `find'. > >> > >> Would you like to propose a patch? > > > > I've now pushed a minimal fix to this specific problem (commit > > 157bfc1812c51a0a48162c71eadf7959f7de9ac6), but there are probably more > > places that should get fixed, e.g. xref--find-ignores-arguments. > > project--files-in-directory also still ignores any errors from the > > find binary. > > Thank you. > > I've added error handling to project--files-in-directory in a follow-up > commit. Thanks. > > Regarding xref--find-ignores-arguments, it seems it would be economical > to do the quoting on the value passed to it. See f955df1. Since it's an internal function, this is mostly a matter of style. I prefer using Emacs filenames as function arguments as much as possible; it's the expected behavior for functions dealing with files, and Emacs doesn't have a strong enough type system to distinguish "Emacs filename" (which can be quoted or remote) from "filename for external programs" (which must be unquoted and local). > > Regarding your change, though, have you tried project-find-regexp in a > "transient" project with a quoted root directory name? > > You've made project--files-in-directory quote the returned file names, > but that list gets passed to xref-matches-in-files, which pipes them to > find-grep in the end. I suppose xref-matches-in-files could use a step > similar to (when remote-id ...) that is already there. Good point, I've pushed 6ebc6e12cf to fix. But xref.el should also be fixed. Maybe I'll find some time to take a look at it. > > A bit unfortunate for the users of large projects with quoted names, but > not sure what else we could do. Quoting is a purely lexical operation which should be reasonably fast even for a large list of files. For truly enormous projects, something like "list of all project files" is infeasible anyway.