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: Wed, 06 Jul 2016 21:12:44 -0400 Message-ID: <8760sicktv.fsf@users.sourceforge.net> References: <83r3esugqx.fsf@gnu.org> <87shvrftqq.fsf@users.sourceforge.net> <8DC20D82-8837-445D-B32E-30726B694263@jovi.net> <87vb0meemv.fsf@users.sourceforge.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1467855549 10760 80.91.229.3 (7 Jul 2016 01:39:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2016 01:39:09 +0000 (UTC) Cc: Devon Sean McCullough , 23159@debbugs.gnu.org To: Devon Sean McCullough Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 07 03:38:58 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 1bKyHI-0007rP-QY for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Jul 2016 03:38:57 +0200 Original-Received: from localhost ([::1]:36830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKyHE-0002QV-S7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Jul 2016 21:38:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKxsI-0002Cf-OE for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 21:13:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKxsE-0000M0-LW for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 21:13:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKxsE-0000Lw-IK for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 21:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bKxsE-0000lh-F2 for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 21:13: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: Thu, 07 Jul 2016 01:13: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: patch Original-Received: via spool by 23159-submit@debbugs.gnu.org id=B23159.14678539642930 (code B ref 23159); Thu, 07 Jul 2016 01:13:02 +0000 Original-Received: (at 23159) by debbugs.gnu.org; 7 Jul 2016 01:12:44 +0000 Original-Received: from localhost ([127.0.0.1]:40057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKxrw-0000lB-6D for submit@debbugs.gnu.org; Wed, 06 Jul 2016 21:12:44 -0400 Original-Received: from mail-io0-f177.google.com ([209.85.223.177]:36362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKxru-0000ky-0m for 23159@debbugs.gnu.org; Wed, 06 Jul 2016 21:12:42 -0400 Original-Received: by mail-io0-f177.google.com with SMTP id l202so8116037ioe.3 for <23159@debbugs.gnu.org>; Wed, 06 Jul 2016 18:12:42 -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=rohLXwYiqc1ugnmgKJ+jvm9+nOetO+8wdVNy23YEz4Y=; b=mnITYKJgAf69P5fEvOf31CKD5iOf7OnpeQoLTD6KEOMM9otxGdsjMo5f6BP2S+hUL8 6GJKiJrV3bXu2WZxin08TyNQ+yek/dEYy9oT61O/J24tatEOYgb+lyLdYRu66KZjgjzX bAHf9y65r+Rrpg6E/sxRYxi6JFh8AbZBJIxitC9O7HqLbL0RGKVePxgSo/IW1RHnJBWu fsA4KSgfkDVIIEKmWHhOW4rjfIwXzTXnG23yZDHv3IKagNNOdMuqEvt8tHERXDIu0eiw lMLvQw3eelAf+JmnrTyik50BlLoDuVVMMw7g1Leq4TSMCo5A3D3hB1Azrymga5X5EKf6 fJIg== 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=rohLXwYiqc1ugnmgKJ+jvm9+nOetO+8wdVNy23YEz4Y=; b=NHDR7gi0X5EtqfOCtmuVHtBehdKse57ja950K+CVpkkUDdhNQalrQ/qiAZrzO2ndd8 24eryKn3Bx/j8mG/nSg/9cJDQ3coUSXeqA72b7Xmv7SsrDvgFZ2h3/H8A6cZp05WiJRh 1eyZwhAJZHRpULDzOc1j9OyU4pW6m2EAaM3xlK51y/c7rNy9ntBSjBu0MaB7u/+09KLx hB1XrbKpypSypWIHgowNz1Wx7Ku+ZhMJQFqmJ/1JqkVmn/uMT8OHdAbrjHQ/DbVSiR2I /TWkttzMDv+c2KJIQ9VwaCeDmKhh098f4azWZMfEr9j7faiImAEZZVgMzBxtQ2aRHPMO 30+w== X-Gm-Message-State: ALyK8tJYfhhgH1QZc14ey6RkHrEnptMQzzl+vUbMTPXqKBVRgX1+KiVLmScmev3Jh8C/UA== X-Received: by 10.107.186.196 with SMTP id k187mr23063494iof.173.1467853956643; Wed, 06 Jul 2016 18:12:36 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id v138sm1827638ita.13.2016.07.06.18.12.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 18:12:35 -0700 (PDT) In-Reply-To: <87vb0meemv.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sun, 03 Jul 2016 14:54:32 -0400") 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:120549 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable npostavs@users.sourceforge.net writes: > Devon Sean McCullough writes: > >> I=E2=80=99d suggest (error "Trailing garbage following expression=E2=80= =9D) >> for consistency with the eval-expression function. > > Makes sense. Oops, I didn't actually change warning to error. One more try. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v3-0001-Error-if-eval-arg-has-text-beyond-1-expression.patch Content-Description: patch-v3 >From cf22d9210d09b936d8f734aedb6a76e12830c690 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 2 Jul 2016 20:26:35 -0400 Subject: [PATCH v3] Error 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, signal an error (Bug #23159). --- lisp/startup.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/startup.el b/lisp/startup.el index 761e69e..fcdc376 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2360,7 +2360,14 @@ 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))) + (unless (= end (length str-expr)) + (error "Trailing garbage following expression: %s" + (substring str-expr end))) + (eval expr))) ((member argi '("-L" "-directory")) ;; -L :/foo adds /foo to the _end_ of load-path. -- 2.8.0 --=-=-=--