From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: Devon Sean McCullough <Emacs-Hacker2016@jovi.net>, 23159@debbugs.gnu.org
Subject: bug#23159: 24.5; --eval bug
Date: Sat, 02 Jul 2016 20:30:37 -0400 [thread overview]
Message-ID: <87shvrftqq.fsf@users.sourceforge.net> (raw)
In-Reply-To: <83r3esugqx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Mar 2016 18:28:54 +0300")
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
tags 23159 patch
quit
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Tue, 29 Mar 2016 21:40:37 -0500
>> From: "Devon Sean McCullough" <Emacs-Hacker2016@jovi.net>
>>
>> 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:
>
> ‘--eval=EXPRESSION’
> ‘--execute=EXPRESSION’
> Evaluate Lisp expression EXPRESSION.
>
> It evaluates a single Lisp expression.
If we get more than that, a warning seems appropriate.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1482 bytes --]
From c9730b47893678b2283590c269ad33998a8a430a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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
next prev parent reply other threads:[~2016-07-03 0:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 2:40 bug#23159: 24.5; --eval bug Devon Sean McCullough
2016-03-30 15:28 ` Eli Zaretskii
2016-07-03 0:30 ` npostavs [this message]
2016-07-03 10:25 ` Devon Sean McCullough
2016-07-03 18:54 ` npostavs
2016-07-07 1:12 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87shvrftqq.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=23159@debbugs.gnu.org \
--cc=Emacs-Hacker2016@jovi.net \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).