From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#23159: 24.5; --eval bug Date: Sat, 02 Jul 2016 20:30:37 -0400 Message-ID: <87shvrftqq.fsf@users.sourceforge.net> References: <83r3esugqx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1467505888 17371 80.91.229.3 (3 Jul 2016 00:31:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2016 00:31:28 +0000 (UTC) Cc: Devon Sean McCullough , 23159@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 03 02:31:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bJVJd-0000Bs-AH for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jul 2016 02:31:17 +0200 Original-Received: from localhost ([::1]:40598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJVJc-0005PY-E4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jul 2016 20:31:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJVJW-0005Fv-N4 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2016 20:31:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJVJS-0004Y6-OT for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2016 20:31:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJVJS-0004Xl-LK for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2016 20:31:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bJVJO-0004cU-32 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2016 20:31:02 -0400 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: Sun, 03 Jul 2016 00:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23159 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23159-submit@debbugs.gnu.org id=B23159.146750583617723 (code B ref 23159); Sun, 03 Jul 2016 00:31:02 +0000 Original-Received: (at 23159) by debbugs.gnu.org; 3 Jul 2016 00:30:36 +0000 Original-Received: from localhost ([127.0.0.1]:34977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJVIx-0004bi-NJ for submit@debbugs.gnu.org; Sat, 02 Jul 2016 20:30:35 -0400 Original-Received: from mail-it0-f52.google.com ([209.85.214.52]:37641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJVIv-0004bQ-Tm; Sat, 02 Jul 2016 20:30:34 -0400 Original-Received: by mail-it0-f52.google.com with SMTP id f6so41849929ith.0; Sat, 02 Jul 2016 17:30:33 -0700 (PDT) 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=A3dOhlA2bh3rftMuwehphp/UMYL4eB+7QKh+4wpSqfw=; b=TVU69iDWVZFjmq7SZRwXWeufWJ4lWYUCpRrEAfIfuGtnx9otaskBV/Kd+FTce0Q3Ct Dci1bqzxOFKMnY1GFpKA/0NOlW4+bQKMkPYmB6aKaRnHWeIEkTsUHwiJAic1AbLGdDmQ V8UMuk15FUHIxBmvpA+nmiyarkdWaLS5a6mpcrU0qA72waLGyTTB7EkWbDw6LQz80xrK RHXrnWrfsvih/XVHavR6CXdh7EG/URnntfvcbSfAPx50xW8JLoyTCfCFMghGm1+gsO3q cW/wQeNKJcCaKc6EgqleAqoCp9fh7RaeZA1vYBw76d/kIrEt+iurwenB0X7jpVc1pJHV KClg== 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=A3dOhlA2bh3rftMuwehphp/UMYL4eB+7QKh+4wpSqfw=; b=S7Za4atJvL4M17MmCjjvVmyRIK48E2yj8386WIYPUK/mcGKz9AtNvUFL5J5COey4bQ jvI7ArFca8ZG+FgOArSmtARftsWyK/ydFzs+X4jx80BBI745rYAWpGjVisCFM/7/O13l YrTSZM3sXQQ2p3UyQ8MsXaVw3yrwEHFABSBiV3nYJVwTCPwE10+aj47JTpf1djCHM//U I1c1vgz/xWBErcz+VlVAYcCaym/mznNKMOHaQpgGvQ+wP16gXD0ihf51e7mmF2j9PRzn GZWrbIcbmtwEIQ9p9Z3tyyJ2oBihF/M+sfpQWqHS2iZ647huzVc4zEYXrr9xdwzeOXUv jPfA== X-Gm-Message-State: ALyK8tL2eZ+TviltZ7wNzZc4rGGaMGnu8ooFldYavf0tUhR3n7OHQVSjDEwfA+vJ1lUybw== X-Received: by 10.36.85.13 with SMTP id e13mr3950463itb.56.1467505828383; Sat, 02 Jul 2016 17:30:28 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id q128sm2657575iod.30.2016.07.02.17.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jul 2016 17:30:27 -0700 (PDT) In-Reply-To: <83r3esugqx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Mar 2016 18:28:54 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) 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:120312 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 23159 patch quit Eli Zaretskii writes: >> Date: Tue, 29 Mar 2016 21:40:37 -0500 >> From: "Devon Sean McCullough" >>=20 >> MacOSX$ Open -n /Applications/Emacs.app --args -Q --eval "(print 'foo) >> (print 'bar)" >> should either report an error or print foo bar. >> The current buggy behavior silently ignores part of the argument. > > I think this is expected. The manual says: > > =E2=80=98--eval=3DEXPRESSION=E2=80=99 > =E2=80=98--execute=3DEXPRESSION=E2=80=99 > Evaluate Lisp expression EXPRESSION. > > It evaluates a single Lisp expression. If we get more than that, a warning seems appropriate. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Warn-if-eval-arg-has-text-beyond-1-expression.patch Content-Description: patch >From c9730b47893678b2283590c269ad33998a8a430a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 2 Jul 2016 20:26:35 -0400 Subject: [PATCH v1] Warn if --eval arg has text beyond 1 expression * lisp/startup.el (command-line-1): If --eval argument has more data than constitutes a single Lisp expression, print warning (Bug #23159). --- lisp/startup.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/startup.el b/lisp/startup.el index 761e69e..9f04a00 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2360,7 +2360,15 @@ command-line-1 ((member argi '("-eval" "-execute")) (setq inhibit-startup-screen t) - (eval (read (or argval (pop command-line-args-left))))) + (let* ((str-expr (or argval (pop command-line-args-left))) + (read-data (read-from-string str-expr)) + (expr (car read-data)) + (end (cdr read-data))) + (eval expr) + (unless (= end (length str-expr)) + (lwarn '(command-line eval) :warning + "Garbage at the end of expression: %s" + (substring str-expr end))))) ((member argi '("-L" "-directory")) ;; -L :/foo adds /foo to the _end_ of load-path. -- 2.8.0 --=-=-=--