From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#16984: dired-do-rename susceptible to .../~/... hijack Date: Thu, 08 Dec 2016 09:39:35 -0500 Message-ID: <874m2efpso.fsf@users.sourceforge.net> References: <87eh2aq60w.fsf@jidanni.org> <87pomrst3z.fsf@users.sourceforge.net> <837f8zpnih.fsf@gnu.org> <87pomjrita.fsf@users.sourceforge.net> <83pomjr63z.fsf@gnu.org> <87eg2zb860.fsf@gmx.de> <87h97vqhf3.fsf@users.sourceforge.net> <874m3vazx2.fsf@gmx.de> <87wpgoowsx.fsf@users.sourceforge.net> <874m2jpl8c.fsf@gmx.de> <87a8c7fazs.fsf@users.sourceforge.net> <8760muu8wq.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1481208039 12362 195.159.176.226 (8 Dec 2016 14:40:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2016 14:40:39 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 16984@debbugs.gnu.org, jidanni@jidanni.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 08 15:40:34 2016 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 1cEzs8-000299-Mu for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Dec 2016 15:40:32 +0100 Original-Received: from localhost ([::1]:47041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEzsC-0003iQ-Qk for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Dec 2016 09:40:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEzqk-0008QC-Pj for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2016 09:39:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEzqg-0006dw-VB for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2016 09:39:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45501) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cEzqg-0006ds-Q5 for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2016 09:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cEzqg-0007xL-GF for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2016 09:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2016 14:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16984 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch confirmed Original-Received: via spool by 16984-submit@debbugs.gnu.org id=B16984.148120792430560 (code B ref 16984); Thu, 08 Dec 2016 14:39:02 +0000 Original-Received: (at 16984) by debbugs.gnu.org; 8 Dec 2016 14:38:44 +0000 Original-Received: from localhost ([127.0.0.1]:60900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEzqN-0007wq-VW for submit@debbugs.gnu.org; Thu, 08 Dec 2016 09:38:44 -0500 Original-Received: from mail-io0-f193.google.com ([209.85.223.193]:35348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEzqL-0007wc-K4 for 16984@debbugs.gnu.org; Thu, 08 Dec 2016 09:38:42 -0500 Original-Received: by mail-io0-f193.google.com with SMTP id f73so413741ioe.2 for <16984@debbugs.gnu.org>; Thu, 08 Dec 2016 06:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Ea1G+d3OM1ey34QR87OSBm8lnogzK6j+7k4H6w3MErM=; b=a4X6WMtiBLMhYSQuPszC9P9czNDdKQVaQ/tliQTJ5VGf4UlIh9hYJISyj95zXgt+Ss MDGKFfTcaEhCqYemMem2L8pYywalF21U8DMTjboNYm+/w6er3mCrMOxATpctyIREcYTQ tzEI0OAT03benBYwc1gOlka35BD+BxbnZOSGdp7ttForxbKwGuq1I2Zl0nR3840F+xRT O9WksR5fou4OrqaczZyyRBbEuk05ODYD9YXPPtbTep9ENWl6ZzP1CTpLDu+bPWWA20/J EL+Evj/YAi2m53nwTeyC+12oWe2v3XnjIzSLDxPEQsemMXeiiAZTT9Wm4jBUE+GItAhW PNdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Ea1G+d3OM1ey34QR87OSBm8lnogzK6j+7k4H6w3MErM=; b=MeMd++Fw9XGUu+Zca3yc9YJXpJzPWlXuC4UHQo8+ODu/hQe+n8+O1hIET0kTUTa31t ottl7S/YWyZxlgjFE4TZU4jiH/vL1ER59fllrJc81KExkXY3rrjnOZgI5Vghwc3aVe0u twlKAimZth3xgif8UZ3e28M9Dl3OnuHSI0r5scDh7rNRBnd4b79EJOxhAqjiI7zJ9ZLR R3RWx7dqyUfRIMn4nD3zOAw7DL7zDmD0Gvn2wFjx8CkPcf+R8hzDHbC469/yTT1McSgw 5fTJMGr/bdlYIBoVCa9D1vEJDkGFxRopQywFDiNXY0F5GdBB08O0yXi3tpD7P+QfggAd N00A== X-Gm-Message-State: AKaTC026ENIoA4F+thTq3g8Imn5WBV7fAhfc9pMmAAH9R3HvEFDvHRTFAGP/TDu2VgNY3A== X-Received: by 10.36.233.69 with SMTP id f66mr1891979ith.83.1481207915095; Thu, 08 Dec 2016 06:38:35 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id n206sm1320266itg.1.2016.12.08.06.38.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2016 06:38:34 -0800 (PST) In-Reply-To: <8760muu8wq.fsf@gmx.de> (Michael Albinus's message of "Thu, 08 Dec 2016 09:23:01 +0100") 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:126734 Archived-At: Michael Albinus writes: > npostavs@users.sourceforge.net writes: > > `tramp-quote-name' works for both local and remote file names, so you > could remove the test `(file-remote-p filename)'. Oh, I somehow had it in my mind that `concat' doesn't work with nil, I must have mixed it up with `insert'. Also, I guess most of the filename tests should actually be looking at only the localname, so it should go more like this: (defun minibuffer-maybe-quote-filename (filename) "Protect FILENAME from `substitute-in-file-name', as needed. Useful to give the user default values that won't be substituted." (let ((local (file-remote-p filename 'localname))) (if (and (not (string-prefix-p "/:" local)) (file-name-absolute-p filename) (string-match-p "/~" local)) (tramp-quote-name filename) (minibuffer--double-dollars filename)))) Regarding `tramp-quoted-name-p', you should use (string-match "\\`/:" ...) or (string-prefix-p "/:" ...), not (string-match "^/:" ...) as the latter could get confused by newlines in filenames (of the first two, I find the `string-prefix-p' version clearer).