bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sourcing a file ending in \<newline> disables aliases for 1 command


From: Eduardo A . Bustamante López
Subject: Re: Sourcing a file ending in \<newline> disables aliases for 1 command
Date: Fri, 3 Apr 2015 13:55:11 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

I'm replying to this report, because it's the latest.

This seems to be caused by last_read_token having an incorrect value set.
`alias_expand_token' in parse.y relies on
`command_token_position (last_read_token)' (and parser_state), to determine if
an alias expansion should be performed.

The correct value of last_read_token there should be of 10:

  alias_expand_token: last_read_token = 10

But, for some reason (I don't know if it's parse_and_execute or
parse_command), after calling `evalstring', this value isn't restored to the
correct one (shouldn't we care about toplevel's parser status?).

Anyways, I wasn't able to produce a patch for this, because I don't know where
last_read_token should be reset, or if there's some magic unwind_protect code
to restore the tokens to the value before calling source/eval, but I hope this
information makes it easier for Chet to produce a patch.


Also, while looking at this, I found this:

dualbus@yaqui ~ % bash -c 'eval \\; echo y'
y
dualbus@yaqui ~ % bash -ic 'eval \\; echo y'
exit

So, that eval is triggering a yacc_EOF, so that triggers the `exit' in the
interactive shell.

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]