From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SKJAL3WRLWewxgAA62LTzQ:P1 (envelope-from ) for ; Fri, 08 Nov 2024 04:20:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id SKJAL3WRLWewxgAA62LTzQ (envelope-from ) for ; Fri, 08 Nov 2024 05:20:05 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=XbC6jlpp; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731039605; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=22K/UK07G7nhgBW42mmAEi0dledVDCPV0wpfe0kOqe0=; b=FYp3NQs4tpDQEBIAFOJPrtp/YL66QtkX2uLZUNzhV75TGAE7CvwhPltmQyDZHtw0o/pmDx zFTWgrYmM3/DW8XsdGZRLcJtn5mbY+PDWM9DeXYzf5WS2TT7I3UBNibi3MNMYZv7aIRElr ssTq5uIofiHJnby79Z68ZIoV9IdVJyaYzpyjvb5pU+r4qhYc6/7Y3SlPRrsiiGe1mTWcTm qYnSGU5nu59UOhTQ2WFp7umpvTYNFvUDduLhRyz+fvVGoir2kw5kbrs/rxO5BDrqspngMx 2VnzzuI9nA6byo0M/JOy/44BeWUF/ZmVf2QzyCEp91M/mNsyu6l6NNH7GcmUPw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731039605; a=rsa-sha256; cv=none; b=XOvrjpamlOy6FCa0iMfGBJCtgsE7Sq0dAo2aZGH4sSFE0S7qfPHEfTCf2v9FNHDmIfD+ID lmPIB97uypBeroyCPGWNxX4WW/d6KX1cfJp3UWCtZ06kiDONL2sBah8ENkdrFL5iTA6Jbg UC5whvj15hCZNCeB2l38sIGphR6mnDwxa4n1ywMxjsQ+cDWXAF27IaYCyTRqgQ+WbOy06e xagDyTTr9oDtd+gxLg5WynwVKGMvy2NLN+XXeXg/gi8ABTmz6XVEdTB7VDFPE1I99emrmo ZJ3TyYRV0wydLgXSdczvyt8EM39p3tyuoi4zo3zfY4YVevRP97+AialPFqCV9Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=XbC6jlpp; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B0F8355448 for ; Fri, 08 Nov 2024 05:20:05 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9FxV-0004dk-2c; Thu, 07 Nov 2024 22:46:53 -0500 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 1t9FxT-0004dT-5j for emacs-orgmode@gnu.org; Thu, 07 Nov 2024 22:46:51 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9FxR-0002ij-4R for emacs-orgmode@gnu.org; Thu, 07 Nov 2024 22:46:50 -0500 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2feeb1e8edfso24881001fa.1 for ; Thu, 07 Nov 2024 19:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731037606; x=1731642406; darn=gnu.org; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=22K/UK07G7nhgBW42mmAEi0dledVDCPV0wpfe0kOqe0=; b=XbC6jlppLFMpmO4jDWqhC+mzgxRHG42k+2vH9HAWosT+4NfDyY6nAFqBHg/DG9uXd9 JsOSoDgv9/x1mLC5mBNmN4KfZn8h4AoZtMKWXJPMXdDmensLEsADqt9ZEiBpqdaxIdBu DzVu4/oFAtLo0RKxT0WkXO6hSPSkdI7BosgRfPy/KnfnBSpTwK3+EnYZu9rzkrF0rsOl iT26Lqn8tNI/PmnOH6rmFGunTttjdoJy7c9r2wLOJVqT3fE0KHHeLnn1hzoNf2Hvibjs A4PbKgAmU8qjaXqiRyAhHrElkeSr/M0p6cfEu6t9f2YienDtPm8kjCmkl9AfrpY/Z7R2 WuDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731037606; x=1731642406; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=22K/UK07G7nhgBW42mmAEi0dledVDCPV0wpfe0kOqe0=; b=UbAMI3VwsHWPkibUG2ptsuktjLtrHdMeGQ6vAs2IaanX89bwmfpL08qHsXoxYkvcHR Jz638swEBdGcqRajN0dMB37GxkFqYY6Hm5VtoUQAEpZd/fmjxc0DsXLZG9kqeYjR79oK urqEoRxN2x9mis5N89rOLlbTXeMyWGlGoB4XexqYTniqEl+RnV/KpJZsbSYPQJHDyeDa yAMpN0opba4oeIYoquPLnOfTtvoCN77nP8Ye6CjyRP6I6nqoC5bw+f7kUcrEH1PGYBV5 dlCOFOyan1J5YbqFcvVEqcO/XWD6v2VZkiZb6j3O18c49RTdQq1q0Rsjqvo82h/9zA5V 9JUQ== X-Forwarded-Encrypted: i=1; AJvYcCX0NWogG7fMNKkdSYWwHzIlHzD5yLNyq7QYPZsvb69vEALYa5cvFexMT734yadRcPNctXlvpoxVDpLLn+v8@gnu.org X-Gm-Message-State: AOJu0Ywt4q1p6Ps2BDZH2AlBMrcaR/gJ+BwADVOgIJnuGyubWf/6Q7Pn A9ODwNZFR1Z5DvyIgsWwGecmcX3IeEwQjWU23gZIBw+8fT2B2Zte X-Google-Smtp-Source: AGHT+IHary5WEsLha7GbaxmYsNFBN0E/A5OrKm7sCwpp24eclBAfSi9AIKYCQNoQM7hN89npobTPgg== X-Received: by 2002:ac2:4e13:0:b0:539:a4ef:6765 with SMTP id 2adb3069b0e04-53d862beb4cmr1003972e87.7.1731037605135; Thu, 07 Nov 2024 19:46:45 -0800 (PST) Received: from [192.168.0.102] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id 2adb3069b0e04-53d8267847fsm451671e87.2.2024.11.07.19.46.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Nov 2024 19:46:44 -0800 (PST) Message-ID: Date: Fri, 8 Nov 2024 10:46:43 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix `grep' command to handle filenames starting with '-'. To: Xi Lu , emacs-orgmode@gnu.org References: Content-Language: en-US, ru-RU From: Max Nikulin Mail-Followup-To: Xi Lu , emacs-orgmode@gnu.org In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=manikulin@gmail.com; helo=mail-lj1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 6.35 X-Spam-Score: 6.35 X-Migadu-Queue-Id: B0F8355448 X-Migadu-Scanner: mx13.migadu.com X-TUID: Zhr2m03bpcK1 On 07/11/2024 16:24, Xi Lu wrote: > +++ b/lisp/org-mouse.el > @@ -627,7 +627,7 @@ This means, between the beginning of line and the point." > ["Sparse Tree" (org-occur ',region-string)] > ["Find in Buffer" (occur ',region-string)] > ["Grep in Current Dir" > - (grep (format "grep -rnH -e '%s' *" ',region-string))] > + (grep (format "grep -rnH -e '%s' ./*" ',region-string))] Thanks, I find it as an acceptable quick fix despite it adds noisy "./" to file names that are not started with "-". In BASH it is possible to do something like shopt -s nullglob; echo ./-* [!-]* but it is not portable (and portable [!CHAR] negation may be treated as history expansion by some *interactive* shells). Xi Lu, is it a kind of friendly trolling that you submitted a patch with a workaround for leading dash file name pitfall, but you decided to keep ability to pass arbitrary shell code as selection? Just quotes is a poor way to protect against shell specials and it can be easily bypassed. P.S. This code needs some love. I would expect `grep-command' or `grep-find-command' variable should be respected here. There are grep alternatives that respect VCS ignore files and thus work much faster. However it is for another patch, not for this thread. I am in doubts if "-F" should be added. Literal search for *selected* text is more reasonable from my point of view. grep -rnH -e '[aa' ./* grep: Unmatched [, [^, [:, [., or [= P.P.S. Some links for the context of leading dash issues: - "Use ./*glob* or -- *glob* so names with dashes won't become options." - "shell wildcard expansion (un)safety" Wed, 6 Nov 2024 05:12:15 +0100 - 3. Filenames with leading dashes