Re: Any chance of multi-dimensional arrays?

2012-11-25 Thread Eduardo Bustamante
.29_shells -- Eduardo Bustamante On Sun, Nov 25, 2012 at 9:32 PM, Rene Herman rene.her...@gmail.com wrote: On 11/25/2012 08:54 PM, Bob Proulx wrote: There are various naming conventions and schemes to simulate multi-dimensional arrays using single dimension arrays. Since you want

Re: bash doesn't display tabs for tabs -- ignores tabstops.

2013-05-15 Thread Eduardo Bustamante
The cool thing about free software is that you're free to submit patches. Please consider that option, instead of ranting on what Chet should do. -- Eduardo A. Bustamante López

Re: How to read fields into an array?

2014-08-01 Thread Eduardo Bustamante
Remember to use help-bash for these questions.

Re: Regression with declare -i and arrays

2015-04-03 Thread Eduardo Bustamante
{ free (name); list = list-next; continue; } while(0) /* There are arguments left, so we are making variables. */ while (list) /* declare [-aAfFirx] name [name ...] */ -- Eduardo Bustamante https://dualbus.me/

Re: Curious case statement error

2016-08-13 Thread Eduardo Bustamante
Character ranges are locale-dependant. Check the values of LC_ALL and LC_COLLATE. Under some locales, the [A-Z] range is actually AaBb..Z. That's why it's better to use the character classes, i.e. [[:alpha:]], [[:lower:]], [[:upper:]], etc. Unless you set the globasciiranges shopt:

Re: Patch for autoload.v3 to allow export of function

2017-02-08 Thread Eduardo Bustamante
On Wed, Feb 8, 2017 at 11:27 AM, Matthew Persico wrote: [...] > > Where should it be discussed and how does one format and submit a patch > (fork, clone, pull request or patch submission on the savanah site or > something else)? Hi Matthew, you can send patches to this

Re: echo -n

2017-02-02 Thread Eduardo Bustamante
El jue., feb. 2, 2017 9:00 AM, Sangamesh Mallayya < sangamesh.sw...@in.ibm.com> escribió: > [...] > > Please let us know if this a bug or do we have any other option to print > -n ? > Use the printf builtin command. What you encountered is a known limitation of the echo command, as specified by

Re: Follow-up to Non-expanding here-documents inside command substitution

2017-02-24 Thread Eduardo Bustamante
On Thu, Feb 23, 2017 at 11:14 PM, Kevin Grigorenko wrote: > On February 11th 2017, there was a discussion on the topic of "Non-expanding > here-documents inside command substitution are subject to newline joining" > where it was confirmed that Bash contains a bug. Two

Re: readonly changes set -e behavior

2017-02-21 Thread Eduardo Bustamante
On Tue, Feb 21, 2017 at 11:02 AM, Dennis Kuhn wrote: [...] > > When the variable s is set to readonly the script does not exit and echoes > "abc": > > #!/bin/bash > set -e > > readonly s=$(false) > echo "abc" [...] This is a commonly reported issue. The moment you add the

Re: Bash bug

2016-08-22 Thread Eduardo Bustamante
You can do: local var; var=$(...); ... $? No need to make the declaration and assignment at the same time.

Re: Forcing builtins (interactive, non-interactive shells) to execute in fork()'ed process.

2016-10-26 Thread Eduardo Bustamante
Hi Matthew, I have a couple questions: 1. How are you testing this? (small concrete cases are helpful) 2. Do you have some specific builtins that exhibit that behavior? (it doesn't make sense for builtins to fork on their own, unless you're doing an explicit subshell. Like you mentioned,

Re: Why does bash use xmalloc?

2016-11-06 Thread Eduardo Bustamante
Hi Peng. Read the link you provided again. xmalloc is not an alternative version of malloc. It's just a common wrapper function around malloc. You can go and see for yourself, the definition is here: http://git.savannah.gnu.org/cgit/bash.git/tree/xmalloc.c#n97 If you want the rest of the commands

Re: How bash do tokenization?

2016-10-18 Thread Eduardo Bustamante
Check parser.y

Re: How bash do tokenization?

2016-10-18 Thread Eduardo Bustamante
On Tue, Oct 18, 2016 at 10:18 PM, Eduardo Bustamante <dual...@gmail.com> wrote: > Check parser.y Sorry, I meant parse.y, inside it you will find read_token and yylex.

Re: Race in bash-4.3 'typeset'?

2016-10-25 Thread Eduardo Bustamante
What version of bash are you using Stuart? typeset -p should work for local variables too in any recent bash version.

Re: Race in bash-4.3 'typeset'?

2016-10-25 Thread Eduardo Bustamante
Ah! You're right. The second issue was already reported back in 2015 https://lists.gnu.org/archive/html/bug-bash/2015-02/msg00060.html Now, regarding the SIGPIPE issue. The message bash is printing just means that grep closed the pipe, so the bash process receives a SIGPIPE when attempting to

Re: 4.4 change in behavior from 4.3: how to catch unset when using ${#length}

2016-10-21 Thread Eduardo Bustamante
what's wrong with?: echo ${#array[@]} It will return: - With array=(1 2 3) -> 3 - With array=() -> 0 - With unset array -> 0 - With declare -a array -> 0 Seems to do what you're looking for.

Re: Could bash do what make does?

2016-11-28 Thread Eduardo Bustamante
Why should bash do what make already does?

Re: here-documents in $(command) substitution

2016-11-27 Thread Eduardo Bustamante
Hi Alexey, Please read the specification of here-documents in the standard: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04 Quoting the relevant parts: The here-document shall be treated as a single word that begins after the next and continues until

Re: Not operator (~) fail on arithmetic expansion.

2016-11-27 Thread Eduardo Bustamante
Except that this is *inside* arithmetic context. Bash is definitely doing something wrong here: dualbus@hp:~$ for sh in bash zsh ksh93 mksh dash posh; do $sh -c 'echo $0 $((~0))' $sh; done bash: /home/dualbus: syntax error: operand expected (error token is "/home/dualbus") zsh -1 ksh93 -1 mksh -1

Re: Curious... on readline history patch -- round up memory allocs?

2016-11-15 Thread Eduardo Bustamante
I think this is unnecessary, malloc (either the bash malloc in lib/malloc/malloc.c or the libc provided malloc) should already take care of requesting memory in page sized chunks. At least that's what I see here (morecore function):

Re: Curious... on readline history patch -- round up memory allocs?

2016-11-15 Thread Eduardo Bustamante
The change was in reference to this bug report: http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00107.html The problem was that bash tried to allocate memory from the start based on the value of HISTSIZE, but this proved problematic for users which used a large HISTSIZE to have unlimited

Re: Severe IFS glob bug needs patch [was: Setting IFS='*' causes bash to freeze on tab completion]

2016-11-03 Thread Eduardo Bustamante
I agree with everything, except calling it severe. This is self-inflicted harm, and easy to work around

Re: Severe IFS glob bug needs patch [was: Setting IFS='*' causes bash to freeze on tab completion]

2016-11-04 Thread Eduardo Bustamante
If you want to split with read, use a tempenv IFS: dualbus@hp:~/local/src/gnu/bash$ bash -c 'IFS="?" read a b c <<< "hello?world?xyz"; echo "$a"' hello If you want to split using word splitting: dualbus@hp:~/local/src/gnu/bash$ bash -c 'v="hello?world?xyz"; IFS="?"; set -- $v; unset

Re: Change in behavior

2016-12-13 Thread Eduardo Bustamante
On Tue, Dec 13, 2016 at 9:08 AM, Vladimir Marek wrote: [...] > $ cat configure > set -o posix > echo ${0.8} > echo after > > $ bash a.sh > 3.2.52(1)-release > a.sh: line 3: ${0.8}: bad substitution > after Is `a.sh' a copy of `configure'?

Re: Could bash do what make does?

2016-12-03 Thread Eduardo Bustamante
"build market"? What are you talking about? make was created with the sole purpose of build automation. The shell was created to provide a "human interface" to computer operators. These are very specific and different purposes. Are you going to start asking next to re-implement vi inside bash? to

Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess with Non-Zero Status

2016-12-30 Thread Eduardo Bustamante
On Thu, Dec 29, 2016 at 9:39 PM, Eduardo Bustamante <dual...@gmail.com> wrote: > I'm adding the bug-bash list, since I think this is actually a bug in > the parse_comsub function, or maybe in execute_command_internal. I > haven't been able to figure it out yet. What I do know is t

Re: [Help-bash] Bash Trap: How to Get Line Number of a Subprocess with Non-Zero Status

2016-12-29 Thread Eduardo Bustamante
On Thu, Dec 29, 2016 at 11:20 AM, Steve Amerige wrote: > I've posted a question to StackOverflow, but I'm hoping the experts here can > chime in. > > http://stackoverflow.com/questions/41346907/bash-trap-how-to-get-line-number-of-a-subprocess-with-non-zero-status > > In essence, I

Re: ssh does not source /etc/bash.bashrc, but manual execution of /bin/bash does it under specific circumstances

2016-12-20 Thread Eduardo Bustamante
Please read http://mywiki.wooledge.org/DotFiles#Remote_shell_logins (perhaps read http://mywiki.wooledge.org/DotFiles#Console_logins first). The key to understanding this is to know that there are three basic types of shell startup: - Login shell - Interactive shell - Non-login Non-interactive

Re: Bug report: Bash version 4.3.11: complete: -i: invalid option on TAB auto completion

2016-12-20 Thread Eduardo Bustamante
I cannot reproduce this on bash 4.4: dualbus@yaqui:~$ { for i in '-i' '\t' '\t' '\t' '\n' 'exit\n'; do sleep 1; printf -- "$i"; done } | script --command 'bash --norc --noprofile' Script started, file is typescript bash-4.4$ -i bash: -i: command not found bash-4.4$ exit

Re: q// / qq// syntax or built-ins please ?

2017-03-24 Thread Eduardo Bustamante
Remember that bash's grammar is derived from the specification of the POSIX shell (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html). Also, any addition to the bash grammar should be backwards compatible (or enabled with a shopt, disabled by default), to avoid breaking

[PATCH] Fix types in complete.c

2017-03-18 Thread Eduardo Bustamante
--- lib/readline/complete.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/readline/complete.c b/lib/readline/complete.c index 13241d13..726d51fb 100644 --- a/lib/readline/complete.c +++ b/lib/readline/complete.c @@ -2644,7 +2644,7 @@ rl_filename_completion_function

Re: lockup in bgp_delete()

2017-03-20 Thread Eduardo Bustamante
This was reported a month ago: http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00025.html

Re: echo x > a > b > c > d

2017-04-16 Thread Eduardo Bustamante
On Sun, Apr 16, 2017 at 6:42 PM, 積丹尼 Dan Jacobson wrote: > Maybe bash should catch this > $ echo x > a > b > c > d > and print a warning. > Same with > $ cat < a < b < c < d Why? These are perfectly valid grammatical constructs. What kind of warning are you expecting to see

Re: echo x > a > b > c > d

2017-04-16 Thread Eduardo Bustamante
On Sun, Apr 16, 2017 at 7:40 PM, 積丹尼 Dan Jacobson wrote: > OK sorry. I guess they make a lot of sense. These constructs are valid grammatically, and have a well defined semantic meaning. See: dualbus@debian:~$ strace -e open bash -c ': &1|tail -n5 open("a", O_RDONLY)

Re: Issus with popd and pushd

2017-04-18 Thread Eduardo Bustamante
On Mon, Apr 17, 2017 at 4:57 PM, Pete Smith wrote: [...] > So what's the possibility of adding -v option to popd and pushd??? Feel free to send patches. Under the hood, the pushd/popd builtins call the dirs builtin with no arguments after their execution, so it's just a

Re: Segfault when unsetting READLINE_LINE inside 'bind -x'

2017-04-23 Thread Eduardo Bustamante
On Sun, Apr 23, 2017 at 12:56 AM, Jaren Stangret wrote: > Hello, > > Instead of segfaulting, BASH should ensure READELINE_LINE is unset or set > and empty. I am able to reproduce this with the latest devel branch. Here's the stack trace: Program received signal SIGSEGV,

Re: Curious case of arithmetic expansion

2017-04-23 Thread Eduardo Bustamante
On Sun, Apr 23, 2017 at 3:25 PM, Florian Mayer wrote: [...] > Why not? Why is it not reasonable to expect an intuitive > result from (())? The most intuitive thing, in my opinion, > would be to use nameref for side effects by default, because in order > to get a value from an

Re: arithmetic problem, incorrect return code with ((var++)) when var is 0 before operation

2017-04-22 Thread Eduardo Bustamante
On Sat, Apr 22, 2017 at 12:49 PM, Andrew McGlashan wrote: [...] > > The return code from ((i++)) operation is different when i has an > initial value of 0. This is not a bug. Please read the Bash reference manual section on conditional constructs:

Re: Bug: UTF-8 expansion results in extra characters

2017-03-06 Thread Eduardo Bustamante
On Mon, Mar 6, 2017 at 6:50 AM, L A Walsh wrote: [...] > echo 'あa a '|wc -m > 6 > > There should only be 5 characters. use echo -n then. $ echo -n 'あa a '|wc -m 5

Re: Broken Termcaps

2017-03-01 Thread Eduardo Bustamante
El mié., mar. 1, 2017 3:46 PM, Eduardo Bustamante <dual...@gmail.com> escribió: > > > El mié., mar. 1, 2017 3:38 PM, Lfabbro <lfabbr...@protonmail.com> > escribió: > > [...] > > Bash Version: 4.4 > Patch Level: 12 > Release Status: release > > De

Re: Using Clang's static analyzer on bash

2017-04-26 Thread Eduardo Bustamante
On Wed, Apr 26, 2017 at 10:10 AM, Eduardo Bustamante <dual...@gmail.com> wrote: [...] > #1 optimized_assignment in variables.c does not check if xrealloc was > successful (i.e. not NULL), so if it fails, strcpy will end up > dereferencing a null pointer. I just noticed that xre

AddressSanitizer: heap-buffer-overflow lib/readline/bind.c:437 in rl_translate_keyseq

2017-04-27 Thread Eduardo Bustamante
dualbus@debian:~/src/gnu/bash$ xxd inputrc : 225c 432d 2230 3030 200a "\C-"000 . # with ASAN dualbus@debian:~/src/gnu/bash$ ./bash --noprofile --norc -ic 'bind -f inputrc' = ==27315==ERROR: AddressSanitizer:

free(): invalid next size (fast): 0x00005555558cac00 ***

2017-04-27 Thread Eduardo Bustamante
dualbus@debian:~/src/gnu/bash$ xxd bar : 3a22 3030 5c43 2d0a 3030 3030 3030 3030 :"00\C-. 0010: 3030 3030 3030 3030 3030 3030 3030 3030 # With system malloc (gdb) r --noprofile --norc -ic 'bind -f bar' Starting program: /home/dualbus/src/gnu/bash/bash

Memory leak in read_history_range when history file size is zero

2017-04-27 Thread Eduardo Bustamante
dualbus@debian:~/src/gnu/bash$ ./bash --noprofile --norc -ic 'HISTFILE=/dev/null; history -r' = ==24289==ERROR: LeakSanitizer: detected memory leaks Direct leak of 10 byte(s) in 1 object(s) allocated from: #0 0x7efe83383d28 in

Re: Syntax error near unexpected token `newline' within loops

2017-04-24 Thread Eduardo Bustamante
On Mon, Apr 24, 2017 at 7:44 AM, Greg Wooledge wrote: [...] > The outer (( )) in the C-style for loop already create an arithmetic > expression context. You don't need to use $(( )) inside them. You can > simply write: > > for (( INDEX=0; INDEX<10-${#V_NAME};; INDEX++ )) I

Re: AddressSanitizer: heap-buffer-overflow lib/readline/bind.c:437 in rl_translate_keyseq

2017-04-27 Thread Eduardo Bustamante
On Thu, Apr 27, 2017 at 2:35 PM, Chet Ramey wrote: [...] > Thanks for the report. This was an easy fix. You must be fuzzing > readline's key sequence parser. Yes. I'm currently trying a few approaches. I got this crash from: afl-fuzz -i i1/ -o o1/ -- ./bash/bash

AddressSanitizer: heap-use-after-free _rl_free_undo_list

2017-05-03 Thread Eduardo Bustamante
dualbus@debian:~/src/gnu/bash$ xxd ../cases/1 : 3010 1f0e0... dualbus@debian:~/src/gnu/bash$ cat -A ../cases/1 0^P^_^N To reproduce, - run: ./bash -c 'read -e' # it doesn't seem to happen for interactive bash - then type the following sequence: 0 \C-p

Re: Ignore-case option to readline disables nosort option to complete

2017-05-03 Thread Eduardo Bustamante
On Wed, May 3, 2017 at 8:59 AM, Jesper Nygårds wrote: > The following snippet is shows that if the readline > option completion-ignore-case is turned on, the nosort option to complete > has no effect: I'm unable to reproduce this using the code from the devel branch:

Bash parser segmentation fault

2017-05-03 Thread Eduardo Bustamante
dualbus@debian:~/src/gnu/bash$ cat -v ~/segfault 0 i[$($(0(){a[$(($(0)))}>)) dualbus@debian:~/src/gnu/bash$ xxd ~/segfault : 3020 695b 2428 2428 3028 297b 615b 2428 0 i[$($(0(){a[$( 0010: 2824 2830 2929 297d 3e29 29 ($(0)))}>)) dualbus@debian:~/src/gnu/bash$ ./bash -n

Re: Inconsistent behavior between 'wait' and 'builtin wait'

2017-05-03 Thread Eduardo Bustamante
On Wed, May 3, 2017 at 8:27 AM, Chet Ramey wrote: > Both waits should return the same exit status. Using `builtin' should not > conceal that aspect of wait's behavior. FWIW, I can reproduce this in the latest devel branch: dualbus@debian:~/src/gnu/bash$ ./bash -c 'trap :

Bash parser segmentation fault with arithmetic for loop

2017-05-03 Thread Eduardo Bustamante
(gdb) r -nvc 'for ((;)) do :; done&' Starting program: /home/dualbus/src/gnu/bash/bash -nvc 'for ((;)) do :; done&' for ((;)) do :; done& /home/dualbus/src/gnu/bash/bash: -c: line 0: syntax error: arithmetic expression required /home/dualbus/src/gnu/bash/bash: -c: line 0: syntax error: `((;))'

Re: Bash parser segmentation fault

2017-05-03 Thread Eduardo Bustamante
On Wed, May 3, 2017 at 9:40 AM, Eduardo Bustamante <dual...@gmail.com> wrote: [...] Here are more cases, which seem to just be variations that trigger the same bug on different paths: dualbus@debian:~/bash-fuzzing/bash-parser$ for f in minimized/*; do printf '\n\n%s\n' ---; cat -v "

Re: memory leak in bash

2017-05-11 Thread Eduardo Bustamante
On Thu, May 11, 2017 at 3:47 AM, wuzongyong (A) wrote: [...] > My bash version is version 4.2.46(1)-release, valgrind version is 3.11.0 , > could someone help to tell me if it is a bug please? And I wanna to know the > deeply level reason. Try with a more recent

Bash doesn't handle C with acute accent properly during readline's rl_change_case

2017-05-11 Thread Eduardo Bustamante
The C with acute accent character: https://en.wikipedia.org/wiki/%C4%86 - Upper case dualbus@debian:~$ printf '\U0106\n' Ć - Lower case dualbus@debian:~$ printf '\U0107\n' ć Now, in bash, if you type in ć, then run readline `upcase-word' on it, instead of ending up with the UTF-8 multibyte

Re: read -e allows execution of commands (edit-and-execute-command) as the shell's process user

2017-05-11 Thread Eduardo Bustamante
On Tue, May 9, 2017 at 3:28 PM, Chet Ramey wrote: [...] > This would be a great project for someone who wanted to help. Thanks. I'll familiarize myself with the tools and try to send a patch.

Re: Infinite loop in rl_forward_word

2017-05-11 Thread Eduardo Bustamante
On Tue, May 9, 2017 at 9:28 AM, Eduardo Bustamante <dual...@gmail.com> wrote: [...] >From what I can tell, it seems like the problem is that `set-mark' allows you to set a negative rl_mark, and then you can use `exchange-point-and-mark' to place that negative rl_mark into rl_point. A s

Re: read -e allows execution of commands (edit-and-execute-command) as the shell's process user

2017-05-08 Thread Eduardo Bustamante
On Mon, May 8, 2017 at 3:09 PM, Chet Ramey wrote: > There's no compelling reason to disallow it. If a system administrator > wants to unbind certain readline commands (and unset INPUTRC!) to protect > against a specific use case, he is free to do that. I agree. I changed my

Re: Infinite loop in bash glob matching

2017-05-17 Thread Eduardo Bustamante
On Tue, May 16, 2017 at 2:36 PM, Zoltán Herczeg wrote: [...] > bash version: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) > This command hangs in any directory on my machine (I don't have a directory > without a dot file): > > ls @(@()). Yeah, I can reproduce

Segmentation fault in skip_to_delim / bash_directory_completion_hook

2017-05-15 Thread Eduardo Bustamante
dualbus@debian:~/bash-fuzzing/read-readline$ base64 < output/17/crashes/id:000288,sig:11,src:017460+007808,op:splice,rep:8 GxEWGS8YR94ZZB6QGzeQfzcbN45kAh6QGzeQGzcbNxF//y8YRwEaHB6QG+3t7e3t7efte3t7e94u +pYBGxsbKegDVP8BGxlgBHt7e3t7e3sQlvwAcQ7/IuAMFBAbGxsrAKEBAJqampqSljyAFH8bGxlU

Segmentation fault in expassign when PS1='$[U[0S]+=]'

2017-05-15 Thread Eduardo Bustamante
Starting program: /home/dualbus/src/gnu/bash/bash bash-4.4$ PS1='$[U[0S]+=]' bash: 0S: value too great for base (error token is "0S") bash: : syntax error in expression (error token is "U") $[U[0S]+=] bash: 0S: value too great for base (error token is "0S") Program received signal SIGSEGV,

Re: Compiling bash statically in 4.2/4.3/4.4 with GCC 6.1.0

2017-05-12 Thread Eduardo Bustamante
FWIW, I'm able to compile bash statically with: dualbus@debian:~/src/gnu/bash$ ./configure --enable-static-link --without-bash-malloc [...] dualbus@debian:~/src/gnu/bash$ make [...] dualbus@debian:~/src/gnu/bash$ file bash bash: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically

Re: Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'

2017-05-12 Thread Eduardo Bustamante
On Fri, May 12, 2017 at 7:42 AM, Eduardo Bustamante <dual...@gmail.com> wrote: [...] > Bash is still in `parse_matched_pair'- This *seems* to fix it, but I actually have no clue if this is correct, or if more cleanup is required prior to the longjmp. I also removed `rl_forced_updat

Re: Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'

2017-05-12 Thread Eduardo Bustamante
On Fri, May 12, 2017 at 8:35 AM, Chet Ramey wrote: [...] > The command is executed in a separate context, exactly the same as > running fc on a command from the history file (in fact, that's what > happens). It's meant to not affect the contents of the current > command

Re: Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'

2017-05-12 Thread Eduardo Bustamante
On Fri, May 12, 2017 at 9:44 AM, Eduardo Bustamante <dual...@gmail.com> wrote: [...] > - dash (compiled with libedit support): If you type then > return, then ESC-v, it will open the editor on an empty file, and... > well, it nothing of what it does really makes sense. [...] >

Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'

2017-05-12 Thread Eduardo Bustamante
This issue came up in the following help-bash thread: http://lists.gnu.org/archive/html/help-bash/2017-05/msg1.html Write: then hit return. Bash will output the secondary prompt, because it expects the user to close the single quote. Run `edit-and-execute-command' to fix the input (e.g. ).

Re: unalias works weirdly inside an if-then block

2017-05-12 Thread Eduardo Bustamante
On Fri, May 12, 2017 at 7:33 AM, Gabor Burjan wrote: [...] > Description: > unalias works weirdly inside an if-then block It's not just an if-then block. It's any kind of block: dualbus@debian:~$ bash alias + shopt -s expand_aliases + alias 'x=echo x'

Bash segmentation fault in readline's update_line

2017-05-12 Thread Eduardo Bustamante
dualbus@debian:~/bash-fuzzing/read-readline$ base64 update_line 秧秧秧 MBs4MOenpzAwMDAwMDAwMBs4OOenpwESGQ== Core was generated by `/home/dualbus/src/gnu/bash/bash -c read -e'. Program terminated with signal SIGSEGV, Segmentation fault. #0 __memcmp_sse4_1 () at

Re: Bash stays in the secondary prompt (PS2) after completing a command with `edit-and-execute-command'

2017-05-13 Thread Eduardo Bustamante
On Fri, May 12, 2017 at 10:29 AM, Chet Ramey wrote: [...] > Because it doesn't say the equivalent of "execute the current command > line" (as newline does), it's a standard editing command that continues > with the current line buffer. The only thing that gets executed are

Re: How to call a bash-func from readline? && how to call rl-func from bash?

2017-05-13 Thread Eduardo Bustamante
On Sat, May 13, 2017 at 5:14 PM, L A Walsh wrote: > How might one programatically call a bash > function from readline, and pass information from that function > back into readline? For that, you'd use a combination of `bind -x', READLINE_LINE and READLINE_POINT. For example, if

Re: Segfault when closing piped stdin on 4.4.11

2017-05-15 Thread Eduardo Bustamante
On Mon, May 15, 2017 at 8:09 PM, Elliott Cable wrote: > I'm no shell-script master, but this is segfaulting my Bash, and I was > able to reproduce it on a couple different systems (including the #bash > shbot :P): > > echo '_() { exec <&- ;}; _ "$0" "$@"' >bleh.sh > cat

Infinite loop in rl_forward_word

2017-05-09 Thread Eduardo Bustamante
dualbus@debian:~/bash-fuzzing/read-readline$ base64 loop AAAbLbUA9loQGDIYLhwYGBkYGJgYGBj4FwAYYBlEAERLG0YK dualbus@debian:~/bash-fuzzing/read-readline$ od -c loop 000 \0 \0 033 - 265 \0 366 Z 020 030 2 030 . 034 030 030 020 031 030 030 230 030 030 030 370 027 \0 030 ` 031 D

Re: Remaining memory corruption bugs in readline

2017-06-09 Thread Eduardo Bustamante
On Fri, Jun 9, 2017 at 4:59 PM, Chet Ramey wrote: [...] > It's an off-by-one error. Thank you! Do you have a patch? I want to run the patched version against the corpus of crashing inputs that I have to see if there are any remaining.

Re: Read builtin -e (readline) oddities

2017-06-19 Thread Eduardo Bustamante
On Mon, Jun 19, 2017 at 9:57 AM, Eduardo A. Bustamante López wrote: [...] > Hm, I can still reproduce it under Debian 9, using the `devel' branch, and I'm > sure no startup files are being sourced. > > dualbus@debian:~/src/gnu/bash-builds/devel$ ./bash --norc --noprofile >

Re: Bug in select-command

2017-06-24 Thread Eduardo Bustamante
On Sat, Jun 24, 2017 at 9:46 AM, Eduardo A. Bustamante López wrote: [...] > For some reason though, the following fails to update the value of COLUMNS: [...] > echo \$- $- > echo cols $(tput cols) > command true # this should trigger? > select opt in "${options[@]}"; do

Re: bash sigabrt

2017-06-20 Thread Eduardo Bustamante
On Tue, Jun 20, 2017 at 9:12 AM, Rajaa, Mukuntha (Nokia - IN/Bangalore) wrote: > Hi, > > Bash-4.4.12(1) release occasionally coredumps. This was tested on mips64 > platform. Could you please confirm, is this a known bug or should I raise a > ticket for this ? This

Re: {varname} redirection for a command or group leaves the file open

2017-05-19 Thread Eduardo Bustamante
On Fri, May 19, 2017 at 3:32 PM, wrote: [...] > I'd really like to see Bash get on the right side of this issue - and > the sooner the better. There is no right side. Only two opposing viewpoints. I don't think it's enough to justify the change breaking backwards

Re: Bash feature request: provide state data pointer and unset_func for dynamic variables

2017-05-19 Thread Eduardo Bustamante
On Fri, May 19, 2017 at 12:08 PM, wrote: [...] > Anyway, I thought I'd float the idea and see if it might be a > possibility. Feel free to send patches. Could you provide examples on how you expect this to be used? I'm having a hard time trying to understand how this

Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-05-23 Thread Eduardo Bustamante
(I think this is a good problem for Pranav to tackle if you consider this to be a bug, Chet). Current behavior: dualbus@debian:~$ bash -c 'read -n0 <<< "abc"; declare -p REPLY' declare -- REPLY="abc" dualbus@debian:~$ bash --version|head -n1 GNU bash, version 4.4.11(1)-release

Builtin history -r does not work with named pipes (i.e. GNU readline's histfile.c read_history_range)

2017-05-23 Thread Eduardo Bustamante
(I think this is a good problem for Pranav to tackle if you consider this to be a bug, Chet). The problem is that fstat(2) will return an st_size of 0 if the file is non-regular. I think that the easiest path here is to goto `error_and_exit' if `file' is not a regular file (and perhaps print a

Re: PWD not made canonical on shell start

2017-05-23 Thread Eduardo Bustamante
On Tue, May 23, 2017 at 8:51 AM, wrote: [...] > Bash Version: 4.3 > Patch Level: 48 > Release Status: release I can reproduce with 4.4.11(1)-release and the latest devel branch [...] > As implemented, I now have to start every shell script that > uses

Re: {varname} redirection for a command or group leaves the file open

2017-05-21 Thread Eduardo Bustamante
FWIW, this seems to "fix" the issue. dualbus@debian:~/src/gnu/bash$ git diff -- redir.c diff --git a/redir.c b/redir.c index 68741dbb..8113ae3b 100644 --- a/redir.c +++ b/redir.c @@ -906,6 +906,7 @@ do_redirection_internal (redirect, flags) close (fd); return

Re: Interested in contributing to Bash

2017-05-21 Thread Eduardo Bustamante
On Sun, May 21, 2017 at 5:44 AM, Pranav Deshpande wrote: [...] > Any guidance on so as how to get started? Are there any tasks that I can > take up so that I get introduced to the code base. My recommendations would be: - Clone the git repository

Re: History Feature issue

2017-05-21 Thread Eduardo Bustamante
On Sun, May 21, 2017 at 11:29 AM, Pranav Deshpande wrote: > The lssue here: https://savannah.gnu.org/support/?109000 interests me. > It's something that I have experienced while using the shell. I am > interested in solving it That bug report lacks detail. There are

Re: Non-empty associative array considered not-set by -v test

2017-05-27 Thread Eduardo Bustamante
On Sat, May 27, 2017 at 2:07 PM, 林博仁 wrote: [...] Please read the discussions in https://lists.gnu.org/archive/html/bug-bash/2016-06/msg00067.html and https://lists.gnu.org/archive/html/bug-bash/2014-11/msg00099.html When you use an associative array without an explicit

AddressSanitizer: heap-use-after-free ../../../bash/lib/readline/display.c:2092 in update_line

2017-05-19 Thread Eduardo Bustamante
Run with: bash -c 'read -e' < file # patched bash File base64: KgMSGQX//wD/NBs1NTUbNRITNTU13TVGFgkVNTU1NdA1RhYJBTUzNdA1Rp4HB2BJYAcH9QcGAAAL C2AzNdA1Rj0HB2BJBwYAAAsLAQBgYAIAgAiZgBVZYCAbAAEArq6urq6urq6urq6u/4Cu rq6urq6urq6urq4AAWAZGRkZ5AAQGv9AoBsF The error under ASAN: ==31690==ERROR:

Infinite loop in readline's noninc_search

2017-05-19 Thread Eduardo Bustamante
Ran: bash -c 'read -e' < file # patched read to read from file file Base64: L/sFfwh+NRgqGHUcb39AfxsDAAACAIABIf+qANqAABsF6+M8KDyAAP7/qgDagAAbBevj T0wgTYAnAAIAJgkJAAD+/6r///8JCQkAAAIA5vYJCQl6GzgAvBTgJf22G4A3/xuFhYWFhYVw

Re: Infinite loop in bash glob matching

2017-05-16 Thread Eduardo Bustamante
On Tue, May 16, 2017 at 2:48 AM, Zoltán Herczeg wrote: > Hi, > > bash enter an infinite loop for this glob: > > ls @(@()). It works fine for me. What version of Bash are you using? And, what files are in the directory you're testing in? dualbus@debian:~/t$ ls a.1 a.2 a.3

Re: RFE: Please allow unicode ID chars in identifiers

2017-06-01 Thread Eduardo Bustamante
On Thu, Jun 1, 2017 at 7:42 PM, L A Walsh wrote: > It would be a useful upgrade besides being a "good world citizen" ;-). [...] I honestly fail to see the usefulness of such upgrade. It'll just increase the complexity of the parser, to get what, emojis? Do you have an example of

Re: Builtin read with -n0 or -N0 (nchars == 0) behaves as a read with no -n/-N argument

2017-06-04 Thread Eduardo Bustamante
On Sun, Jun 4, 2017 at 12:16 AM, dualbus wrote: [...] > Although there's a problem with the solution: > > dualbus@debian:~$ for sh in bash ~/src/gnu/bash-build/bash ksh93 mksh; do > $sh -c ': | read -n 0; echo $?'; done > 1 > 0 > 1 > 1 > > Since the read(2) system

Re: [PATCH] Memory leak in locale.c set_default_locale

2017-06-08 Thread Eduardo Bustamante
still reachable: 347,442 bytes in 2,885 blocks ==333== suppressed: 0 bytes in 0 blocks ==333== Rerun with --leak-check=full to see details of leaked memory ==333== ==333== For counts of detected and suppressed errors, rerun with: -v ==333== ERROR SUMMARY: 0 errors from 0 contexts (suppr

Re: Trailing newlines disappear

2017-06-08 Thread Eduardo Bustamante
On Thu, Jun 8, 2017 at 3:56 PM, Greg Wooledge wrote: > On Thu, Jun 08, 2017 at 10:44:29PM +0200, Geir Hauge wrote: >> You can pick one of these instead: >> >> mapfile < "$file"; IFS= foo="${MAPFILE[*]}"; unset -v IFS >> >> or >> >> mapfile < "$file"; printf -v foo %s

AddressSanitizer: heap-buffer-overflow in rl_tilde_expand

2017-06-15 Thread Eduardo Bustamante
CooKCgoKCgoKCgo KCgoKCgoHR4eHhgxnGA8Iz0L3d3d3d3d3d3d3d3d8t3d3d3d3d3d3d3d3d3d3d3dIAABfQQyY/wZ ENobBQ== -- Eduardo Bustamante https://dualbus.me/

AddressSanitizer: global-buffer-overflow in rl_filename_completion_function

2017-06-15 Thread Eduardo Bustamante
G1QEGxsbG1QAQCsAl+2WEBsbGwobFJYUGxsbSAAAQAAAg+2WEBsbGwrqdwAR+nx8YoB/aNkDMmRR UVFR/fwAdgQbAhtdGxsfAIAUAACiEPwAlgQbAv1TGxUbABsbGVT//3//lgTelhQbGht7e/ogA1T/ GxtTJAp5G/8aDBSUAAR7/3t7e/oMFJQABHt7e3u/3hEUlhQbGxsqAKEUAoAAGxsbOBsfGxsE/+0F -- Eduardo Bustamante https://dualbus.me/

AddressSanitizer: heap-buffer-overflow in rl_delete

2017-06-15 Thread Eduardo Bustamante
lJS UlJSUlJSUlJSUlJSUlJSUlJSbvIbBQ== -- Eduardo Bustamante https://dualbus.me/

AddressSanitizer: heap-buffer-overflow in rl_search_history

2017-06-15 Thread Eduardo Bustamante
CwMAAABAEhIBj48yAP//8H+A/9h/gM4SEjMDEhISAxISEhMS EgMA/xLMzACA//8BAMyAHf0AgADOEhIzAxISEgMSEhITEhIDAP8SzMwAgP//AQDMgB397cAQ 6BISExISzMx/jxwAdIASEhIDEh8gAxISAY+PAAD///+dgM4SEhISEgCd9gASEgMBGxI0LRIT gI8DAH9Xj2SPjhISEun//xKDj4+PjwIKIg== -- Eduardo Bustamante https://dualbus.me/

Re: cygheap base mismatch detected

2017-06-15 Thread Eduardo Bustamante
On Thu, Jun 15, 2017 at 11:30 AM, Jon Morris wrote: > Hi, > > Just tried to submit a bug, but bashbug command failed, so here is the > problem text. > > Thanks, > > Jon Please report this to the Cygwin folks. This is not a bash issue.

Re: cygheap base mismatch detected

2017-06-15 Thread Eduardo Bustamante
On Thu, Jun 15, 2017 at 1:19 PM, Eduardo Bustamante <dual...@gmail.com> wrote: [..] > Please report this to the Cygwin folks. This is not a bash issue. Err, not the Cygwin folks. You seem to be using Cmder, so ask them.

Re: Why does 'connect' take so long (sometimes) and can't be interrupted?

2017-06-15 Thread Eduardo Bustamante
On Thu, Jun 15, 2017 at 10:36 AM, wrote: [...] > Description: > This is a little complicated and I can't give you full details on how > to > replicate it, since I don't fully understand it myself. But under > certain > circumstances, the following

Re: Buffer corruption when the terminal is resized.

2017-06-10 Thread Eduardo Bustamante
effect that you're experiencing. Try with: # v- this is an invisible sequence. PS1='\[\e]0;\]\u@\h:\w\a\$...' # ^ ^ instead. -- Eduardo Bustamante https://dualbus.me/

  1   2   3   >