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: 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 Kähäri
On Wed, Mar 26, 2025 at 01:35:12PM +0100, Andreas Schwab wrote: > 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 fing

Re: Surprising behavior with inline environment variable expansion

2025-03-26 Thread Andreas Kähäri
On Wed, Mar 26, 2025 at 12:19:48PM +0100, Andreas Schwab wrote: > On Mär 26 2025, Léa Gris wrote: > > > Even though LC_NUMERIC=C is used to correctly parse 3.141592654, the > > expansion of $LC_NUMERIC still prints its original value (fr_FR.UTF-8). > > That is exp

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: [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: bash --pretty-print and pattern

2025-02-20 Thread Andreas Kähäri
he command line before the single-character options to be recognized. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: "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: Documentation inconsistency (?)

2025-02-06 Thread Andreas Kähäri
meter:-word}`` > -- [cut] This was recently discussed: https://lists.gnu.org/archive/html/bug-bash/2025-01/msg00144.html -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: printf width format specifier doesn't work when assigned

2025-01-25 Thread Andreas Kähäri
e, tab, and newline, by default), but also from > using the split-up value as filename globbing patterns, which is what > happens in your case. > > Just double quote the variable expansion: > > echo "$foo" > > Sorry, I pressed send too quickly. I was going to suggest an alternative to using a command substitution and tr: printf -v foo '%*s' 80 ' ' echo "${foo// /*}" -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: printf width format specifier doesn't work when assigned

2025-01-25 Thread Andreas Kähäri
$IFS (space, tab, and newline, by default), but also from using the split-up value as filename globbing patterns, which is what happens in your case. Just double quote the variable expansion: echo "$foo" -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: [Assignements to variables with integer attribute are expanded recursively]

2025-01-08 Thread Andreas Kähäri
ffectively allows for recursive arithmetic expansion of the right-hand side of an assignment to a variable with the integer attribute. Recursive, that is, until the right-hand side is no longer a variable's name, at which point the expansion stops and the value is assigned (or an error is generated if the value is not a valid integer). -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: 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

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: 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.

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-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: 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-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: 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: String substitution bug

2024-11-24 Thread Andreas Kähäri
On Sun, Nov 24, 2024 at 10:51:43PM +1000, Martin D Kealey wrote: > On Sun, 24 Nov 2024 at 18:05, Andreas Kähäri wrote: > > > I think the manual is quite clear: > > > > Within [ and ], character classes can be specified > > using the syntax [:clas

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
On Sun, Nov 24, 2024 at 02:58:45PM -0500, Lawrence Velázquez wrote: > On Sun, Nov 24, 2024, at 10:08 AM, Andreas Kähäri wrote: > > On Sun, Nov 24, 2024 at 09:31:42AM -0500, Greg Wooledge wrote: > >> Similar cases exist elsewhere within the man page. For example, if you >

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
it. > So, if someone scans down the page until they find the eye-catching > ${paramter:-word} definitions, and keeps reading from that point, > they will eventually find the paragraph about the colons, even before > the table. They don't have to read *backwards* to find it. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
s with > a bit of misunderstanding, leading to a few lost hours. > -- > Dormouse I think the manual is quite clear: Within [ and ], character classes can be specified using the syntax [:class:], where class is one of the following classes defined in the POSIX standard: alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit It says that the syntax "[:class:]" may be used within "[" and "]". To match a space-like character (including spaces, newlines and various types of tabs), you would therefore use "[[:space:]]". Would you want to match only a space, you would use a literal space. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: [bug #66460] A documentation correction regarding an array nameref???

2024-11-18 Thread Andreas Kähäri
> > ___ > > Reply to this item at: > > <https://savannah.gnu.org/bugs/?66460> > > ___ > Message sent via Savannah > https://savannah.gnu.org/ -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: [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: [bug #65981] "bash test -v" does not work as documented with "export KEY="

2024-07-12 Thread Andreas Kähäri
her a variable contains only an empty string, use "test -z variablename". Note that that does not test whether the variable is *set* though (unset variables expand to empty strings too, unless "set -u" is in effect, in which case it provokes an "unbound variable" diagnosti

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: 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
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

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: 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."

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

2024-05-20 Thread Andreas Kähäri
On Mon, May 20, 2024 at 01:54:20PM -0400, Greg Wooledge wrote: > On Mon, May 20, 2024 at 07:43:10PM +0200, Andreas Kähäri wrote: > > On Mon, May 20, 2024 at 05:31:05PM +, Matheus Afonso Martins Moreira > > wrote: > > > >> Why not add a -p option to &#x

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

2024-05-20 Thread Andreas Kähäri
t; > I think this is a really good solution. I hadn't thought of it. > Users can even make an alias to set a default for themselves. > > -- Matheus Or even PATH=${BASH_SEARCH_PATH-$PATH} . file without the need to add any options to . or to source. But maybe that too pedestrian? -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: 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,

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

2024-05-13 Thread Andreas Schwab
In 5.3-alpha, it is no longer possible to quote the special % and # characters in a pattern replacement expansion. $ a=1/%2/%3 $ echo "${a/\%/##}" 1/%2/%3## $ echo "${a/\/%/##}" 1##2/%3 The second example shows that quoting still works as expected for ${PARAMETER//PATTERN/S

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

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 Kähäri
error". Or we can ctrl C. > Version 5.2 > > Kind regards > Quoc Tri do What was it that you intended to do when you composed that command? -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: 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-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: [Help-bash] difference of $? and ${PIPESTATUS[0]}

2024-04-22 Thread Andreas Kähäri
The exit status of an "if" statement is the exit status of the last command executed within the body of the statement. In your last example, nothing is executed by the body of the "if" statement, so the exit status of the statement is zero. >From the bash manual about this in the "Compound Commands" section: The exit status is the exit status of the last command executed, or zero if no condition tested true. The PIPESTATUS array is set by virtue of executing the "false" command in the "if"-satement's test. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

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: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Andreas Schwab
On Apr 15 2024, Greg Wooledge wrote: > And that's a bug. That code is wrong, and it should be written this way > instead: > > [ -z "$var1" ] && [ -z "$var2" ] && continue Or just [ -z "$var1$var2" ] && continue -- And

Re: Potential Bash Script Vulnerability

2024-04-08 Thread Andreas Schwab
On Apr 08 2024, Greg Wooledge wrote: > Now imagine what happens if the shell is killed by a SIGKILL, or if > the system simply crashes during the script's execution. The script > is left with altered permissions. Or the script is executed by more than one process at the same time

Re: Docco

2024-03-27 Thread Andreas Schwab
not performed, > because the "$2 is a binary primary" check comes first. This is how > POSIX documents it. FWIW, ksh parses it the other way round: $ ksh93 -c '[ ! -a /tmp ]; echo $?; [ . -a /tmp ]; echo $?; [ - -a /tmp ]; echo $?' 1 0 ksh93: [: -: unknown operator 2 -- And

Re: Docco

2024-03-27 Thread Andreas Kähäri
confuse the two is a different matter, but the documentation is correct for the current implementation (which mimics the ksh shell with regards to the unary "-a" operator). -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: human-friendly ulimit values?

2024-02-29 Thread Andreas Schwab
On Feb 29 2024, Martin D Kealey wrote: > Should octal or hexadecimal be allowed (since they're easier to express > powers of two)? For this, $(( )) already provides enough support. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D

Re: human-friendly ulimit values?

2024-02-21 Thread Andreas Schwab
On Feb 21 2024, Christian Convey wrote: > E.g., for limiting virtual memory to 8 gigabytes, the invocation is "ulimit > -v 8388608", rather than something like "ulimit -v 8gb". Or ulimit -v $((8*1024*1024)) -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerp

Re: About `M-C-e` expand result `'` failed

2024-02-01 Thread Andreas Schwab
ion further. > I think that escaping is needed after quote removal in shell-expand-line. The function is called shell-expand-line, not shell-expand-and-requote-line. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "An

Re: About `M-C-e` expand result `'` failed

2024-01-30 Thread Andreas Schwab
s doing exactly what it is documented to do, that is do all of the shell word expansions. -- 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: wait -n misses signaled subprocess

2024-01-29 Thread Andreas Schwab
On Jan 29 2024, Robert Elz wrote: > I always wondered why the option was 'n' n = next? -- 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: complete NAME seems to diasable completion for NAME in the case of git

2023-12-21 Thread Andreas Schwab
On Dez 21 2023, Britton Kerin wrote: > But if I do `complete git' at a new shell That overwrites the completion spec for git (with the empty set, ie. no completions at all). If you want to print existing completions, use complete -p [NAME...]. -- Andreas Schwab, sch...@linux-m68k.org

Re: funsub questions

2023-12-14 Thread Andreas Schwab
t; content in a single string variable, which is a questionable idea in > most programs. For interactive use, $(< ...) is convenient and less verbose than the alternatives. -- 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: Missing documentation "-bash_input"

2023-11-28 Thread Andreas Schwab
et the $0 special parameter. $ bash -c 'echo $0 $2 $1' foo bar mumble foo mumble bar -- 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: Many of the example loadable builtins don't work anymore

2023-11-25 Thread Andreas Schwab
On Nov 25 2023, Emanuele Torre wrote: > But the bash executable still does not contain the legal_ symbols: If bash does not reference any of the symbols in lib/sh/compat.c there is nothing pulling it in. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2

Re: Command hangs when using process substitution

2023-11-18 Thread Andreas Schwab
es) works fine in the original pipeline, without > needing the redirect to /dev/null: > > $ echo foo | tee >(xsel -i) | tr o x > fxx That's because xsel is properly daemonizing itself, disconnecting from its stdin/out/err. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprin

Re: Command hangs when using process substitution

2023-11-18 Thread Andreas Schwab
rrors only (default) -quiet show informational messages on the terminal and run in the fore- ground -verbose provide a running commentary of what xclip is doing -- 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 manual - possible minor formatting issue

2023-11-11 Thread Andreas Kähäri
do ... done ... as opposed to the "for" command on the form for i in some list; do ... done -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: Idea: jobs(1) -i to print only :%ID:s

2023-11-09 Thread Andreas Schwab
for multi-line commands that happen to contain matches for re. $ (sleep 100; printf $'\n[100]\n') & -- 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: nullglob is documented incorrectly

2023-11-06 Thread Andreas Schwab
On Nov 06 2023, Chet Ramey wrote: > If nullglob is set, the non-matching pattern expands to the null string, > which is removed by word splitting. Since filename expansion happens after word splitting, this cannot be true. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint

Re: nullglob is documented incorrectly

2023-11-05 Thread Andreas Kähäri
that do not match any names are *removed*. That way one avoids the complications and ambiguities of explaining what the pattern expands or not expands to. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: "here document" causing failures. Implementation is inconsistent and not documented.

2023-10-10 Thread Andreas Kähäri
P Fri Jan 27 02:56:13 UTC > 2023 x86_64 x86_64 x86_64 GNU/Linux > > MS Windows MSYS2 (derived from Cygwin) > GNU bash, version 5.2.15(1)-release (x86_64-pc-msys) > MSYS_NT-10.0-19045 bob 3.4.6.x86_64 2023-02-15 18:03 UTC x86_64 Msys > > Oracle on ARM > GNU bash, version 5.1.16(1)-release (aarch64-unknown-linux-gnu) > Linux ub01 5.15.0-1034-oracle #40-Ubuntu SMP Wed Apr 19 16:10:04 UTC 2023 > aarch64 aarch64 aarch64 GNU/Linux -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-16 Thread Andreas K. Huettel
,2], where apparently wait() returns an undocumented exit code. Since wait seems to also be involved above, I tend to blame this in qemu now... [1] https://savannah.gnu.org/bugs/?64664 [2] https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg03207.html -- Andreas K. Hüttel dilfri...@gentoo.org Gentoo Linux developer (council, toolchain, base-system, perl, libreoffice) signature.asc Description: This is a digitally signed message part.

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-12 Thread Andreas K. Huettel
ad' builtin > is called. The /dev/tty tests can be fooled by typeahead while the tests > are running, but that doesn't usually happen. Could a timeout also mean that part of the data "got lost" and it's trying to read more than is available? -- Andreas K. Hüttel dilfri...@gentoo.org Gentoo Linux developer (council, toolchain, base-system, perl, libreoffice) signature.asc Description: This is a digitally signed message part.

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-12 Thread Andreas K. Huettel
Am Dienstag, 12. September 2023, 21:55:13 CEST schrieb Chet Ramey: > On 8/31/23 7:02 PM, Andreas K. Huettel wrote: > > Dear all, > > > > I'm trying to get qemu usermode emulation of riscv32 working. > > I managed to cross-build a linux system, and have it mostly r

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Andreas Kähäri
e cursor position (it just needs a > longer prompt): > > $ long_name="$(printf 'abcdef0123456789/%.0s' {0..20})" > $ mkdir -p /tmp/$long_name > $ cd /tmp/$long_name > $ PS1=$'\n\[\e[1m\]\w\[\e[m\] \$ ' > > Now press the u

Re: Warn upon "declare -ax"

2023-09-05 Thread Andreas Kähäri
how "exportable functions" work). However, since this is not generally supported, and definitely not supported by the default configuration of bash, using this feature makes your scripts hopelessly non-portable. That's part of the "or wha". I haven't looked at the implementation, so Kerin's view may be more informed than mine. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

riscv32, qemu-user: semi-functional, what goes wrong?

2023-08-31 Thread Andreas K. Huettel
told bash works fine in a riscv32 system emulation. Below is the output of the bash testsuite. Any advice on where to start looking for problems would be appreciated. Best, Andreas >>> Test phase: app-shells/bash-5.2_p15-r6 make -j1 check make[1]: Entering directory '/var/tmp

Re: bug attached

2023-08-31 Thread Andreas Kusalananda Kähäri
ble scope is restricted to that function and its children (including the functions it calls). > > > On Wed, Aug 30, 2023 at 5:59 PM Andreas Kusalananda Kähäri < > andreas.kah...@abc.se> wrote: > > > On Wed, Aug 30, 2023 at 03:40:21PM +0300, queency3 jones w

Re: bug attached

2023-08-30 Thread Andreas Kusalananda Kähäri
t; will remain unchanged (until you increment it from "3" to "4"). On an unrelated note, you sohuld be printing the value using a static formatting string, like so: printf '%s\n' "$aa" This avoids interpreting the value of the variable as a printf formatting string. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: using exec to close a fd in a var crashes bash

2023-08-23 Thread Andreas Schwab
affect EOF processing if the file is a pipe. -- 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 expansion occurs within arithmetic substitutions

2023-08-08 Thread Andreas Schwab
On Aug 08 2023, Dale R. Worley wrote: > More troublesome, I think, are several variable substitutions which > include "!" followed by a name. But I doubt they're used much in > interactive mode. The history expansion is smart enough to not interfere with ${!var}.

Re: nounset option: Error message points to the wrong variable when accessing associative arrays

2023-05-10 Thread Andreas Schwab
; Actual output: bash: foo: unbound variable This is expected. If the array is an indexed array, the subscript is an arithmetic expression. When bash tries to evaluate the subscript, it finds that foo is unbound. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 B

Re: IFS field splitting doesn't conform with POSIX

2023-03-30 Thread Andreas Schwab
are implementing POSIX wrong. > Except zsh. Note that zsh by default is not a POSIX shell, and even in sh compatibilty mode it doesn't strive to be POSIX compliant. -- 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: IFS field splitting doesn't conform with POSIX

2023-03-30 Thread Andreas Kusalananda Kähäri
though it does not have > an an explicit terminator. But that's not specified anywhere in POSIX. > > POSIX doesn't say what should be done with the text after the last > terminator. You could throw it away and still be conforming to POSIX. > > -- > Felipe Contreras -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: $SECONDS and timeout values use realtime `gettimeofday()`

2023-03-29 Thread Andreas Schwab
sense when you want to know the > time since the script started. Even CLOCK_MONOTONIC can jump forward. The only requirement is that it doesn't jump backward. -- 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: command_not_found_handle not run when PATH is empty

2023-03-09 Thread Andreas Schwab
On Mär 08 2023, Grisha Levit wrote: > I think it might make sense to change code that looks at the value of > PATH to explicitly treat an empty value as `.' so that all such > behavior is consistent. But an unset PATH is *not* the same as PATH=. -- Andreas Schwab, SUSE Labs, sch.

umask doesn't accept some valid symbolic modes

2023-02-22 Thread Andreas Schwab
According to https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html the symbolic mode can contain more than one action concatenated, for example "g+r-x", which is the same as "g+r,g-x". -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196

Re: Logical expressions and job control

2023-02-10 Thread Andreas Schwab
On Feb 10 2023, Godmar Back wrote: > It appears to be mistaking the wait status for the exit status if your > hypothesis is correct. Easy to verify: $ sleep 10 && echo yes || echo $? ^Z [1]+ Stopped sleep 10 148 -- Andreas Schwab, sch...@linux-m68k.org GPG K

Re: UBSAN error in lib/sh/random.c:79

2023-01-07 Thread Andreas Schwab
was that two divides are more costly than a divide and a multiply (although nowadays, compilers will try to combine the two divides if the target architecture has a divmod insn). -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC

Re: UBSAN error in lib/sh/random.c:79

2023-01-07 Thread Andreas Schwab
On Jan 07 2023, Martin Schulte wrote: > Hello! > > Am Sat, 07 Jan 2023 19:08:06 +0100 schrieb Andreas Schwab > : > >> On Jan 07 2023, Greg Wooledge wrote: >> ... >> I think the original overflow can only happen if the argument of >> intrand32 is bigger th

Re: UBSAN error in lib/sh/random.c:79

2023-01-07 Thread Andreas Schwab
overflow, because if l and h are unsigned, the computed value can never be negative, but it becomes bigger than INT_MAX if 2836 * h is bigger than 16807 * l (the unsigned result is computed modulo UINT_MAX+1). I think the original overflow can only happen if the argument of intrand32 is bigger th

Re: Arithmetic expression: evaluation order bug

2022-12-29 Thread Andreas Schwab
On Dez 30 2022, Steffen Nurpmeso wrote: > Not me!! Bash does it right for x=++x, There is no right answer. -- 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: Arithmetic expression: evaluation order bug

2022-12-29 Thread Andreas Schwab
On Dez 30 2022, Steffen Nurpmeso wrote: > Andreas Schwab wrote in > <87358xambe@igel.home>: > |On Dez 29 2022, Alain D D Williams wrote: > |> On Thu, Dec 29, 2022 at 10:30:09PM +0100, Steffen Nurpmeso wrote: > |> > |>> only clang warns on sequencing

Re: Arithmetic expression: evaluation order bug

2022-12-29 Thread Andreas Schwab
t.c:7:11: warning: operation on ‘i’ may be undefined [-Wsequence-point] i += j += i += j; ^~ t.c:11:11: warning: operation on ‘i’ may be undefined [-Wsequence-point] i += j += i += i; ^~ -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 E

Re: for loop goes to stopped job when Ctrl+C is pressed

2022-12-18 Thread Andreas Schwab
On Dez 17 2022, ks1322 ks1322 wrote: > When for loop output is piped to less and Ctrl+C is pressed, bash creates > unexpected stopped job That's because the process group receives SIGTTIN because less tries to read from the terminal while it doesn't own it. -- Andreas Schw

Re: reporting a bug

2022-12-15 Thread Andreas Schwab
h from 1 to 10 > > > example: > > source test.sh > sa 10 20 The function ignores the second argument. -- 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: Pending signal in EXIT trap causes pattern matching to fail

2022-12-07 Thread Andreas Schwab
interruptable while running the exit trap. -- 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: `declare -f "a="' fails unnecessarily

2022-12-04 Thread Andreas Schwab
o stop if from being interpreted as an assignment. $ \a=b foo hi -- 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: Bad leaks file fd to child processes

2022-11-26 Thread Andreas Schwab
46d82c4c95423fb7e10e68eba52050e30ba3/vscode-remote-lock.root.899d46d82c4c95423fb7e10e68eba52050e30ba3) > leaked on pvs invocation. Parent PID 3789: /usr/bin/bash That looks more like the FD leak is in vscode (and bash just hands them through). -- Andreas Schwab, sch...@linux-m68k.org GPG Key fin

Re: string substitution broken since 5.2

2022-11-03 Thread Andreas Schwab
string//\"/"}" > printf '%s' "$string" > > previously outputs: > xdotool type "sudo apt update" > > but now outputs: > xdotool type "quot;sudo apt update"quot; shopt -u patsub_replacement -- Andr

  1   2   3   4   5   6   7   8   9   >