Commit a90d5e63 authored by Noam Postavsky's avatar Noam Postavsky
Browse files

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).
parent 4dec9286
...@@ -2360,7 +2360,14 @@ nil default-directory" name) ...@@ -2360,7 +2360,14 @@ nil default-directory" name)
((member argi '("-eval" "-execute")) ((member argi '("-eval" "-execute"))
(setq inhibit-startup-screen t) (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")) ((member argi '("-L" "-directory"))
;; -L :/foo adds /foo to the _end_ of load-path. ;; -L :/foo adds /foo to the _end_ of load-path.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment