take out vars

2005-03-09 Thread andreas
Hallo! T= echo '$T' # as expected echo "a '$T' b" # returns 66 ## NOT as expected. thanks, Andrew ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

LS_COLORS with ln=target not working

2015-03-20 Thread andreas
shows the relevant parts and works well for me. Thanks for bash! Andreas (I am not a subscriber of the list, so please CC me in reply) --- ./lib/readline/colors.c.orig2015-03-20 21:29:42.531215281 +0100 +++ ./lib/readline/colors.c 2015-03-20 21:38:11.119857048 +0100 @@ -109,6 +10

Re: syntax error while parsing a case command within `$(...)'

2021-02-16 Thread Andreas Schwab
sed as: * The first word of a command * The first word following one of the reserved words other than case, for, or in * The third word in a case command (only in is valid in this case) * The third word in a for command (only in and do are valid in this case) A

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Andreas Schwab
d then applies more rules on the placement of tokens. Andreas. -- 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: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Andreas Schwab
On Feb 23 2021, Greg Wooledge wrote: > No amount of quoting will make (( 'assoc[$var]'++ )) work. (( assoc[var]++ )) Andreas. -- 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: unsetting associative array executes commands

2021-03-11 Thread Andreas Schwab
On Mär 11 2021, Chet Ramey wrote: > $ cat x1 > declare -A blah > blah['$(DOESNOTEXIST)']=broken > shopt -s assoc_expand_once touch blah\$ > for i in "${!blah[@]}"; do unset blah["$i"]; done > declare -p blah > $ ../bash-5.1-patched/bash ./x1

Re: missing way to extract data out of data

2021-03-19 Thread Andreas Schwab
On Mär 19 2021, Alex fxmbsw7 Ratchev wrote: > yea well it does wonders, however was looking for a way without spawning > externals like gawk.. maybe in future there will be =) You know where to get perl or python. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint

Re: missing way to extract data out of data

2021-03-23 Thread Andreas Schwab
s dec hex filename 2068661 27364 648 2096673 1ffe21 /usr/bin/perl 1056850 22188 61040 1140078 11656e /bin/bash Of course, a lot of perl is part of loadable modules. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF7

Re: zsh style associative array assignment bug

2021-03-29 Thread Andreas Schwab
"b", "c"] >>>> dict(zip(x[::2], x[1::2])) > {'a': 'b'} > > It seems to discard the last (unmatched) value. >>> dict(zip_longest(x[::2], x[1::2])) {'a': 'b', 'c': None} Andreas. -- 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: select syntax violates the POLA

2021-04-02 Thread Andreas Schwab
; The right question would be why '} else' works. The two case are not really different, they are covered by the same rule: This recognition shall only occur when none of the characters is quoted and when the word is used as: * The first word following one of the reserved word

Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?

2021-05-04 Thread Andreas Schwab
On Mai 03 2021, Chet Ramey wrote: > It won't work on any system that doesn't return -1/ESPIPE when you try > to lseek on a terminal device. Glibc does; Glibc doesn't do anything, it just uses what the kernel says. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG K

Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?

2021-05-04 Thread Andreas Schwab
On Mai 04 2021, Chet Ramey wrote: > On 5/4/21 3:26 AM, Andreas Schwab wrote: >> On Mai 03 2021, Chet Ramey wrote: >> >>> It won't work on any system that doesn't return -1/ESPIPE when you try >>> to lseek on a terminal device. Glibc does; >>

Re: Question about case statement in Bash docs

2021-05-10 Thread Andreas Schwab
way quote removal definitely happens here. IIUC there is no need for quote removal, because quoting is part of the rules for pattern matching. Andreas. -- 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: Question about case statement in Bash docs

2021-05-10 Thread Andreas Schwab
so describes the effect of quoting parts of the pattern)" which suggests that quote removal is indeed not needed. Andreas. -- 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 #10070] toggle invert flag when reading `!'

2021-05-27 Thread Andreas Schwab
clearly valid. According to the POSIX grammar, a pipeline can only be a pipe_sequence optionally preceded by a single Bang. If you want another Bang the pipe_sequnce needs to be either a subshell or a brace_group. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D

Re: [patch #10070] toggle invert flag when reading `!'

2021-05-27 Thread Andreas Schwab
On Mai 27 2021, Chet Ramey wrote: > On 5/27/21 11:20 AM, Andreas Schwab wrote: >> On Mai 27 2021, Chet Ramey wrote: >> >>> On 5/26/21 9:55 PM, Dale R. Worley wrote: >>> >>>>> $ ! ! [ 1 -eq 1 ]; echo $? >>>>> 0 >>>&g

Re: [patch #10070] toggle invert flag when reading `!'

2021-05-27 Thread Andreas Schwab
On Mai 27 2021, Alex fxmbsw7 Ratchev wrote: > thought it would be useful, especially with PIPESTATUS You can always use a brace group. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something co

Re: [patch #10070] toggle invert flag when reading `!'

2021-05-27 Thread Andreas Schwab
On Mai 27 2021, Alex fxmbsw7 Ratchev wrote: > why doesnt it accept ! after | Because either side of | cannot be a pipeline. Andreas. -- 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 #10070] toggle invert flag when reading `!'

2021-05-27 Thread Andreas Schwab
On Mai 27 2021, Chet Ramey wrote: > You can argue that it's not clear enough that it allows multiple `!' > operators, Not from my reading of the description. It largely follows the POSIX gammar by only putting a single [!] into the pipeline syntax. Andreas. -- Andreas Schw

Re: shell-backward-kill-word needs to behave more like werase

2021-06-29 Thread Andreas Schwab
On Jun 29 2021, Basin Ilya wrote: > However, shell-backward-kill-word erases the word immedeately > preceding the caret plus it erases one additional space. Does it? Not for me. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF7

Re: Unexpected behaviour when using process substitution with stdout and stderr

2021-07-11 Thread Andreas Schwab
ave the previous disposition of fd 1 in another fd and redirect the output of stderr there. Andreas. -- 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: Infinite loop triggered by extglob +(!(x))y

2021-07-25 Thread Andreas Schwab
he length of the existing file names. That pattern has quadratic complexity. > It's a really bad runaway, requiring SIGKILL from another terminal to > stop it. Not really. It's just that an interactive shell ignores or postpones a lot of signals during command execution. In a n

Re: Infinite loop triggered by extglob +(!(x))y

2021-07-25 Thread Andreas Schwab
or more characters. Each additional character doubles the run time. Andreas. -- 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 concatenating member of large array with string

2021-08-10 Thread Andreas Schwab
On Aug 10 2021, Joe Pater wrote: > The attached bash script (named 'test'), when run on my laptop, > produces the following output: > > xyzerg That's because the value of ${words[0]} ends with a CR. You can see that if you pipe the output to `cat -A'. Andreas.

Re: GROUPS

2021-08-11 Thread Andreas Schwab
On Aug 11 2021, Štěpán Němec wrote: > Quoting POSIX.1-2017 on environment variables [1]: Note that GROUPS is not an environment variable in bash, it is not exported. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 &

Re: Defect in manual section "Conditional Constructs" / case

2021-08-24 Thread Andreas Schwab
for _pattern_: > "Each _pattern_ undergoes tilde expansion, parameter expansion, command > substitution, and arithmetic expansion." - quote removal is missing.) That's because quote removal is _not_ performed. The quotes are significant for pattern matching, which needs to respect

Re: BASH_BUILTINS(1) | 'man bash_builtins' | Manual not found

2021-09-30 Thread Andreas Schwab
and to get the list of builtins to come up with the man command. This happens automagically. Andreas. -- 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_BUILTINS(1) | 'man bash_builtins' | Manual not found

2021-09-30 Thread Andreas Schwab
"bash-builtins.7" is newer, and includes builtins like > mapfile, which are not listed in the synopsis. That's a bug with debian's packaging. The manpage from the bash sources doesn't have that bug. Note that the bash sources do not contain any section 7 manpages.

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
ic void parse_prologue (string, flags, tag) char *string; @@ -247,7 +253,7 @@ parse_prologue (string, flags, tag) add_unwind_protect (parser_restore_alias, (char *)NULL); if (orig_string && ((flags & SEVAL_NOFREE) == 0)) -add_unwind_protect (xfree, orig_string); +add_unwind_protec

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
On Okt 04 2021, Chet Ramey wrote: > On 10/4/21 4:34 AM, Andreas Schwab wrote: >> On Okt 04 2021, Julien Moutinho wrote: >> >>> - bash crashes inside valgrind too, >>> but apparently something different is happening >>> because it crashes even wit

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
nd everything works correctly. Nope, it's undefined behaviour, as pointed out by valgrind. Andreas. -- 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: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
e free function. The latter is seen by valgrind, the former isn't, so it didn't track it. Thus the xmalloc, xrealloc, xfree macros need to be disabled if valgrind is used. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
ut the bash malloc > because the default libc malloc probably doesn't do the bounds checking > the bash malloc does, even without malloc debugging turned on. If it's a buffer overflow, then valgrind should be able to catch it (when bash is configured --without-bash-malloc). valgrind

Re: Using systemd-249's libnss_systemd.so.2 triggers a crash in bash-5.1's malloc.c

2021-10-04 Thread Andreas Schwab
: main (in /home/andreas/a.out) ==31974== Address 0x5213068 is 0 bytes after a block of size 40 alloc'd ==31974==at 0x4C312EF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==31974==by 0x40068F: main (in /home/andreas/a.out) ==31974== ==31974== Invalid write of s

Re: read built-in command has a problem in shell function

2021-10-11 Thread Andreas Schwab
# NOT WORK! > > sh$ date | myfunc # NOT WORK! > > > if i change like this. then this time work well > > sh$ date | { date > /dev/null; myfunc ;} > yes This depends on the left side of the pipe producing output faster than the right side performing

Re: read built-in command has a problem in shell function

2021-10-11 Thread Andreas Schwab
On Okt 11 2021, Alex fxmbsw7 Ratchev wrote: > a sync in hope it syncs pipes It doesn't. It just alters the timing. Andreas. -- 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: hash not restored after running command -p

2021-11-03 Thread Andreas Schwab
e considered a bug either way. Either command -p is seen to modify PATH, then the hash should be reset afterwards, or command -p is seen to not search PATH, then the hash should be left alone. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 D

Re: bash conditional expressions

2021-11-12 Thread Andreas Schwab
On Nov 12 2021, Mischa Baars wrote: > Using Fedora 32 (bash 5.0.17) this returns a true, while on Fedora 35 (bash > 5.1.8) this returns a false: > touch test; if [[ -N test ]]; then echo true; else echo false; fi; What does `stat test' print respectively? Andreas. -- Andre

Re: bash conditional expressions

2021-11-12 Thread Andreas Schwab
FILE1 -nt FILE2 True if file1 is newer than file2 (according to modification date). Andreas. -- 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 conditional expressions

2021-11-15 Thread Andreas Schwab
gt; "relatime" option. Which is documented thus: AFAIK the "relatime" option has only an effect when the atime update is triggered as a side effect of reading a file. Explicit inode modifications via utime et.al. are always carried out independent of that option. Andreas. -- Andre

Re: bash conditional expressions

2021-11-17 Thread Andreas Schwab
On Nov 17 2021, Michael J. Baars wrote: > When -N stands for NEW, and touch (-am) gives you a new file It doesn't. The file hasn't been modified after it was last read. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E

Re: Line is corrupted when pasting long string in vi mode with exit_attribute_mode prompt

2021-12-18 Thread Andreas Schwab
On Dez 17 2021, Jack Pearson wrote: > PS1='$(tput sgr0)' # emit exit_attribute_mode capability string Non-printable characters in the prompt must be bracketed by \[ \]. PS1='\[$(tput sgr0)\]' -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4

Re: ~0, ~00, etc tilde expand to ~CURRENTUSER

2021-12-26 Thread Andreas Schwab
rectory stack, as it would be displayed by the 'dirs' builtin invoked with the characters following tilde in the tilde-prefix as an argument (*note The Directory Stack::). If the tilde-prefix, sans the tilde, consists of a number without a leading '+' or '-',

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Schwab
On Jan 21 2022, Lawrence Velázquez wrote: > Depends what you consider to be an issue. Personally, I would be > less than pleased if my whole terminal turned red just because I > changed into a directory that happened to have a weird name. Put $(tput sgr0) in PS1. -- Andreas Sc

Re: Bash-5.2-alpha available

2022-01-22 Thread Andreas Schwab
bash --posix -c 'read -t1

Re: Bash-5.2-alpha available

2022-01-22 Thread Andreas Schwab
y should it treated differently in here-documents? -- 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-5.2-alpha available

2022-02-10 Thread Andreas Schwab
use yank-last-arg to copy arguments from the preceding line. -- 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: Interesting bug

2022-02-12 Thread Andreas Schwab
code > foo="$(testCode)" || { echo "foo";} # --> Finished There is no forgotten space in the latter line. -- 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: the "-e" command line argument is not recognized

2022-02-16 Thread Andreas Schwab
ed by a single space character and followed by a newline, on the standard output. Options: -ndo not append a newline -eenable interpretation of the following backslash escapes -Eexplicitly suppress interpretation of backslash escapes -- Andreas Schwab, sch..

Re: Bash-5.2-alpha available

2022-02-16 Thread Andreas Schwab
On Feb 10 2022, Chet Ramey wrote: > On 2/10/22 9:53 AM, Andreas Schwab wrote: >> On Jan 21 2022, Chet Ramey wrote: >> >>> i. The non-incremental history searches now leave the current history offset >>> at the position of the last matching history entry, like

Re: Bash-5.2-alpha available

2022-02-27 Thread Andreas Schwab
ferent line instead. bash-5.2$ history 1 echo 1 2 echo 2 3 echo 3 4 history Now type e, , , 4, , . bash-5.2$ history 1 echo 1 2 echo 2 3* echo 34 4 history 5 echo 2 6 history Now type *4 (move to line 3), -> crash -- Andreas Schwab

Re: Bash-5.2-alpha available

2022-03-02 Thread Andreas Schwab
1* echo 1 2 history 3 history Type *2 (move to line 1), -> crash -- 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: 'hash foo' may fail, and would require something like 'hash /usr/bin/foo'

2022-03-09 Thread Andreas Schwab
sh > assumed that access returning EPERM meant that the binary wasn't > executable. This is a recurring problem with docker, and all comes down to the syscall filter returning a bogus errno. It happens every time a new syscall is introduced. -- Andreas Schwab, sch...@linux-m68k.org

Re: 'hash foo' may fail, and would require something like 'hash /usr/bin/foo'

2022-03-09 Thread Andreas Schwab
On Mär 09 2022, Chet Ramey wrote: > Ultimately, this comes down to gaps in the release engineering. That won't help, the container image often comes from a different source than the docker package. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 25

Re: 'hash foo' may fail, and would require something like 'hash /usr/bin/foo'

2022-03-11 Thread Andreas Schwab
On Mär 11 2022, Ángel wrote: > On 2022-03-09 at 20:35 +0100, Andreas Schwab wrote: >> On Mär 09 2022, Chet Ramey wrote: >> >> > Ultimately, this comes down to gaps in the release engineering. >> >> That won't help, the container image often comes f

Re: Bash-5.2-alpha available

2022-03-11 Thread Andreas Schwab
3 3 bash-5.2$ history 1 echo 1 2 echo 2 3 e 4 history 5 echo 2 6 history 7 echo 3 8 history -- 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 Report] The Unexpected Behavior When Using ANSI Escape Code

2022-03-20 Thread Andreas Schwab
On Mär 20 2022, Michaelll Lee wrote: > 1) $ PS1='---Test \\ \e[0m ---\\$ ' Read the manual about non-printing characters in the prompt. https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7

parameter expansion null check fails for arrays when [*] or [@] is used

2022-03-21 Thread Andreas Luik
Bash fails to correctly test for parameter to be unset or null when the parameter is an array reference [*] or [@]. Repeat-By: myvar[0]= echo "${myvar[0]:+nonnull}" -> OK echo "${myvar[*]:+nonnull}" nunnull -> not OK, because "${myvar[*]}" is

Re: Bash-5.2-alpha available

2022-03-22 Thread Andreas Schwab
because I moved over it. -- 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: defuncted printf process when using wpa_supplicant

2022-03-30 Thread Andreas Schwab
e resposible for them. $ sleep 1000 < <(cat /dev/null) & [1] 10418 10418 pts/13 S 0:00 | \_ sleep 1000 10419 pts/13 Z 0:00 | | \_ [cat] -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 &q

Re: Bash-5.2-alpha available

2022-03-31 Thread Andreas Schwab
). -- 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-5.2-alpha available

2022-03-31 Thread Andreas Schwab
history-search-backward? Hit the `echo 1' and accept-line? Yes. Afterwards, I see this history: 1 echo 1 2 echo 24 3 echo 3 4 history 5 echo 1 6 history -- 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 seems confused about it's state after unclosed single quotes in nested command substitution

2022-04-15 Thread Andreas Schwab
On Apr 15 2022, Martin Schulte wrote: > I would either have expected to get PS2 and no error messages after > entering the line starting with sleep That's what I get when trying this in 5.2-beta. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510

Re: Crash with 5.2 beta in compgen

2022-04-16 Thread Andreas Schwab
#8 0x555b74bd in gen_compspec_completions ( cs=cs@entry=0x5588e0d0, cmd=cmd@entry=0x55640771 "compgen", word=word@entry=0x556410e7 "", start=start@entry=0, end=end@entry=0, foundp=foundp@entry=0x0) at pcomplete.c:1333 #9 0x555cbdb2 in

Re: bash 5.1 heredoc pipes problematic, shopt needed

2022-04-25 Thread Andreas Schwab
performance. Don't use the shell for performance critical tasks. -- 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: -DSYS_BASHRC flag causes segfault on OpenBSD

2022-06-04 Thread Andreas Schwab
On Jun 03 2022, Anna (cybertailor) Vyalkova wrote: > 1. export CPPFLAGS="-DSYS_BASHRC='/home/sysrq/bash2/etc/bash/bashrc'" SYS_BASHRC must be a string, not a multi-character constant. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D

Re: builtin man page for wait omits information from SIGNALS

2022-06-15 Thread Andreas Schwab
s line, which I do not understand: > > .TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash 5.0" > > The version number and the date stamp do not match each other at all. The date has never been updated between commit 61deeb13 and f188aa6a. -- Andreas Schwab, sch...@linu

Re: Bug: garbled history search when using "\e[K" is PS1

2022-06-30 Thread Andreas Schwab
On Jun 30 2022, Constantine Bytensky wrote: > 1. Make PS1="\[\e[K\]" CSI K clears the whole line, clobbering the display region controlled by readline, so that is not a valid use of control sequences. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D

Re: Feature request

2022-07-06 Thread Andreas Schwab
On Jul 06 2022, Brad Hayes wrote: > Perhaps something similar to PHP's __DIR__ and __FILE__ constants? You can get that from $0. -- 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: $(( )): binary/unary VAR/NUM inconsistency

2022-07-06 Thread Andreas Schwab
quot;<$(( +10+++I ))>"' > <21> A C compiler would parse all those expressions as post-increment applied to a non-lvalue. -- 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: $(()): "?:": false "assignment to non-variable"

2022-07-11 Thread Andreas Schwab
On Jul 09 2022, Steffen Nurpmeso wrote: > $ bash -c 'I=3; echo "$((1?(I*=I):I+=I))";echo $I' The third operand of ?: cannot contain an assignment expression, thus, like in C, this is parsed as `(1?(I*=I):I)+=I'. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG

Re: functions can fully unset local vars in other scopes

2022-07-29 Thread Andreas Schwab
use a perl or python module in your program, you need a version of that module that has been ported to the perl or python version in use. -- 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 Coding style - Adopting C99 declarations

2022-08-28 Thread Andreas Schwab
; int c; >> procenv_t oevalbuf; >> >> val = 0; >> noeval = 0; >> already_expanded = (flags&EXP_EXPANDED); > > You're mistaken. What you're seeing is the "K&R" coding style, which > predates C89. Note that the next revi

Re: test or [ does not handle parentheses as stated in manpage

2022-09-05 Thread Andreas Schwab
On Sep 05 2022, Julian Gilbey wrote: > neither did using \( > instead of (, and neither did putting spaces around the parentheses. You need to do both. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now fo

Pending signal in EXIT trap causes pattern matching to fail

2022-10-12 Thread Andreas Schwab
EXIT while :; do :; done $ bash trap.sh | : ^C++ echo trap trap.sh: line 1: echo: write error: Broken pipe ++ case a in ++ echo done done -- 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 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

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

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

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

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

  1   2   3   4   5   6   7   8   9   >