* bug#23159: 24.5; --eval bug
@ 2016-03-30 2:40 Devon Sean McCullough
2016-03-30 15:28 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Devon Sean McCullough @ 2016-03-30 2:40 UTC (permalink / raw)
To: 23159
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.
Peace
--Devon
In GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
of 2015-04-11 on builder10-9.porkrind.org
Windowing system distributor `Apple', version 10.3.1404
Configured using:
`configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp''
Important settings:
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
foo
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)
Memory information:
((conses 16 71360 5445)
(symbols 48 17206 0)
(miscs 40 35 102)
(strings 32 9707 4708)
(string-bytes 1 257299)
(vectors 16 8934)
(vector-slots 8 371822 19184)
(floats 8 53 157)
(intervals 56 162 0)
(buffers 960 11))
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#23159: 24.5; --eval bug
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
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-03-30 15:28 UTC (permalink / raw)
To: Devon Sean McCullough; +Cc: 23159
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#23159: 24.5; --eval bug
2016-03-30 15:28 ` Eli Zaretskii
@ 2016-07-03 0:30 ` npostavs
2016-07-03 10:25 ` Devon Sean McCullough
0 siblings, 1 reply; 6+ messages in thread
From: npostavs @ 2016-07-03 0:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Devon Sean McCullough, 23159
[-- 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#23159: 24.5; --eval bug
2016-07-03 0:30 ` npostavs
@ 2016-07-03 10:25 ` Devon Sean McCullough
2016-07-03 18:54 ` npostavs
0 siblings, 1 reply; 6+ messages in thread
From: Devon Sean McCullough @ 2016-07-03 10:25 UTC (permalink / raw)
To: npostavs; +Cc: Devon Sean McCullough, 23159
I’d suggest (error "Trailing garbage following expression”)
for consistency with the eval-expression function.
Peace
—Devon
> On Jul 2, 2016, at 8:30 PM, npostavs@users.sourceforge.net wrote:
>
> 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.
>
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#23159: 24.5; --eval bug
2016-07-03 10:25 ` Devon Sean McCullough
@ 2016-07-03 18:54 ` npostavs
2016-07-07 1:12 ` npostavs
0 siblings, 1 reply; 6+ messages in thread
From: npostavs @ 2016-07-03 18:54 UTC (permalink / raw)
To: Devon Sean McCullough; +Cc: Devon Sean McCullough, 23159
[-- Attachment #1: Type: text/plain, Size: 193 bytes --]
Devon Sean McCullough <devon2016@jovi.net> writes:
> I’d suggest (error "Trailing garbage following expression”)
> for consistency with the eval-expression function.
Makes sense.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-v2 --]
[-- Type: text/x-diff, Size: 1487 bytes --]
From 5990021e37069a8a03181dc5167f0e94d748981e Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 2 Jul 2016 20:26:35 -0400
Subject: [PATCH v2] 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..75ae9f9 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
+ "Trailing garbage following expression: %s"
+ (substring str-expr end)))))
((member argi '("-L" "-directory"))
;; -L :/foo adds /foo to the _end_ of load-path.
--
2.8.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#23159: 24.5; --eval bug
2016-07-03 18:54 ` npostavs
@ 2016-07-07 1:12 ` npostavs
0 siblings, 0 replies; 6+ messages in thread
From: npostavs @ 2016-07-07 1:12 UTC (permalink / raw)
To: Devon Sean McCullough; +Cc: Devon Sean McCullough, 23159
[-- 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-07 1:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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).