Re: Examples of concurrent coproc usage?

2024-04-16 Thread Andreas Schwab
nary data doesn't work if you're reading newline-terminated > records, because you cannot store the NUL character in a shell > variable. But you can delimit your records on NULs, and use printf to > reproduce them. Though that will likely add a spurious null at EOF. -- Andreas Schwab,

Re: Linux reports memfd_create() being called without MFD_EXEC or MFD_NOEXEC_SEAL set

2024-04-27 Thread Andreas Schwab
n later kernels, but nevertheless, bash should pass MFD_NOEXEC_SEAL (if defined) when it calls memfd_create. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bash: ":?xxx" filename broken on autocomplete

2024-04-27 Thread Andreas Schwab
?aa' > # touch 'something-else' > # rmdir : > > ... produces nothing until pressing the tab key a second time, after which > both entries are listed while the content of readline's input buffer remains > unchanged. ':' is in $COMP_WORDBREAKS. -- Andrea

Re: Linux reports memfd_create() being called without MFD_EXEC or MFD_NOEXEC_SEAL set

2024-04-28 Thread Andreas Schwab
On Apr 28 2024, Chet Ramey wrote: > On 4/27/24 8:09 AM, Andreas Schwab wrote: >> On Apr 27 2024, Kerin Millar wrote: >> >>> At some point after upgrading to bash-5.3-alpha, the following message >>> appeared in my kernel ring buffer. >>> >>> [

Re: bug in bash

2024-05-12 Thread Andreas Schwab
from a terminal. Since the redirection fails and the cat command is never started, bash doesn't switch the terminal process group, and the background wc command goes on competing with bash for the terminal. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bug in bash

2024-05-12 Thread Andreas Schwab
bash switches the terminal process group back before the background process starts reading from the terminal (won't happen in this example since the cat command blocks on reading the process substitution file). -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69

Changed behaviour of ${PARAMETER/#PATTERN/STRING} and ${PARAMETER/%PATTERN/STRING}

2024-05-13 Thread Andreas Schwab
TRING}. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: bug in bash

2024-05-14 Thread Andreas Schwab
thing like SIGHUP. But leaving it in the process group of the parent shell does not accomplish that, which is actually the point of this thread. A process substitution is similar to a pipeline; it really belongs to the process group of the command that reads from it. -- Andreas Schwab, SUSE Labs,

Re: [PATCH] globsort: handle int overflow in cmp functions

2024-05-20 Thread Andreas Schwab
is wider than int, it can return a wrong value even if the subtraction doesn't overflow. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: set -a leads to truncated output from ps

2024-06-13 Thread Andreas Schwab
Why do you think this is a bug in bash? You are telling the shell to export any modified variable, and you get what you asked for. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

history-search-backward clobbers history

2024-06-19 Thread Andreas Schwab
4 echo 1234 5 history bash-5.3$ echo 2345 2345 bash-5.3$ history 1 echo 1234 2 echo 2345 3 echo 13456 4 echo 21234 5 history 6 echo 2345 7 history bash-5.3$ exit $ cat history echo 1234 echo 2345 echo 3456 echo 21234 history echo 2345 history -- Andreas S

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
which happens to > leave the `echo 3456' unchanged -- coincidentally the first history entry > changed by moving around the history list and editing. So what did change in 5.3 that this is now broken? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
On Jul 01 2024, Chet Ramey wrote: > On 7/1/24 3:54 AM, Andreas Schwab wrote: > >> So what did change in 5.3 that this is now broken? > > If you want to report a bug, report one. Be specific about what you > think is wrong and what you think the correct behavior is. The corre

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
The wrong thing is that the history contains commands that were never executed: echo 13456 and echo 21234. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-29 Thread Andreas Schwab
On Aug 29 2024, Andrey Kovalev wrote: > - for (fmt = format; *fmt; fmt++) > + for (fmt = format; fmt - format < strlen(format); fmt++) How is that different (apart from turing a linear runtime into quadratic runtime)? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fi

Re: procsub doesn't release the terminal without reading one byte

2024-10-13 Thread Andreas Schwab
On Okt 13 2024, Oğuz wrote: > Why though? Can't bash just close the procsub's stdin when `:' returns? bash has no handle on the command's stdin. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And

Re: Fwd: New feature

2024-10-12 Thread Andreas Schwab
On Okt 12 2024, Saint Michael wrote: > After using printf, right now I need to lunch a second command if I > need to expand the \n into real new lines. $ printf %b '\n' -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9

Re: Suggested BASH Improvement

2024-09-18 Thread Andreas Schwab
> Even the venerable BASH shell still has room for modernization > and improvement. Thank you for your interest and consideration. How is $((10#${data_line:12:2})) not modern? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA

Re: Completion with -W fails if words contain ':'

2024-12-02 Thread Andreas Schwab
What is your value of COMP_WORDBREAKS? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: PIPESTATUS differs from $? for compound command

2024-12-09 Thread Andreas Schwab
pipeline are commands. > Both other examples, e.g. 'if false; then :; fi | true', > are, for PIPESTATUS purposes, equivalent to: 'true | true'. Why is `if false; then :; fi' not equivalent to `true' above? -- Andreas Schwab, sch...@linux-m68k.org GPG Key fi

Re: bind allows "impossible" key bindings without warning

2025-01-03 Thread Andreas Schwab
On Jan 03 2025, Dale R. Worley wrote: > It does seem like "bind" could be improved by providing an option that > shows all of the keysequences and what they are bound to. bind -p | sort -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 255

Re: "printf %d ''" should diagnose the empty string

2025-02-10 Thread Andreas Schwab
On Feb 10 2025, Greg Wooledge wrote: > No, I've shown that it *is* working in older versions of bash, and I'm > asking *why*. Does it? If it did, it should have printed -23, not -19. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE

Re: PIPESTATUS differs from $? for compound command

2024-12-11 Thread Andreas Schwab
On Dez 11 2024, Mike Jonkmans wrote: > Can a command - as part of a pipeline - not be a pipeline? ! true | { ! true; } -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: PIPESTATUS differs from $? for compound command

2024-12-09 Thread Andreas Schwab
commands as part of the pipeline (by your reasoning) are `false' and `true'. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: PIPESTATUS differs from $? for compound command

2024-12-10 Thread Andreas Schwab
On Dez 10 2024, Mike Jonkmans wrote: > With 'if false... fi | true' there are two pipelines: > 1) false > 2) (compound command) if | true There is only one pipeline, consisting of two commands. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Andreas Schwab
On Jan 05 2025, Tobi Laskowski wrote: > "Additionally, if it is in the environment at start up, the variable is > automatically exported That is a general property of every environment variable. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510

Re: Bash' code to store string of any characters containing pair of "" and '' at once

2024-12-22 Thread Andreas Schwab
On Dez 22 2024, Martin D Kealey wrote: > If you don't mind even more thinking then you can instead memorize the list > of characters that need \ and skip all the others; they are space, tab, > newline, and "#$'&<>*()?`\[]| Careful. \ has a different meaning.

5.3.0-beta: readline mishandles prompt with inivisible characters that wraps around

2025-01-02 Thread Andreas Schwab
$ PS1="\[$(tput bold)\]\w\\\$\[$(tput sgr0)\] " $ cd /tmp $ for i in 1 2 3 4 5 6 7 8; do mkdir 1234567890; cd 1234567890; done The second line of the prompt is not rendered in bold, and as the edited line gets longer the cursor jumps to the leftmost screen column. -- Andreas S

Re: Surprising behavior with inline environment variable expansion

2025-04-05 Thread Andreas Schwab
On Mär 31 2025, Chet Ramey wrote: > It's hard to see these as being useful if they're glibc-specific. They are coming from ISO TR 14652 and 30112. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for so

Re: Surprising behavior with inline environment variable expansion

2025-04-05 Thread Andreas Schwab
On Mär 26 2025, Andreas Kähäri wrote: > The argument to "bash -c" There is no "bash -c" in that command. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Surprising behavior with inline environment variable expansion

2025-03-26 Thread Andreas Schwab
cludes putting LC_NUMERIC=C in the temporary environment for the command). -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: /dev/tcp feature request...

2025-04-08 Thread Andreas Schwab
On Apr 08 2025, MacBeth wrote: > while ((dur /dev/null; do You can use kill -0 $! to check if the process still exists. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: history writes to process substitution but errors reading it

2025-02-14 Thread Andreas Schwab
effect. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Andreas Schwab
On Feb 22 2025, Phi Debian wrote: > I forgot to mention your trick to nuke the fmt reuse still works > > $ printf '%s %s %s %999$s' A B C D E F G > A B C As long as NL_ARGMAX >= 999. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Andreas Schwab
On Mai 20 2025, FunnyMan Computer wrote: > In both cases, ${BASH_REMATCH[1]} should also have results stored. Why? There are no subexpression in your regexps. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And

Re: 5.3: Why is <(cmd) allowed in func names of func defs?

2025-06-11 Thread Andreas Schwab
echo hello; }; declare -F' >>declare -f <(echo hello) > > That's the function name. In general, a function name is a WORD that > does not undergo any word expansions, not even quote removal. Without quote removal, a lot of WORDs that can be command names (which unde

Re: sourc. can't handle /sys/block/*/uevent on Linux

2025-07-14 Thread Andreas Schwab
That's a TOCTOU race. The file can change any time between stat and read. The only truth is that when read returns an error, there is an error. > Yes. It seems like that assumption isn't valid on Linux. It isn't valid anywhere. -- Andreas Schwab, sch...@linux-m68k.org GPG Ke

Re: The kill test of util-linux fails with bash 5.3

2025-07-22 Thread Andreas Schwab
eads to > > When I take out that macro, it doesn't change the resulting config.h, at > least on macOS. The defines set by the gl_FCNTL_O_FLAGS macro are missing from config.h.in, and they are not used anywhere anyway. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint =

Re: The kill test of util-linux fails with bash 5.3

2025-07-23 Thread Andreas Schwab
is a libc fork() wrapper thing. That's actually posix_spawn. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

<    3   4   5   6   7   8