Re?? bash encountered a coredump issue with stepping on memory
> Hi. This appears to happen when creating a shell variable from the initial > environment. I can't reproduce it. If you can find a way to reliably > reproduce it, please let me know and we can work on it. I'm sorry, the environment is quite complex and I couldn't find a way to reliably reproduce it . Currently, there is only coredump information available. If I find a way to reliably reproduce it, I will inform you immediately.
Re: Newlines resulting from alias expansion are ignored by here-document processing
On 11/30/23 3:45 AM, gldrk wrote: $ cat test alias 'foo=cat
Re: Newlines resulting from alias expansion are ignored by here-document processing
On Tue, Dec 5, 2023, 17:22 Chet Ramey wrote: > On 11/30/23 3:45 AM, gldrk wrote: > > $ cat test > > alias 'foo=cat < > hello' > > foo > > world > > EOF > > $ sh test > > world > > test: line 5: hello: command not found > > > > My reading of the upcoming POSIX revision > > (https://www.austingroupbugs.net/view.php?id=953#c4214) > > is that they should be treated just like newline tokens coming from the > > source. > > Thanks for the report. Reading here-documents from aliases is a known > issue. There will be an initial fix in the next devel branch push. > i hope u rather extend than limit , the aliases stuff 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/ > >
TAB completion bug
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 uname output: Linux aspire 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.2 Patch Level: 21 Release Status: release Description: Tested on git (2023-12-06). For the (admitedly weirdly named) dirs below TAB completion does not work correctly. Repeat-By: #!/bin/bash # TAB works # $ ls -l ta # # Tab completes but is escaped wrongly: # $ ls -l ta # mkdir -p 'tab/ `/tmp/trip`>/tmp/tripwire; '"'"'@ # $ ls -l tw # But the last should include tmp mkdir -p 'two/ >/tmp/tripwire; '"'"'@
Re: TAB completion bug
On Tue, 5 Dec 2023 23:46:51 + Ole Tange via Bug reports for the GNU Bourne Again SHell wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 > uname output: Linux aspire 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 > 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux > Machine Type: x86_64-pc-linux-gnu > > Bash Version: 5.2 > Patch Level: 21 > Release Status: release > > Description: > Tested on git (2023-12-06). > > For the (admitedly weirdly named) dirs below TAB completion does not work > correctly. > > Repeat-By: > #!/bin/bash > > # TAB works > # $ ls -l ta > # > # Tab completes but is escaped wrongly: > # $ ls -l ta > # I can confirm this for both 5.2.21 and the development branch. The backticks are not quoted as they ought to be, resulting in a command substitution. > > mkdir -p 'tab/ > `/tmp/trip`>/tmp/tripwire; > '"'"'@ > # These give the same > # $ ls -l tw > # $ ls -l tw > # But the last should include tmp I was not able to reproduce this, however. $ cd ta $ echo "${PWD@Q}" $'/home/kerin/tange/tab/\n`/tmp/trip`>' $ cd ../../../.. $ cd ta $ echo "${PWD@Q}" $'/home/kerin/tange/tab/\n`/tmp/trip`>/tmp' That was with programmable completion disabled (shopt -u progcomp) and the following directory structure in place. $ LC_ALL=C find . -mindepth 1 -exec ls -1d --quoting-style=c {} + "./tab" "./tab/\n`" "./tab/\n`/tmp" "./tab/\n`/tmp/trip`>" "./tab/\n`/tmp/trip`>/tmp" "./tab/\n`/tmp/trip`>/tmp/tripwire;\n'@/tmp/tripwire;\n'@
Re: TAB completion bug
On Wed, 6 Dec 2023 05:43:43 + Kerin Millar wrote: > On Tue, 5 Dec 2023 23:46:51 + > Ole Tange via Bug reports for the GNU Bourne Again SHell > wrote: > > > Configuration Information [Automatically generated, do not change]: > > Machine: x86_64 > > OS: linux-gnu > > Compiler: gcc > > Compilation CFLAGS: -g -O2 > > uname output: Linux aspire 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 > > 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux > > Machine Type: x86_64-pc-linux-gnu > > > > Bash Version: 5.2 > > Patch Level: 21 > > Release Status: release > > > > Description: > > Tested on git (2023-12-06). > > > > For the (admitedly weirdly named) dirs below TAB completion does not > > work correctly. > > > > Repeat-By: > > #!/bin/bash > > > > # TAB works > > # $ ls -l ta > > # > > # Tab completes but is escaped wrongly: > > # $ ls -l ta > > # > > I can confirm this for both 5.2.21 and the development branch. The backticks > are not quoted as they ought to be, resulting in a command substitution. > > > > > mkdir -p 'tab/ > > `/tmp/trip`>/tmp/tripwire; > > '"'"'@ > > > # These give the same > > # $ ls -l tw > > # $ ls -l tw > > # But the last should include tmp > > I was not able to reproduce this, however. Apologies. I had overlooked the presence of the second mkdir command entirely. Indeed, it does not complete. -- Kerin Millar
Re: TAB completion bug
The problem seems to be not treating a single quote that follows a backslash as the end of a single-quoted string. diff --git a/bashline.c b/bashline.c index 774f813f..b1837d43 100644 --- a/bashline.c +++ b/bashline.c @@ -4077,15 +4077,13 @@ bash_dequote_filename (char *text, int quote_char) ret = (char *)xmalloc (l + 1); for (quoted = quote_char, p = text, r = ret; p && *p; p++) { - /* Allow backslash-escaped characters to pass through unscathed. */ - if (*p == '\\') + /* Allow backslash-escaped characters to pass through unscathed, + unless in single quotes */ + if (quoted != '\'' && *p == '\\') { - /* Backslashes are preserved within single quotes. */ - if (quoted == '\'') - *r++ = *p; /* Backslashes are preserved within double quotes unless the character is one that is defined to be escaped */ - else if (quoted == '"' && ((sh_syntaxtab[(unsigned char)p[1]] & CBSDQUOTE) == 0)) + if (quoted == '"' && ((sh_syntaxtab[(unsigned char)p[1]] & CBSDQUOTE) == 0)) *r++ = *p; *r++ = *++p;