From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#48072: 28.0.50: dired-read-shell-command: handle empty input properly [PATCH] Date: Wed, 28 Apr 2021 08:00:11 -0400 Message-ID: <20210428120011.5g73ctmekbff42gf@E15-2016.optimum.net> References: <20210427190243.n5yg3gywd5wma3jl@E15-2016.optimum.net> <87y2d2brhy.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1160"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: 48072@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 28 14:01:13 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 1lbisR-000070-R0 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Apr 2021 14:01:11 +0200 Original-Received: from localhost ([::1]:35810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbisQ-0003gs-Ob for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Apr 2021 08:01:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbisI-0003gE-G4 for bug-gnu-emacs@gnu.org; Wed, 28 Apr 2021 08:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40393) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbisI-0006YW-7j for bug-gnu-emacs@gnu.org; Wed, 28 Apr 2021 08:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lbisI-0005kl-6y for bug-gnu-emacs@gnu.org; Wed, 28 Apr 2021 08:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Apr 2021 12:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48072 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 48072-submit@debbugs.gnu.org id=B48072.161961122322062 (code B ref 48072); Wed, 28 Apr 2021 12:01:02 +0000 Original-Received: (at 48072) by debbugs.gnu.org; 28 Apr 2021 12:00:23 +0000 Original-Received: from localhost ([127.0.0.1]:51938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbirf-0005jl-Jk for submit@debbugs.gnu.org; Wed, 28 Apr 2021 08:00:23 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:49339) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbirc-0005jU-Vu for 48072@debbugs.gnu.org; Wed, 28 Apr 2021 08:00:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1619611214; bh=E+wQ0nhZ9K2MYEB2CWO12YBrhaqkkXuswdlXgCpmtQo=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=gO8uAN5cSjDblDf00zZWPni0hzKnQWb8QS1xKbgfCJyO6MywF5Ia8VbGHDuAFsJ97 DOChChuUQhJAtbuQ9ld2Ghw1GVcu9hediroHxoTB7wmaxmoXG3DTeQDA5qL/mivp3d S6m25vSu022U/qgFdIHBUhkbAiI9X22f3NNo05qE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([70.19.86.82]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MmDEm-1lBUre1VHE-00iENy; Wed, 28 Apr 2021 14:00:14 +0200 Content-Disposition: inline In-Reply-To: <87y2d2brhy.fsf@gmx.de> X-Provags-ID: V03:K1:HWqyS7mKegl3Gd4+XIOFt3b9v30RCvxL0MqB/jUnq1HSfYayjrE xvazTkK9fB4D+AoUkxas0TA9AdE5lFY51D378Z4VaaUanCJzqqBQKBJa8a0OSbLTL9rWSVG mpn0PQsquh3/bHVS06IXiiGtmC/nOZ+8sG1UVdBWPffi6am5q7j+PaIxweojfobl7rFioAi bRwLQUYuxn8H/wrSp8ZMw== X-UI-Out-Filterresults: notjunk:1;V03:K0:zOC+FMCaLoE=:z4gH5ZWW2XAgsCJp4+//cA c+NeX/3QZEliCkc4O8KhcZIB1K4jvJsCk4YII6AnmrruIbxk2sQjahcjqo4bd+BYGaCUmfQ8K hHSem+l77iemC0yKEaGgLMqLluKilWJhn3vUPa39Ien0fUBIqr3yY46uMXCo+9OTSb3El+zCj Oe+5eu2634uKO26OTxdUvHbQC+AF4GKgkKPAOZ9IQIFNSYL2TkgkZUx/hRJRzsv5EJ4Zw+mhv PQLzV7rZhRih36sqdrMp8Ckp1ioBNxRLjypyPSt5X8hStwruHV9FCqA2Q/89LRGXIxYOCL8fl bECFQOxD81rcpNzDNKoBif2SubGW5hE3MJ2HIaBhzzxzaThDeDGEAifzDU/KRGIu6V5iqZ+4O XCtEeINc69QTez6kolVqkjh5gbyHHCjIP6d+XDglkRJyaJIXVLvlKAa6kWXPyOBT9xd9eN4RW Nu9vDPKXT3OjAicDiGAzkZZw0i5kdNeqmF5GnAbQ1vdDnZvjyWJ9lTclpKW1MUmZ6AQvmqkXG UNN/RZUkmqU9j1Cb5k1T08fr5omZjA709I3RNqgmcrStm8sfUGkUPIXVWgO9gHqs0YLisZmNG BuEnpTboWWg/2ou796b59+xOSAjIxPNWAhdlS7YcKXHdv2hNognv06g9KjrIF33phja9SgiFu YRWGL5JjguGpIV0i/inJ8R8d4TKInAwdpkUBuzFwOQwWC1CyaMzbS7bHWkX9fKcnPUth6Qry3 L0Q+T5JP5IsI4AiPeE3PM/iDnR2bs+0T+tGx6oVXeph25ThzOXvx7XSlYk4TSaGaEGBB0Rcx 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:205100 Archived-At: On 2021-04-28 13:03, Michael Albinus wrote: > Boruch Baum writes: > > > > + (unless (executable-find command) > > + (user-error "Not a valid command!")) > > This doesn't check the remote case. Good point. It's an area of dired I'm weak in because I don't use it. How about the following (with the update diredc regex): (unless (executable-find (if (string-match "^ *\\([^ ]+\\) " command) (substring command (match-beginning 1) (match-end 1)) command) (file-remote-p file)) (user-error "Not a valid command!")) The snippet is currently in three separate points in diredc with slight differences (defsubst called-for). For preparing the completion candidates, the snippet is there at function diredc--advice--shell-guess-fallback. For the post-input check (`diredc--advice--dired-read-shell-command', and with a tweak, also `diredc-do-async-shell-command'), how about this for checking that the command is valid for all selected file: (unless (executable-find (if (string-match "^ *\\([^ ]+\\) " command) (substring command (match-beginning 1) (match-end 1)) command) (let ((f files) remote-found) (while (and f (not (setq remote-found (file-remote-p (po= p f)))))) remote-found)) (user-error "Not a valid command!")) ref: https://github.com/Boruch-Baum/emacs-diredc =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0