GNU bug report logs -
#23159
24.5; --eval bug
Previous Next
Full log
Message #22 received at 23159 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
npostavs <at> users.sourceforge.net writes:
> Devon Sean McCullough <devon2016 <at> 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.
[v3-0001-Error-if-eval-arg-has-text-beyond-1-expression.patch (text/x-diff, inline)]
From cf22d9210d09b936d8f734aedb6a76e12830c690 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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
This bug report was last modified 8 years and 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.