From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#3230: 23.0.93; Make dired-actual-switches safe local variable? Date: Thu, 24 Feb 2011 09:57:04 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298560062 328 80.91.229.12 (24 Feb 2011 15:07:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Feb 2011 15:07:42 +0000 (UTC) Cc: 3230@debbugs.gnu.org To: Leo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 24 16:07:38 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pscmv-0005so-W2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Feb 2011 16:07:37 +0100 Original-Received: from localhost ([127.0.0.1]:35874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pscmo-0002li-LY for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Feb 2011 10:07:22 -0500 Original-Received: from [140.186.70.92] (port=40077 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pscmg-0002gc-Vr for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2011 10:07:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PscmC-0000rn-B1 for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2011 10:06:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PscmC-0000rd-9R for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2011 10:06:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Pscdm-0007a2-7C; Thu, 24 Feb 2011 09:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2011 14:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3230 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 3230-submit@debbugs.gnu.org id=B3230.129855943329080 (code B ref 3230); Thu, 24 Feb 2011 14:58:02 +0000 Original-Received: (at 3230) by debbugs.gnu.org; 24 Feb 2011 14:57:13 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Psccz-0007Yy-Ay for submit@debbugs.gnu.org; Thu, 24 Feb 2011 09:57:13 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Psccw-0007Yl-4I for 3230@debbugs.gnu.org; Thu, 24 Feb 2011 09:57:10 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFkAZk1FxIPF/2dsb2JhbACmJ3S9VoVgBIUQj1s X-IronPort-AV: E=Sophos;i="4.62,218,1297054800"; d="scan'208";a="93398171" Original-Received: from 69-196-131-197.dsl.teksavvy.com (HELO pastel.home) ([69.196.131.197]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 24 Feb 2011 09:57:04 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 732094E050; Thu, 24 Feb 2011 09:57:04 -0500 (EST) In-Reply-To: (Leo's message of "Thu, 24 Feb 2011 14:51:16 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 24 Feb 2011 09:58:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:44340 Archived-At: > (defun dired-actual-switches-p (switches) > (and (stringp switches) > (catch 'exit > (mapc (lambda (switch) > (unless (eq (aref switch 0) ?-) > (throw 'exit nil))) > (split-string switches nil t)) > t))) Hmm, what about "-l;reboot" ? BTW, writing a predicate is the right thing to so, and the predicate should then go to safe-local-variable. I'd recommend something simple like (defun dired-safe-switches-p (switches) (string-match "\\`[- [[:alnum:]]]+\\'" switches)) Hopefully that one is safe (tho maybe we should check string-length to avoid attacks playing on overflow). And if it proves too restrictive, we can make it a bit more permissive once we encounter a particular example that warrants it. Stefan