unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
@ 2013-08-31 23:40 Gregor Zattler
  2013-09-03  1:27 ` Stefan Monnier
       [not found] ` <mailman.1220.1378171698.10748.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Gregor Zattler @ 2013-08-31 23:40 UTC (permalink / raw)
  To: 15231

Dear Emacs developers,

eshell treats a variable named `name' different than a variable
named `foo' (or any(?) other name):

How to reproduce:

emacs -Q -nw -f eshell
#now type
for foo in * { echo "$foo" } 
# this lists the directory Emacs was started in
#now type
for name in * { echo "$name" } 
# this instead lists as many times 'name' as the above
# for statement listed objects in the directory.

E.g.:

~/src/emacs/doc $ for foo in * { echo "$foo" } 
Emacs/
lispintro/
lispref/
man/
misc/
~/src/emacs/doc $ for name in * { echo "$name" } 
name
name
name
name
name
~/src/emacs/doc $


This is the case  with 

GNU Emacs 24.3.50.1 (i486-pc-linux-gnu, X toolkit, Xaw scroll
bars) of 2013-08-31 on dex, modified by Debian

and with

GNU Emacs 23.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll
bars) of 2013-07-01 on binet, modified by Debian


Is this a bug?

Thanks, Gregor
 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
  2013-08-31 23:40 bug#15231: 24.3.50; eshell: variable `name' treated different from other variables Gregor Zattler
@ 2013-09-03  1:27 ` Stefan Monnier
       [not found] ` <mailman.1220.1378171698.10748.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-09-03  1:27 UTC (permalink / raw)
  To: Gregor Zattler; +Cc: 15231

> Is this a bug?

Sounds like it, yes.  More specifically it sounds like changing Eshell
to use lexical-binding would fix this bug.


        Stefan "just reading his crystal ball"






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
       [not found] ` <mailman.1220.1378171698.10748.bug-gnu-emacs@gnu.org>
@ 2013-09-12  1:58   ` Aidan Gauland
  2013-09-12  3:39     ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Aidan Gauland @ 2013-09-12  1:58 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: Gregor Zattler

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Is this a bug?
>
> Sounds like it, yes.  More specifically it sounds like changing Eshell
> to use lexical-binding would fix this bug.

But why is this happening with just `name'?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
  2013-09-12  1:58   ` Aidan Gauland
@ 2013-09-12  3:39     ` Stefan Monnier
  2013-09-12  4:50       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-09-12  3:39 UTC (permalink / raw)
  To: Aidan Gauland; +Cc: Gregor Zattler, 15231

>>> Is this a bug?
>> Sounds like it, yes.  More specifically it sounds like changing Eshell
>> to use lexical-binding would fix this bug.
> But why is this happening with just `name'?

I don't know the precise cause of the bug, but my crystal ball says that
the Eshell code that interprets your command itself uses a variable
named "name".  There are probably a few other variables names used by
Eshell that suffer from the same kind of "capture".


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
  2013-09-12  3:39     ` Stefan Monnier
@ 2013-09-12  4:50       ` Stefan Monnier
  2013-09-12  6:56         ` Michael Albinus
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-09-12  4:50 UTC (permalink / raw)
  To: Aidan Gauland; +Cc: Gregor Zattler, 15231

> I don't know the precise cause of the bug, but my crystal ball says that
> the Eshell code that interprets your command itself uses a variable
> named "name".  There are probably a few other variables names used by
> Eshell that suffer from the same kind of "capture".

I've just tried to convert Eshell to use lexical-binding and it appears
that this problem would indeed be fixed by such a change (if someone has
some kind of test suite for Eshell it would be very helpful, since
changing it to use lexical-binding is not completely trivial and might
introduce unexpected regressions).


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
  2013-09-12  4:50       ` Stefan Monnier
@ 2013-09-12  6:56         ` Michael Albinus
  2013-09-12 20:16           ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Albinus @ 2013-09-12  6:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Gregor Zattler, Aidan Gauland, 15231

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I've just tried to convert Eshell to use lexical-binding and it appears
> that this problem would indeed be fixed by such a change (if someone has
> some kind of test suite for Eshell it would be very helpful, since
> changing it to use lexical-binding is not completely trivial and might
> introduce unexpected regressions).

There is test/eshell.el. Btw, shouldn't it be moved to test/automated/ ?

>         Stefan

Best regards, Michael.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15231: 24.3.50; eshell: variable `name' treated different from other variables
  2013-09-12  6:56         ` Michael Albinus
@ 2013-09-12 20:16           ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-09-12 20:16 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 15231-done, Gregor Zattler, Aidan Gauland

>> I've just tried to convert Eshell to use lexical-binding and it appears
>> that this problem would indeed be fixed by such a change (if someone has
>> some kind of test suite for Eshell it would be very helpful, since
>> changing it to use lexical-binding is not completely trivial and might
>> introduce unexpected regressions).
> There is test/eshell.el. Btw, shouldn't it be moved to test/automated/ ?

Cool, indeed.  I moved the file, added a test to catch this bug, and
changed Eshell to use lexical-binding.


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-12 20:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-31 23:40 bug#15231: 24.3.50; eshell: variable `name' treated different from other variables Gregor Zattler
2013-09-03  1:27 ` Stefan Monnier
     [not found] ` <mailman.1220.1378171698.10748.bug-gnu-emacs@gnu.org>
2013-09-12  1:58   ` Aidan Gauland
2013-09-12  3:39     ` Stefan Monnier
2013-09-12  4:50       ` Stefan Monnier
2013-09-12  6:56         ` Michael Albinus
2013-09-12 20:16           ` Stefan Monnier

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).