Re: printf -u "$fd"?

2024-05-21 Thread Koichi Murase
2024年5月22日(水) 0:15 Zachary Santer : > Additionally, I was hoping the discussion of having a way to make fds > not CLOEXEC without a loadable builtin[3][4] would get some more > attention. I haven't followed the discussion in the original thread for multiple coprocs, but you can remove CLOEXEC rela

Re: printf -u "$fd"?

2024-05-21 Thread Zachary Santer
On Tue, May 21, 2024 at 3:06 PM Chet Ramey wrote: > > On 5/21/24 11:14 AM, Zachary Santer wrote: > > On Tue, May 21, 2024 at 9:01 AM Chet Ramey wrote: > >> > >> On 5/21/24 6:17 AM, Zachary Santer wrote: > >> > >>> I was wondering what the relationship between the devel and master > >>> branches w

[PATCH] dynamic-complete-history: avoid null ptr qsort UB

2024-05-21 Thread Grisha Levit
$ HISTFILE= bash --norc -in <<< $'#\n#\e\t' bashline.c:3720:16: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/stdlib.h:971:30: note: nonnull attribute specified here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior bashline.c:3720:16 ---

[PATCH] spell-correct-word: avoid inf loop with neg arg

2024-05-21 Thread Grisha Levit
bash --norc -in <<< $'A \e-\cXs' --- bashline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bashline.c b/bashline.c index 528f56e0..0a4e280e 100644 --- a/bashline.c +++ b/bashline.c @@ -1336,6 +1336,9 @@ bash_spell_correct_shellword (int count, int key) int wbeg, wend; char *text

[PATCH] spell-correct-word: fix small leak

2024-05-21 Thread Grisha Levit
Avoid leak when spell-correcting an empty line. --- bashline.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bashline.c b/bashline.c index 525d065a..528f56e0 100644 --- a/bashline.c +++ b/bashline.c @@ -1348,7 +1348,10 @@ bash_spell_correct_shellword (int count, int key)

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Martin D Kealey
On Tue, 21 May 2024 at 03:44, Chet Ramey wrote: > On 5/17/24 1:15 PM, Robert Elz wrote: > > >| If `nosort' means no sorting, there is no imposed ordering, and > ascending > >| and descending are meaningless. > > > > Sure, but directory order, and reverse directory order aren't (and that's

Re: printf -u "$fd"?

2024-05-21 Thread Chet Ramey
On 5/21/24 11:14 AM, Zachary Santer wrote: On Tue, May 21, 2024 at 9:01 AM Chet Ramey wrote: On 5/21/24 6:17 AM, Zachary Santer wrote: I was wondering what the relationship between the devel and master branches was. No mystery: the devel branch captures ongoing development, gets the latest

[PATCH] rl_change_case: skip over invalid mbchars

2024-05-21 Thread Grisha Levit
Avoid using (size_t)-1 as an offset. Also, not sure it makes sense to change the case of an invalid byte cast to (wchar_t). $ bash --norc -in <<< $'\300\e-1\eL' lib/readline/text.c:1544:26: runtime error: addition of unsigned offset to 0x51100680 overflowed to 0x5110067f ERROR: AddressSa

[PATCH] bashline: small leaks

2024-05-21 Thread Grisha Levit
- free directory_part when completing command words like `~/bin/' - free contents of matches when completing command words in old-style command substitutions --- bashline.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bashline.c b/bashline.c index b638e001..525d065a

[PATCH] execute-named-command: fix small leaks

2024-05-21 Thread Grisha Levit
- free command if it is the empty string - free command before calling bound function, in case bound function does not return, like rl_abort --- lib/readline/text.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/readline/text.c b/lib/readline/text.c index c5281efe

Re: printf -u "$fd"?

2024-05-21 Thread Zachary Santer
On Tue, May 21, 2024 at 9:01 AM Chet Ramey wrote: > > On 5/21/24 6:17 AM, Zachary Santer wrote: > > > I was wondering what the relationship between the devel and master > > branches was. > > No mystery: the devel branch captures ongoing development, gets the latest > bug fixes, and is where new fe

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Chet Ramey
On 5/21/24 1:55 AM, Phi Debian wrote: The idea started before the current discussion as a way to avoid overloading PATH in the source builtin: https://lists.gnu.org/archive/html/help-bash/2024-04/msg00022.html Some thought 'source' was a good candidate for this, except that source is a read/p

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Phi Debian
On Tue, May 21, 2024 at 1:17 PM Koichi Murase wrote: > There are already shell-function implementations at > /examples/functions/autoload* in the Bash source. They reference FPATH > to load functions, though one needs to call `autoload' for each > function in advance (by e.g. `autoload "$fpath_e

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Chet Ramey
On 5/21/24 12:49 AM, konsolebox wrote: `Properly' is clearly in the eye of the beholder. I'm sorry if I have to sound assertive on this one but I thoroughly thought about these things years ago and made a framework that works on a multitude of shells, allows both simple and pattern-based targe

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Phi Debian
On Tue, May 21, 2024 at 1:15 PM Greg Wooledge wrote: > On Tue, May 21, 2024 at 10:12:55AM +, Matheus Afonso Martins Moreira > wrote: > > > the schizophrenic nature of the feature > > > > First the feature was "irritating" ... Now it's "schizophrenic" ? > > I must be mentally ill for trying to

Re: printf -u "$fd"?

2024-05-21 Thread Chet Ramey
On 5/21/24 6:17 AM, Zachary Santer wrote: I was wondering what the relationship between the devel and master branches was. No mystery: the devel branch captures ongoing development, gets the latest bug fixes, and is where new features appear. The master branch is for stable releases. I saw

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread alex xmb sw ratchev
On Tue, May 21, 2024, 13:18 Koichi Murase wrote: > 2024年5月21日(火) 14:56 Phi Debian : > > Apparently konsolebox wrote a package manager, and survived the source > 'as > > is', yet he still advocate for 'enhancement'. I do have a package manager > > too, and survived source 'as is' and don't require

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Koichi Murase
2024年5月21日(火) 14:56 Phi Debian : > Apparently konsolebox wrote a package manager, and survived the source 'as > is', yet he still advocate for 'enhancement'. I do have a package manager > too, and survived source 'as is' and don't require any enhancement. I'm not sure if it is the case for konsole

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Greg Wooledge
On Tue, May 21, 2024 at 10:12:55AM +, Matheus Afonso Martins Moreira wrote: > > the schizophrenic nature of the feature > > First the feature was "irritating" ... Now it's "schizophrenic" ? > I must be mentally ill for trying to contribute this? > > Yeah, I'm done. I don't think "schizophren

Re: printf -u "$fd"?

2024-05-21 Thread Zachary Santer
On Mon, May 20, 2024 at 3:03 PM Chet Ramey wrote: > > On 5/17/24 10:53 PM, Zachary Santer wrote: > > > So here's another tangent, but has it been considered to add an option > > to the printf builtin to print to a given file descriptor, rather than > > stdout? If printing to a number of different

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-21 Thread Matheus Afonso Martins Moreira
> the schizophrenic nature of the feature First the feature was "irritating" ... Now it's "schizophrenic" ? I must be mentally ill for trying to contribute this? Yeah, I'm done.