From: npostavs@users.sourceforge.net
To: Devon Sean McCullough <devon2016@jovi.net>
Cc: Devon Sean McCullough <Emacs-Hacker2016@jovi.net>, 23159@debbugs.gnu.org
Subject: bug#23159: 24.5; --eval bug
Date: Wed, 06 Jul 2016 21:12:44 -0400 [thread overview]
Message-ID: <8760sicktv.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87vb0meemv.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sun, 03 Jul 2016 14:54:32 -0400")
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
npostavs@users.sourceforge.net writes:
> Devon Sean McCullough <devon2016@jovi.net> writes:
>
>> I’d suggest (error "Trailing garbage following expression”)
>> for consistency with the eval-expression function.
>
> Makes sense.
Oops, I didn't actually change warning to error. One more try.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-v3 --]
[-- Type: text/x-diff, Size: 1425 bytes --]
From cf22d9210d09b936d8f734aedb6a76e12830c690 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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
prev parent reply other threads:[~2016-07-07 1:12 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
2016-07-03 10:25 ` Devon Sean McCullough
2016-07-03 18:54 ` npostavs
2016-07-07 1:12 ` npostavs [this message]
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=8760sicktv.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=23159@debbugs.gnu.org \
--cc=Emacs-Hacker2016@jovi.net \
--cc=devon2016@jovi.net \
/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).