From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#30724: eshell: escaped tilde is not treated as such Date: Mon, 16 Jul 2018 20:14:03 -0400 Message-ID: <87sh4i90s4.fsf@gmail.com> References: <97031714eb3479b466bca0545b76114e4d40e898.camel@jonathanmitchell.org> <87zhz2dfed.fsf@gmail.com> <88c6e336a6a9a5362a1e878b2df9d7ffffc61f7a.camel@jonathanmitchell.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531786386 27268 195.159.176.226 (17 Jul 2018 00:13:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Jul 2018 00:13:06 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 30724@debbugs.gnu.org, Yegor Timoshenko To: Jonathan Kyle Mitchell Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 17 02:13:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffDby-0006xU-2f for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jul 2018 02:13:02 +0200 Original-Received: from localhost ([::1]:56098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffDe4-00078T-Jr for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Jul 2018 20:15:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffDdy-00078M-Gb for bug-gnu-emacs@gnu.org; Mon, 16 Jul 2018 20:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffDdu-0005Qd-Fk for bug-gnu-emacs@gnu.org; Mon, 16 Jul 2018 20:15:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffDdu-0005QZ-9o for bug-gnu-emacs@gnu.org; Mon, 16 Jul 2018 20:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ffDdu-0000Qi-4V for bug-gnu-emacs@gnu.org; Mon, 16 Jul 2018 20:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jul 2018 00:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30724 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 30724-submit@debbugs.gnu.org id=B30724.15317864531579 (code B ref 30724); Tue, 17 Jul 2018 00:15:02 +0000 Original-Received: (at 30724) by debbugs.gnu.org; 17 Jul 2018 00:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:44252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffDd7-0000PP-1T for submit@debbugs.gnu.org; Mon, 16 Jul 2018 20:14:13 -0400 Original-Received: from mail-io0-f175.google.com ([209.85.223.175]:41974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffDd5-0000PC-Ot for 30724@debbugs.gnu.org; Mon, 16 Jul 2018 20:14:12 -0400 Original-Received: by mail-io0-f175.google.com with SMTP id q9-v6so39590458ioj.8 for <30724@debbugs.gnu.org>; Mon, 16 Jul 2018 17:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=YFkcF2zPaIlPP4IrAjX5ClVBcTCh4vH9ITX3sYo5m8E=; b=eJntJFzJbVA6pSWI+Jdg7OhbHK4zlXGP5LhrY6Zj4NGRrTryF8LjD6QZGImHNgEyjH X8oZCReNR6f7lAKyygCPU4rENx4VsFR/2hnfAgPAE4jUTY/EFDvh0wZmq3fni30Q6wio K+blU4DA/wOjcZy93qiyL2lJb9rwbfdOr573pXyQbPPj+ew28WUsPjvlWbXRCVejvl1L DETLzbPfAbq3qFOMSqdOyyGh4z/SpCkEOiUF9MRQxTVAmRBPdn9aLL/WEW/1xTlPKQeI xf3PrZ1FVCKRKapQ44rJmivW4bWERu6/FYIO8dsJe0LwjLBUzyUPBLRkGGCWFo9cW26D KVMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=YFkcF2zPaIlPP4IrAjX5ClVBcTCh4vH9ITX3sYo5m8E=; b=qQxsFnM0ChrO6Du7LwdzEtIoZP5DUs441UWzmcNIASOHpRO2gQpWAs/VNVgwDTricc HbIWdQvRi8URCYThBzxTXWOMEcSs1ZC5rI5VTTzHLfdOsq2WDGJG++Cp57HdYNbJwq5d 1j33FttufJgAvobhW/ZWe3n3IMp3bYf8MFZTI++oTr28JGWlgSc2LTBoyE5pt3e9/qFw gAJx1jsSQLQI4R95L5ZPAbtG02DJxxd92CkaiXQpJ06Gv4a0m1YPI1/wM35ZxzjVZmlY tzD+PfBPxl/geVKHrSpvqlxqq6Sqfnj7DTtLbgviN4x92r4u1lV9vzoKfCsLawXqMzKv fKFA== X-Gm-Message-State: APt69E1PIxfUJTY82bvJe7YGD67NPKqNqc/53dmfS551OAgfjZf6PXxT RnPGGNxEj88d5xJYC5peRRE= X-Google-Smtp-Source: AAOMgpcTNjpp0+4s5BOv4EVorXI2TZD8of4V+DEUJwzyu+5/oTtg/LA3i+Zm+VSt/WAF0D7b9FPllA== X-Received: by 2002:a6b:84c6:: with SMTP id o67-v6mr41149196ioi.119.1531786446168; Mon, 16 Jul 2018 17:14:06 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id r23-v6sm16943752ior.17.2018.07.16.17.14.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 17:14:05 -0700 (PDT) In-Reply-To: <88c6e336a6a9a5362a1e878b2df9d7ffffc61f7a.camel@jonathanmitchell.org> (Jonathan Kyle Mitchell's message of "Sun, 15 Jul 2018 12:18:26 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148592 Archived-At: Jonathan Kyle Mitchell writes: > After tracing through the execution of eshell some more, I noticed that > eshell sets an escaped text property on the arguments when the user > escaped them with `\' or quote characters but there is nothing in > eshell that does anything with it apparently. Yeah, this sort of half-finished thing seems to pop up in eshell quite a bit. > Subject: [PATCH] Check for special filenames in eshell (Bug#30724) > > * lisp/eshell/em-dirs.el (eshell/cd): Add > eshell-escape-special-filenames to symbol plist. > (eshell/pushd): Likewise. > (eshell/popd): Likewise. > > * lisp/eshell/em-ls.el (eshell/ls): Add > eshell-escape-special-filenames to symbol plist. > > * lisp/eshell/em-unix.el (eshell/rm): Add > eshell-escape-special-filenames to symbol plist. > (eshell/mkdir): Likewise. > (eshell/rmdir): Likewise. > (eshell/mv): Likewise. > (eshell/cp): Likewise. > (eshell/ln): Likewise. > (eshell/cat): Likewise. > (eshell/du): Likewise. > (eshell/diff): Likewise. > > * lisp/eshell/esh-cmd.el (eshell-lisp-command): Check for > single character escaped string arguments (Bug#30724). > > * lisp/eshell/esh-ext.el (eshell/addpath): Add > eshell-escape-special-filenames to symbol plist. The "Add eshell-escape-special-filenames to symbol plist" should be coalesced, as in: * lisp/eshell/em-dirs.el (eshell/cd, eshell/pushd, eshell/popd): * lisp/eshell/em-ls.el (eshell/ls): * lisp/eshell/em-unix.el (eshell/rm, eshell/mkdir, eshell/rmdir) (eshell/mv, eshell/cp, eshell/ln, eshell/cat, eshell/du, eshell/diff): * lisp/eshell/esh-ext.el (eshell/addpath): Add eshell-escape-special-filenames to symbol plist. * lisp/eshell/esh-cmd.el (eshell-lisp-command): Check for single character escaped string arguments (Bug#30724). > + (let ((numeric (not (get object > + 'eshell-no-numeric-conversions))) > + (escaped (get object 'eshell-escape-special-filenames))) I'm not sure 'escaped' or 'eshell-escape-special-filenames' are really the right names here, as they're not actually indicating any escaping. Maybe the property should be something like 'eshell-filename-arguments'? > + (when (or numeric escaped) > + (while args > + (let ((arg (car args))) > + (cond ((and numeric (stringp arg) (> (length arg) 0) > + (text-property-any 0 (length arg) > + 'number t arg)) > + ;; if any of the arguments are flagged as > + ;; numbers waiting for conversion, convert > + ;; them now Comments should be capitalized and end with a period (I know the original didn't, but since we're updating the code, now is a good time to fix it). > + (setcar args (string-to-number arg))) > + ((and escaped (stringp arg) (= (length arg) 1) > + (text-property-any 0 (length arg) > + 'escaped t arg)) > + ;; if any of the arguments are single > + ;; character escaped filenames, > + ;; prepend "./" > + (setcar args (concat "./" arg))))) It looks like this kind of escaping isn't actually needed for "*" which your previous patch mentioned. Perhaps just check for "~" explicitly, rather than any single character filenames. Or are there other examples besides "~" which need "./" to prevent interpretation?