Re: [PATCH] Fix a problem that shadow `bind -x' does not work

2020-01-15 Thread Chet Ramey

On 12/18/19 4:01 AM, Koichi Murase wrote:


Bash Version: 5.0
Patch Level: 11
Release Status: maint

Description:

   When the key sequence of a binding is a prefix of other bindings
   (let me call it a shadow binding in this report), the shadow binding
   is triggered when the user input does not match any of the other
   bindings or there is no input within timeout specified by the
   readline variable `keyseq-timeout'. When such a shadow binding is
   the one by `bind -x', Bash fails to find the appropriate unix
   command and produces error message or triggers a wrong command.


Thanks for the report.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: [PATCH] Fix a problem that shadow `bind -x' does not work

2020-01-15 Thread Chet Ramey

On 12/18/19 11:40 AM, Koichi Murase wrote:

   Test case 2:

   $ LANG=C bash --norc
   $ bind -x '"\C-t\C-t":echo hello'
   $ bind -x '"\C-t":echo world'
   $ <-- 
   hello #<-- expected result is "world"


I'm sorry. I found that "Test case 2" has not yet fixed in the
previous patch. This is the patch for the additional fix for "Test
case 2".


Thanks for the fixes.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: [PATCH] Fix a problem `rl_bind_key' cannot create shadow binding for `C-@'

2020-01-15 Thread Chet Ramey

On 12/18/19 11:43 AM, Koichi Murase wrote:


Bash Version: 5.0
Patch Level: 11
Release Status: maint

Description:

   One of the public interface of readline, the function
   `rl_bind_key (key, function)' does not work with key = 0 (C-@) when
   there are already bindings of keyseqs starting from "\C-@".
   This is because when `rl_bind_key' calls `rl_generic_bind',
   it fails to construct an appropriate untranslated keyseq for "\C-@".


Thanks for the report and patches. I think your leak patches are correct.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: trap: interactive bash exits on resending SIGINT twice

2020-01-15 Thread Chet Ramey

On 1/14/20 11:24 AM, Martijn Dekker wrote:
Setting the following trap makes an interactive bash (any version) exit on 
issuing SIGINT:


trap 'trap "true" INT; kill -s INT $$; trap - INT; kill -s INT $$' INT
# ^^^ eat signal   ^^ unset trap

After setting that trap, pressing Ctrl+C, or otherwise causing SIGINT to be 
sent, causes an interactive bash to exit.


Thanks for the report.

Chet


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



temp setting POSIXLY_CORRECT turns alias expansion off

2020-01-15 Thread Martijn Dekker
When alias expansion is enabled for a script in bash native mode, 
prefixing POSIXLY_CORRECT=y to any command will turn alias expansion 
globally off. This is a bug because the assignment should only have 
effect on that command.


$ bash -c 'shopt -s expand_aliases; shopt|grep expand_a;
  POSIXLY_CORRECT=y true; shopt|grep expand_a'
expand_aliases  on
expand_aliases  off

Expected behaviour: alias expansion should stay on.

I've confirmed this bug on bash 4.2 and later; bash 4.1 and earlier seem 
fine.


- M.

--
modernish -- harness the shell
https://github.com/modernish/modernish