On Sun, Apr 18, 2021, 7:13 PM Ananth Chellappa wrote:
> Far as I understand, there is no
> way to accomplish what I want - concisely : *get a true private mode* (no
> logging to HISTFILE *OR* recall with history command after exiting
> private-mode (toggle of history using set -/+ o) *without sac
history-search-* commands segfault on the devel branch since the size_t
changes
---
lib/readline/search.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/readline/search.c b/lib/readline/search.c
index b7be876f..525c9c69 100644
--- a/lib/readline/search.c
+++ b/lib/readlin
After the changes in
https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=9e3495c9,
I sometimes get segfaults when performing a bunch of history
navigations followed by ^C.
Small reproducer from some input fuzzing and debugger output below.
cat >/tmp/hist <<'EOF'
X
XX
EOF
cat >/tmp/brc
$ ./bash -c 'case x in x) if ((1)); then :; fi ;; esac'
parse.y:974:82: runtime error: index -1 out of bounds for type 'int[257]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior parse.y:974:82 in
=
==52960==ERROR: AddressSaniti
./bash --norc -in <<<$'\\\n.'
bashhist.c:899:8: runtime error: addition of unsigned offset to
0x00010700d190 overflowed to 0x00010700d18f
ERROR: AddressSanitizer: heap-buffer-overflow on address
0x00010700d18f at pc 0x0001045fe1b8 bp 0x00016bb1f350 sp
0x00016bb1f348
READ of size 1 at 0x00010700d1
happens when attempting spell-correct-word on an empty line
./bash --norc -in <<<$'\030s'
ERROR: AddressSanitizer: heap-buffer-overflow on address
0x000102e0d0d1 at pc 0x0001004ccf64 bp 0x00016fdf0e30 sp
0x00016fdf0e28
READ of size 1 at 0x000102e0d0d1 thread T0
frame #5: 0x0001004ccf64 b
mkdir -p /tmp/bin
>'/tmp/bin/$'
chmod +x '/tmp/bin/$'
PATH=/tmp/bin ./bash --norc -in <<<$'\e*'
ERROR: AddressSanitizer: heap-buffer-overflow on address
0x0001039a9913 at pc 0x0001004d57b4 bp 0x00016fdf1350 sp
0x00016fdf1348
WRITE of size 1 at 0x0001039a9913 thread T0
frame #5: 0x0001004d
On Wed, Mar 8, 2023 at 4:28 PM Moshe Looks wrote:
> This is very old code and I have no idea what the original intention
> was in returning 'name' here or if doing so is still performing useful
> work, but the tests pass at least.
A null $PATH component is treated as the current directory, and ba
./bash --norc -O noexpand_translation -in <<<'$":"'
=ERROR: AddressSanitizer: heap-use-after-free on address 0x000108102b40
READ of size 1 thread T0
#0 read_token_word parse.y:5236
#1 read_token parse.y:3618
freed by thread T0 here:
#1 read_token_word parse.y:5231
#2 read_token pa
Also in parse_matched_pair:
diff --git a/parse.y b/parse.y
index 0a8c039a..1001ac1b 100644
--- a/parse.y
+++ b/parse.y
@@ -3906,14 +3906,13 @@ parse_matched_pair (int qc, int open, int
close, size_t *lenp, int flags)
/* Locale expand $"..." here. */
/* PST_NOEXPAND */
ttrans = locale_e
A few functions in bashline.c free static variables but do not assign
to them until after calling bash_tilde_expand, which may
throw_to_top_level. If SIGINT is received at an inopportune time,
these variables may be free-d again.
diff --git a/bashline.c b/bashline.c
index 2745c4dd..b5c0a49f 10064
bash_glob_complete_word modifies rl_filename_quoting_function, which
can fail to be restored if bash_tilde_expand handles a SIGINT while
glob-complete-word is running
Handling the restore in bashline_reset() seems to solve the issue:
diff --git a/bashline.c b/bashline.c
index 2745c4dd..7c3812eb 1
On Mon, Mar 6, 2023 at 9:16 AM Chet Ramey wrote:
> Thanks for the report. It's the specific combination of `if' and the `(('
> command that causes the problem.
Looks like same thing also happens when `if' is followed by a newline
./bash -c $'case $LINENO in 0) if\n:; then echo FAIL; fi esac'
bas
The relevant code was added in
https://git.savannah.gnu.org/cgit/bash.git/commit/?id=da43077 with
similar additions to both gmatch and extmatch, but I suspect the test
on line 912 was not meant to be in extmatch:
> .a
bash -O extglob -O dotglob -c ': ./!(.foo)'
ERROR: AddressSanitizer: heap-buffe
It seems that if a trap handler for a terminating signal resends its
own signal (after resetting the signal disposition), any configured
EXIT trap will be executed (as I think is expected), but only if an
EXIT trap had already been set prior to the the first instance of a
trap having been set for t
compgen's glob matching does not respect dotglob being turned on or
off unless some other globbing takes place between the setting being
changed and compgen being called:
$ cd "$(mktemp -d)"
$ > .x
$ bash -c 'shopt -s dotglob; compgen -G \*'
$ bash -c 'shopt -s dotglob; : *; compgen -G \*'
.x
When HISTTIMEFORMAT is set and history file truncation is performed,
the first line of the history file (i.e. the timestamp of the first
entry) seems to always be missing
> /tmp/hist
HISTTIMEFORMAT= HISTFILESIZE=3 HISTFILE=/tmp/hist bash --norc -in <<<$'1\n2\n3'
$ cat /tmp/hist
1
#1679274410
2
#1
If a command substitution inside a parameter expansion has a command
followed by a newline, bash prints an error message (though the
command is parsed and saved in the history list correctly):
bash --norc -in <<<$'${_+$(:\n)}\n!!'
$ ${_+$(:
bash: command substitution: line 3: unexpected EOF while
Completion state is not fully restored after invoking `compgen' within
a competition function.
Normally, if a compspec does not specifically include one of the
options that triggers filename completion, the generated completions
are not treated as filenames:
$ complete -W '/tmp /var' cmd
$ cmd /[
If an EXIT trap is executed after receipt of a terminating signal,
waiting on a process substitution within the trap can fail:
$ (trap 'wait $!; echo $?' EXIT; : <(:); kill 0)
-bash: wait: pid 83694 is not a child of this shell
127
Interestingly, if an external command or a subshell is executed a
On Mon, Mar 20, 2023 at 10:57 AM Chet Ramey wrote:
>
> On 3/17/23 1:28 PM, Grisha Levit wrote:
> > It seems that if a trap handler for a terminating signal resends its
> > own signal (after resetting the signal disposition), any configured
> > EXIT trap will be executed
On Tue, Mar 21, 2023 at 3:28 PM Chet Ramey wrote:
>
> > Interestingly, if an external command or a subshell is executed after
> > the process substitution is started but prior to receipt of the
> > signal, the `wait' works fine:
> >
> > $ (trap 'wait $!; echo $?' EXIT; : <(:); (:); kill 0)
>
> Bec
On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey wrote:
> OK, say you did in fact run compgen in the foreground -- very unusual
> because it's awkward to capture the possible completions that way -- to
> generate completions.
Sorry I should have explained. I hit this issue because I was using
compgen i
On Tue, Mar 21, 2023 at 4:11 PM Chet Ramey wrote:
> OK, which do you think would be the more common case? Wanting the options
> used to generate completions to persist or using it in this way?
Usually people do `COMPREPLY=($(compgen ...))' (or write to stdout in
a command specified with `complete
On Tue, Mar 21, 2023 at 5:26 PM alex xmb ratchev wrote:
> On Tue, Mar 21, 2023, 21:05 Grisha Levit wrote:
>>
>> compgen -G 'foo/*' >/dev/null && COMPREPLY=(bar)
>
> i dont get that code at all , but i like idea of speedier file filling .. can
> u e
On Tue, Mar 21, 2023 at 5:52 PM alex xmb ratchev wrote:
> On Tue, Mar 21, 2023, 22:42 Grisha Levit wrote:
>> Let's say you want to know if there are any entries starting with
>> `foo' in the current directory. You can do:
>
> i see , thank you sir
> i .. mostly
On Mon, Mar 20, 2023 at 4:59 PM Chet Ramey wrote:
> Thanks, it's an easy fix to preserve the newline here.
FWIW even with the latest fixes, this kind of nesting in a history
entry still triggers ASAN:
bash --norc -in <<<$'${_+$(\n \cP\en '
ERROR: AddressSanitizer: heap-buffer-overflow
READ of s
another size_t issue
diff --git a/bashline.c b/bashline.c
index 0047caef..9df26d2e 100644
--- a/bashline.c
+++ b/bashline.c
@@ -919,7 +919,7 @@ hostnames_matching (const char *text)
continue;
/* OK, it matches. Add it to the list. */
- if (nmatch >= (rsize - 1))
+ if ((n
bash --norc -in <<<$'"\e\cE'
ERROR: AddressSanitizer: negative-size-param: (size=-1)
#0 wrap_strncpy+0x228
#1 expand_string_dollar_quote subst.c:4108
#2 shell_expand_line bashline.c:2887
probably not the cleanest fix but the issue is here:
diff --git a/subst.c b/subst.c
index 2ff9b7c
---
lib/sh/oslib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sh/oslib.c b/lib/sh/oslib.c
index ab7924df..85f7b491 100644 --- a/lib/sh/oslib.c
+++ b/lib/sh/oslib.c @@ -161,7 +161,7 @@ getdtablesize (void) # undef bcopy
# endif void
-bcopy (void *s, *d, size_t n)
+bcop
If $var is non-empty and not a valid a number, {var}>&- silently closes fd
0.
var=x; (exec {var}>&-; test -e /dev/fd/0); echo $?
1
Seems like the test of the return value of legal_number is incorrect.
---
redir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/redir.c b/redir
$ declare -n ref=arr[1]
$ arr=(A); (echo "${ref=X} ${ref}")
A X
$ arr=( ); (echo "${ref=X} ${ref}")
Segmentation fault: 11
Expanding the nameref while still in parameter_brace_expand seems to do the
right thing though I can't say I'm fully confident in this.
diff --git a/subst.c b/subst.c
index 5
: Grisha Levit
Date: Thu, 13 Apr 2023 04:14:18 -0400
Subject: [PATCH] compgen -V option
---
builtins/complete.def| 72
externs.h| 1 +
lib/readline/doc/rluser.texi | 11 --
3 files changed, 64 insertions(+), 20 deletions(-)
diff
Currently, the getconf build fails on platforms (e.g. Android) without
confstr(3)
From c1a616fd5ff18a202ad934bbb23ba4d58685 Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Thu, 13 Apr 2023 04:32:04 -0400
Subject: [PATCH] support getconf builtin build without confstr
---
examples/loadables
uoting_desired.
From 8049e9f920fde4f84422fd651ba4a4beeafb7f10 Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Fri, 14 Apr 2023 16:10:22 -0400
Subject: [PATCH] allow quoting completions w/o filename treatment
lib/readline/complete.c
- rl_all_quoting_desired: new variable to tell readline to quote
matches even i
Originally identified in [1] (FWIW, I only see the message in the archive,
not in my inbox).
[1]: https://lists.gnu.org/archive/html/bug-bash/2023-04/msg00043.html
bash --norc -o vi -in <<<$'\ec1234567'
(arg: 123456) Segmentation fault
I think it's just a matter of save/restore_prompt
dif
$ bash --rcfile <(echo 'complete -C: -I') -i <<<$'; \cA\t'
bash-5.2$ bash: xmalloc: cannot allocate 18446744073709551615 bytes
$ bash --rcfile <(echo 'complete -C: -I') -i <<<$';\cA \t'
bash-5.2$ Segmentation fault: 11
If an interactive shell line is just a single loop and the body of the loop
consists only of a function name, and the function body is not a list, ^C
does not cause the loop to break as it otherwise would.
$ f() { cat; }
$ while :; do f; done
^C
The code in wait_for() checks the values of loop_le
On Wed, Apr 19, 2023, 10:23 Chet Ramey wrote:
> On 4/18/23 6:15 PM, Grisha Levit wrote:
> > $ bash --rcfile <(echo 'complete -C: -I') -i <<<$'; \cA\t'
> > bash-5.2$ bash: xmalloc: cannot allocate 18446744073709551615 bytes
> > $ bash --rcfil
The history expansion code can end up reading past the end of the
input line buffer if the line ends with an invalid multibyte sequence:
bash --norc -in <<<$'X\n\e238Y!!\xC2\xC2'
ERROR: AddressSanitizer: heap-buffer-overflow
READ of size 1 at 0x000108b48400 thread T0
#0 0x104ed9c88 in history_
This segfaults in a non-ASAN build:
HISTFILE= INPUTRC=<(echo '"F": history-substring-search-forward') \
bash --norc -in <<<$'.\n..\n\cP\cT\cPF\cN\cN.\cPF\c_'
ERROR: AddressSanitizer: heap-use-after-free on address 0x0001060082a8
READ of size 4 at 0x0001060082a8 thread T0
#0 0x1027627b8 in
If a parser error is encountered when `local' is parsing an array
assignment string, the installed unwind-protects never run:
$ f() { local -a a='(())'; }; f
bash: syntax error near unexpected token `('
$ declare -p a FUNCNAME
declare -a a
declare -a FUNCNAME=([0]="f")
If there's a PROMPT_C
A few issues with EOF being received at PS2:
The setting of ignoreeof is ignored at PS2:
bash --norc -o ignoreeof
$ uname \
> ^D
Linux
(bash exits)
If the previous line didn't terminate the current token, ^D causes the
token (rather than the command) to be terminated and a new PS2 to be
printe
On Wed, Apr 26, 2023 at 2:15 PM Chet Ramey wrote:
> This one looks like it was already hit by the other guy sending in fuzzing
> output.
You're right, sorry I missed that.
On Fri, Apr 28, 2023, 11:35 Chet Ramey wrote:
> On 4/24/23 1:40 AM, Grisha Levit wrote:
> > The history expansion code can end up reading past the end of the
> > input line buffer if the line ends with an invalid multibyte sequence:
>
> Thanks for the report. You mean an
On Sat, Apr 29, 2023, 14:02 Chet Ramey wrote:
> On 4/28/23 9:28 PM, Grisha Levit wrote:
> > Piping input that simply ends in an leading byte doesn't trigger the
> issue
> > -- that byte byte don't seem to make it into the input line.
> >
> > This is a bit
This will be a very neat feature to have. One thing I'm excited about
is the ability to cleanly perform assignments during prompt expansion
(e.g. to capture information during PS0 or PS4 expansion).
Something I suspect people will complain about is that this change
makes some polyglot zsh/bash sc
On Mon, Mar 20, 2023 at 4:59 PM Chet Ramey wrote:
> Thanks for the report. This is the same thing as
>
> https://lists.gnu.org/archive/html/bug-bash/2021-06/msg00115.html
>
> with the command substitution being embedded in the parameter expansion.
One more similar case when the parameter expansio
An interactive shell gets confused (PS1 shown instead of PS2) when using
newline as the first character of the substitution:
$ bash --norc -i <<<$'${\n:;}'
bash-5.2$ ${
bash-5.2$ :;}
Things don't seem to work right with an empty funsub:
bash --pretty-print <<<'${ }'
${ ; }
$ bash -c '${ }'
There are a lot of code paths that (reasonably) do not expect a variable to
disappear while being expanded/assigned to, and usually cause a segfault if
that happens (as is now possible with the new nofork command substitution).
I don't think there is any legitimate use case to be supported here, a
On Mon, May 1, 2023 at 11:48 AM Chet Ramey wrote:
> Yes, I concluded the same thing. Thanks for the patch. I have one question
> about the change to rl_insert: why overwrite any return value from the
> initial call to _rl_insert_char by setting r back to 0? What if the initial
> value of C starts
If expanding a \u (or \U) escape sequence fails, Bash replaces the
input escape sequence with a newly generated one:
$ LC_ALL=C printf %b \\U80
\u0080
Since this new sequence may by longer than the input, it can cause an
overflow in printf:
$ bash-asan -c 'LC_ALL=C printf %b \\U80'
ERROR: Addres
On Mon, May 1, 2023 at 11:48 AM Chet Ramey wrote:
>
> (And once we get these issues straightened out, if you look back to your
> original example, 0x240 is a blank in my locale, en_US.UTF-8, and will be
> removed from the input stream by the parser unless it's quoted.)
On at least recent macos ve
The below seems like a cheap fix for UTF-8 locales. Since Bash falls
back to using the single-byte glob matching functions when presented
with invalid multibyte strings, this patch makes the glob code avoid
calling the ctype functions or strcoll when handling individual bytes
>0x7F (in a UTF-8 loca
Missing final `;':
"$BASH" --pretty-print <<< $'${ : \;;}'
${ : \; }
"$BASH" --pretty-print <<< $'${ : \;\n}'
${ : \; }
"$BASH" --pretty-print <<< $'${ : \&;}'
${ : \& }
"$BASH" --pretty-print <<< $'${ : \&\n}'
${ : \& }
Correct:
"$BASH" --pretty-print <<< $'${ : \;&}'
${ : \; & }
"$BASH" --
If rl_filename_rewrite_hook returns a new string for a filename (which
I guess only happens on macOS with bash), it is in most cases not
free-d.
run() {
for ((i=0; i<=1; i++)); do
((i%1000)) || ps -o rss= $BASHPID
compgen -f . >/dev/null
done
}
$ (run)
2160
4576
6864
9040
1123
A use-after-free happens in expand_string_dollar_quote if
noexpand_translation is enabled and a string's translation is the same
length as the string itself.
---
diff --git a/subst.c b/subst.c
index 08d9285e..a7a386d4 100644
--- a/subst.c
+++ b/subst.c
@@ -4231,12 +4231,17 @@ expand_string_dollar_q
The command printing code can fail to add a required semicolon when the
last word in the command ends with `&'
$ bash --pretty-print <<<$'{ \&;}'
{ \& }
$ f() { if echo \&; then :; fi; }
$ declare -f f
f ()
{
if echo \& then
:;
fi
}
$ eval "$(declare -f f)"
bash: syntax error near
My earlier patch for adding compgen -V did the variable assignment in a
pretty silly way and had a small memory leak to boot. Hope this new way
makes sense, sorry for the extra work.
---
>From b6b13b89e1436ddd575483a81e79ef43d82a5c0c Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Sat, 3
Some uninitialized variable access identified by clang's static analyzer.
(FWIW 90% of the reports were bogus but these seem legit)
* lib/readline/input.c
- rl_gather_tyi: the `result' variable is no longer initialized before
first access since commit d0bc56a32
* lib/readline/kill.c
- _rl_read_br
Only triggered by doing something stupid:
bash -c 'declare -n OLDPWD=X[SHLVL=-1]; /; cd /'
bash: line 1: X[SHLVL=-1]: bad array subscript
Segmentation fault: 11
---
diff --git a/builtins/cd.def b/builtins/cd.def
index de123f8b..e3156463 100644
--- a/builtins/cd.def
+++ b/builtins/cd.def
@@ -158,1
me reference"),
temp);
+ free (temp1);
return (&expand_wdesc_error); /* XXX */
}
else
From 892cb679195298496a8fc86c36825b20b0a8e07c Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Sat, 3 Jun 2023 16:51:26 -0400
Subject: [PATCH] various leaks
Found mostly by norma
rl_ding ();
- FREE (matches);
+ _rl_free_match_list (matches);
matches = (char **)0;
full_completion = 1;
return (0);
From 8eef36cd74caae425e536ead84b1a8cb1cad44b7 Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Sat, 3 Jun 2023 23:31:16 -0400
Subject: [PATCH] comp
On Sunday, May 28, 2023, Grisha Levit wrote:
> Missing final `;':
>
> "$BASH" --pretty-print <<< $'${ : \;;}'
> ${ : \; }
>
The latest set of fixes to this code solves these cases but others have
issues:
$ bash --pretty-print <<<$
On Wed, Jun 21, 2023, 10:08 Chet Ramey wrote:
>
> On 6/17/23 4:02 AM, Grisha Levit wrote:
> > Found mostly by normal usage running a no-bash-malloc build with clang's
> > LeakSanitizer enabled.
>
> Are you running this on macOS or some other system?
I actually c
On Wed, Jun 21, 2023 at 3:09 PM Chet Ramey wrote:
> Have you considered running `make tests' on a bash binary built with this
> configuration? I'd be interested in those results.
I have, but unfortunately this generates quite a few reports that are
a little tricky to chase down. The main difficu
`read' can hit its timeout before it gets a chance to save the current
signal mask so sigprocmask can end up restoring an uninitialized
prevset. (Also all the sigprocmask calls other than the one in the jmp
target are protected by `#if defined (SIGCHLD)' so I guess this one
should be too)
Found by
Using `export' / `readonly' on a variable that's present in both the temp
env and a calling function's local context combines the attributes of all
the intervening scopes in the global variable:
$ declare -A v; f() { local -a v; v= e; }; e() { export v; }
$ (f; declare -p v)
declare -aAx v=([0]=""
On Fri, May 26, 2023, 17:44 Chet Ramey wrote:
>
> On 4/26/23 5:38 PM, Grisha Levit wrote:
> > A few issues with EOF being received at PS2:
>
> I finally had a chance to check out the ksh88 behavior on a Solaris 10 VM.
> It's pretty bizarre, but it does point to some i
When printing the command for xtrace, if a word or assignment rhs contains
a shell meta character, ansi quoting is not applied even if it otherwise
should be.
$ (set -x; : $'_\1' $'*\1') |& cat -v
+ : $'_\001' '*^A'
It seems that the order of the sh_contains_shell_metas and
ansic_shouldquote test
diff --git a/subst.c b/subst.c
index 215e3469..63ca3370 100644
--- a/subst.c
+++ b/subst.c
@@ -1042,7 +1042,7 @@ skip_double_quoted (const char *string, size_t
slen, int sind, int flags)
if (string[i + 1] == LPAREN)
ret = extract_command_subst (string, &si,
SX_NOALLOC|(flags&S
If SIGINT is received during the execution of a bind -x command, the
memory allocated for the saved parser state is leaked and the READLINE_*
variables remain in the environment
* pcomplete.c,bashline.c:
- uw_restore_parser_state,uw_rl_set_signals: move from pcomplete.c to
bashline.c
* bashline.
If there are multiple commands in a row that each require printing the
connector prior to the heredoc body, the connector ends up in the wrong
place for commands after the first:
fun() {
cat second);
- PRINT_DEFERRED_HEREDOCS ("");
+ if (was_heredoc)
+ PRINT_DEFERRED_HER
If the last redirection list in a group / subshell / substitution has
a heredoc and the following connector is a semicolon, the connector is
incorrectly skipped over.
This happens only outside of function definitions, so I think it's an
issue only for pretty-print mode.
bash --pretty-print <<<$'(
_PSELECT))
int
fsleep(unsigned int sec, unsigned int usec)
{
From a33289b218028b6d72966d8253646d6f174e09a5 Mon Sep 17 00:00:00 2001
From: Grisha Levit
Date: Thu, 29 Jun 2023 21:55:05 -0400
Subject: [PATCH] fsleep: use nanosleep, handle signals
---
config.h.in | 3 +++
configure.ac| 6
On Fri, Jun 30, 2023, 16:02 Chet Ramey wrote:
> On 6/29/23 4:01 AM, Grisha Levit wrote:
> > If there are multiple commands in a row that each require printing the
> > connector prior to the heredoc body, the connector ends up in the wrong
> > place for commands after t
The `enabled' and `disabled' completion lists don't get updated when a
dynamic builtin is loaded:
$ compgen -A enabled tty
$ enable tty
$ compgen -A enabled tty
$
diff --git a/builtins/enable.def b/builtins/enable.def
index aa143760..399c7fa3 100644
--- a/builtins/enable.def
+++ b/builtins/enable
On Fri, Apr 14, 2023, 17:20 Grisha Levit wrote:
>
> The attached patch hopefully addresses these difficulties by allowing for
> the decoupling of filename-specific match handling from match quoting.
>
Thanks very much for merging this.
It adds a new completion option `allquote
On Wed, May 31, 2023 at 6:23 PM Grisha Levit wrote:
>
> If rl_filename_rewrite_hook returns a new string for a filename (which
> I guess only happens on macOS with bash), it is in most cases not
> free-d.
> diff --git a/lib/readline/complete.c b/lib/readline/complete.c
> index
The fix [1] for the issue reported in [2]:
+ give the terminal to pipeline_pgrp. We don't give the terminal
+ back to shell_pgrp if an async job exits because we never gave it
+ to that job in the first place. */
if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
+ (job == NO
n -f -- \303\251'
é-C
$ bash -c $'compgen -f -- e'
é-D
This can be worked around by calling `bind' manually, resulting in the
same behavior as in an interactive shell:
$ bash -c $'bind; compgen -f \303\251'
é-C
é-D
$ bash -c $'bind; compgen -f -- e'
$
..but
If there a glob is expanded to more than one result while attempting
to complete the command word, the matches are discarded but not freed.
diff --git a/bashline.c b/bashline.c
index 0e5373ab..07f38e62 100644
--- a/bashline.c
+++ b/bashline.c
@@ -2192,7 +2192,11 @@ globword:
local_index = 0;
Since bash-5.3 now shows an error message when a regular expression
can't be compiled, I thought it might be useful to add the
regerror()-supplied string that provides more specifics on the
failure, so we can get messages like:
$ [[ x =~ [z-a] ]]
bash: [[: invalid regular expression `[z-a]': inval
This patch implements the ksh93-style <<# redirection operator to
enable indentatable heredocs. This (or similar) functionality has
been requested a few times, most recently discussed at
https://lists.gnu.org/archive/html/bug-bash/2021-09/msg0.html
The behavior for heredocs started with the <
Enable prettier-printing of <<# heredocs by printing the body indented
one level further than surrounding text and the final delimiter at the
same indentation level as the surrounding text.
0002-indent-stripping-heredoc-indented-printing.patch
Description: Binary data
On Fri, Jul 14, 2023 at 3:44 AM Martin D Kealey wrote:
>
> On the whole I think this is great, and thankyou for working up the patch,
> but I would like to offer some comments and suggestions:
Thanks for looking at it, feedback very much appreciated.
> One option that some other languages use i
The mbsrtowcs call here doesn't convert the final \0 of mbs, leaving the
final byte of ws as whatever was just malloc-ed.
Noticed in an ASAN build which makes sure that this is never L'\0'. Oddly,
this didn't actually trigger an ASAN report, just saw that nothing was
getting printed by printf.
--
On Mon, Jul 17, 2023, 12:09 Chet Ramey wrote:
> I guess we'll see how much the text of regerror(3)
> error messages varies across regexp implementations.
>
Is that a concern? The GNU strings [1] are translated and even their
untranslated text does differ from that of the BSD ones [2].
The set o
On Mon, Jul 17, 2023 at 3:29 PM Chet Ramey wrote:
>
> On 7/7/23 5:05 PM, Grisha Levit wrote:
> > A few small tweaks for the macOS-specific normalization handling to
> > handle the issues below:
>
> The issue is that the behavior has to be different between cases where
>
The output of `bind -X' is not reusable if the bound command has quotes,
backslashes, etc.
$ bind -x '"\eX": echo "x"'
$ bind -X
"\eX": "echo \"x\""
$ bind -x "$(bind -X)"
$ bind -X
"\eX": "echo \\\"x\\\""
This patch changes rl_macro_dumper to not untranslate the macro body
when passed a negative
On Tue, Jul 18, 2023 at 9:55 AM Chet Ramey wrote:
> Unicode normalization on macOS has always been a pain in the ass.
I can see that!
> This is the basic assumption that drives all the decisions: character input
> you get from the terminal is in NFC, and files from the file system (names
> and u
On Wed, Jul 19, 2023 at 10:47 AM Chet Ramey wrote:
> Thanks for the report. It seems like your patch is incomplete, though.
> After applying it:
>
> $ bind -x '"\eX": echo "x"'
> $ bind -X
> "\eX": "echo "x""
>
> We probably need to suppress printing the double quotes around `out' if
> print_reada
On Wed, Jul 19, 2023 at 9:07 AM Chet Ramey wrote:
>
> On 7/18/23 10:01 PM, alex xmb ratchev wrote:
> > i in 5.2.15 bash aarch64 termux did
> >
> > $ cp -ap db2.*/
> >
> > and got
> >
> > db2.i5// db2.i7//
>
> I can't reproduce this.
This is a combination of either visible-stats or mark-directorie
On Wed, Jul 19, 2023 at 12:57 PM Grisha Levit wrote:
> Also I think this is not a bug -- readline is asked to append a slash
> to directory names and it does so.
It's easy enough to avoid printing the indicator slash if we just
printed a path already ending in a slash. It'
(so make -j works)
diff --git a/Makefile.in b/Makefile.in
index 7f990bfa..ce909bc6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1440,6 +1440,7 @@ sig.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
siglist.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
subst.o: bashintl.h ${LIBINTL_H} $(
On Thu, Jul 20, 2023, 01:42 alex xmb ratchev wrote:
>
>
> 2. it says [[ ! -d then ' continue ' .. where is cp
> i call no , not c , ...
> 1. cp missing
> 2. the [[ ! -d return to continue looks bug wrong
>
Try putting the code that uses the alias into a function, and then print
the function defi
On Thu, Jul 20, 2023 at 11:54 AM Chet Ramey wrote:
> So I'll go ahead with your patch, starting with the globbing changes.
Thanks! BTW, changing quote_string_for_globbing to skip escaping
characters that don't need it makes globbing >2x faster in the case
that most of the pattern is a quoted stri
On Mon, Jul 24, 2023 at 10:12 AM Chet Ramey wrote:
>
> On 7/20/23 7:52 PM, Grisha Levit wrote:
>
> > I wonder if you'd be interested in changes
> > to the function that would skip escaping ASCII characters that aren't
> > glob-special as well. I _think_ it wo
This patches addresses a few issues with `read' when not in raw mode.
If the last character read was an (unescaped) backslash, store it as
such instead of as a CTLESC. Avoids:
$ printf '\\' | { read; echo "${REPLY@Q}"; }
bash: DEBUG warning: dequote_string: string with bare CTLESC
$'\001'
If an
On Wed, Jul 26, 2023, 16:06 Chet Ramey wrote:
>
> On 7/24/23 1:13 PM, Chet Ramey wrote:
>
> > You could do it if you allowed, say
> >
> > bind -x '"\eX": \"command with spaces\" \"x\"'
> >
> > and then stripped the backslashes before calling rl_generic_bind, but
> > that's not exactly backwards co
1 - 100 of 445 matches
Mail list logo