On Mon, Mar 24, 2025 at 03:47:20AM -0400, anonymous wrote:
> # Check if pipefail is set using 'shopt'
> if (set -o | grep -q 'pipefail *on'); then
> pipefail_on=1
> fi
To check if an option is set you use [[ -o pipefail ]], not that thing.
Also if you run local - in a fun
If you run a simple command that runs something (not just assignments)
and contains an assignment word with ${|;} that is preceeded by at least
one other assignment word, bash segfaults.
Reproducible with a= b=${|:;} :
$ gdb --args ./bash -c 'a= b=${|:;} :'
Reading symbols from ./bash...
(gdb)
The function serialisation code thinks that 1 is the default file
descriptor for <> redirections, when it is actually 0.
BEFORE
$ a () { <> f ;}; declare -f a
a ()
{
0<> f
}
$ a () { 1<> f ;}; declare -f a
a ()
{
<> f
}
AFTER
$ a () { <> f ;}; d
On Mon, Oct 28, 2024 at 12:47:53AM +0100, Emanuele Torre wrote:
> }
>else
> -file_error (command);
> +{
> + errno = opt;
> + file_error (command);
> +}
>
I just thought that perhaps this branch was supposed to print errors for
the executa
In a branch of exec_builtin(), errno is not restored before printing an
error message, and that causes "Success" to be printed.
Example:
$ # bash 5.2.37
$ cd /tmp
$ echo "export env='\''$(echo {1..100500})'\''" > src
$ . ./src
$ exec -- "$BASH"
bash: /bin/bash: Argument li
On Tue, Oct 22, 2024 at 03:34:43PM +0800, cirrus.mazurka...@icloud.com wrote:
> The following produces a `bash: test: too many arguments` exception in
> `test`, with exit status 2:
>
> ``` bash
> v='>'
> test -n "$v" -a yes '!=' no # bash: test: too many arguments
> echo $? # 2
>
> test -n '>' -
On Fri, Sep 06, 2024 at 08:37:54AM +0800, Lockywolf wrote:
> >I think this is appropriate for a loadable builtin. This one is Linux-
> >specific.
>
> I am not experienced enough to have an opinion on whether a loadable
> built-in is better than a feature of "exec".
A loadable builtin is a builtin
I think your idea of using exec -a '' with no positional arguments to
set it is pretty cool, since exec -a changes the argv[0] of the
invoked process and exec with redirections an no arguments applies
redirections to the current shell permanently!
Not super relevant, but I have a bash loadable
On Sat, Aug 24, 2024 at 02:15:48AM +0200, Steffen Nurpmeso wrote:
> Sorry but i really have to come again, i do not understand what is
> going on, and *i* think shell is at fault.
No. It is working correctly.
>
> This:
>
> a() {
> echo $#,1=$1,2=$2,"$*",$*,
This $1 is unquoted, it will b
On Wed, Jul 10, 2024 at 09:24:03AM -0400, Chet Ramey wrote:
> On 7/4/24 2:51 AM, Emanuele Torre wrote:
> > Hello.
> >
> > Normally, ${foo[@]@A} expands to multiple values, that are the arguments
> > to run a declare command that sets foo to the current value/attributes
On Sat, Jul 06, 2024 at 01:41:01PM +0200, Jens Schmidt wrote:
> Today I came across this one:
>
> [copy-on-select-2]$ echo $BASH_VERSION
> 5.2.15(1)-release
> [copy-on-select-2]$ foo() { trap 'echo foo' RETURN; /bin/echo bar; }
> [copy-on-select-2]$ foo
> bar
> foo
> [copy-on-select-
On Fri, Jul 05, 2024 at 10:38:59PM +0200, Emanuele Torre wrote:
> Yes, clearly that is influencing this new behaviour, but this is new:
> <(((
On Fri, Jul 05, 2024 at 04:10:55PM -0400, Dale R. Worley wrote:
> Emanuele Torre writes:
> > Bash 5.2 apparently added <(< file) that expand to the path to a fifo
> > (openable only for read on BSD) to which the contents of file are
> > written to, without document
Bash 5.2 apparently added <(< file) that expand to the path to a fifo
(openable only for read on BSD) to which the contents of file are
written to, without documenting it.
It also added >(< file) which is rather weird and fun; it expands to
the path to a fifo (openable only for write on BSD),
On Thu, Jul 04, 2024 at 09:08:21PM -0400, Dale R. Worley wrote:
> Emanuele Torre writes:
> > [...]
> > Today, I have noticed that if IFS is set to a value that does not
> > include space, [@]@A will expand to a single value
> > [...]
> > As an aside, [*]@A alwa
Hello.
Normally, ${foo[@]@A} expands to multiple values, that are the arguments
to run a declare command that sets foo to the current value/attributes.
bash-5.2$ a=( abc xyz 123 ); declare -pa result=("${a[@]@A}")
declare -a result=([0]="declare" [1]="-a" [2]="a=([0]=\"abc\" [1]=\"xyz\"
>From the bash man page:
compat43
• the shell does not print a warning message if an attempt
is made to use a quoted compound assignment as an argument
to declare (e.g., declare -a foo='(1 2)'). Later versions
warn that this usage is depreca
On Mon, Jun 24, 2024 at 09:37:42PM +0300, Oğuz wrote:
> You can do these
>
> $ %f(){ :;}
> $ declare -f %f
> %f ()
> {
> :
> }
> $ unset -f %f
> $ declare -f %f
> $ echo $?
> 1
>
> but not call them
>
> $ %f
> bash: fg: %f: no such job
> $ '%f'
> bash: fg: %f: no such job
> $ \%f
> bash: fg:
I don't know why this savannah ticket has been crossposted to @bug-bash,
but its replies have not been crossposted here: it is very confusing.
Anyway, they already got a response on savannah.
o/
emanuele6
Hello.
I have noticed that, in C locale, %lc prints nothing if the first byte
of the argument is non-ASCII (0x80-0xff).
This is the only way %...c can ever output 0 bytes in bash, so it is
probably unintenional.
$ LC_ALL=C; { printf %lc%n è x; declare -p x >&2;} | od -An -to1
declare --
On Tue, Feb 27, 2024 at 12:23:41PM +0100, Emanuele Torre wrote:
> On Tue, Feb 27, 2024 at 04:10:06PM +0700, Robert Elz wrote:
> > Date:Tue, 27 Feb 2024 00:50:46 +0100
> > From: Emanuele Torre
> > Message-ID:
> >
> > | To use esac
On Tue, Feb 27, 2024 at 04:10:06PM +0700, Robert Elz wrote:
> Date:Tue, 27 Feb 2024 00:50:46 +0100
> From: Emanuele Torre
> Message-ID:
>
> | To use esac as a pattern you need to use the (esac) syntax,
>
> Or quote it
>
> 'es
Hello.
I have noticed that declare -f does not output valid code when a
pattern is `esac'.
To use esac as a pattern you need to use the (esac) syntax, but
declare -f does not use it, and ends up generating invalid code.
a () {
case $1 in
hi) echo hi ;;
(esac) echo esac ;;
On Sat, Feb 24, 2024 at 02:11:25PM +0900, Koichi Murase wrote:
> I have a question. Maybe it's not technically a bug as fd > 9 is
> involved, but the resulting behavior appears to be strange. I
> received some reports from users in my project and tried to find out
> what is happening. This is a
I recently discovered that it is possible to set attributes on readonly
variables
$ declare -p PPID
declare -ir PPID="759437"
$ declare -l PPID
$ declare -p PPID
declare -irl PPID="759437"
I noticed SHELLOPTS and BASHOPTS among the default readonly variables
set by bash.
They are modifi
I have notices that funsubs can be used to unload loadable builtins
while they are being run e.g.
bash-5.3$ enable -f {examples/loadables/,}mktemp
bash-5.3$ declare -n foo='q[${| enable -d mktemp;}0]'
bash-5.3$ mktemp -v foo
/tmp/shtmp.jKcUE0
Segmentation fault (core dumped)
T
On Sat, Nov 25, 2023 at 01:20:55PM -0500, Chet Ramey wrote:
> On 11/24/23 9:40 PM, Emanuele Torre wrote:
> > Many of the loadable builtins that set variables in the
> > examples/loadables directory don't work anymore because they still want
> > to call legal_identifier i
On Sat, Nov 25, 2023 at 08:53:48AM +0100, Emanuele Torre wrote:
> Now I can see that compat.o is actually being used to create
> lib/sh/libsh.a, and that libsh.a contains the legal_ symbols
>
> [...]
>
> But the bash executable still does not contain the legal_ symbols:
&g
On Sat, Nov 25, 2023 at 04:32:36AM +0100, Emanuele Torre wrote:
> I've noticed that a lib/sh/compat.c file was added that still provides
> the declaration for the legacy legal_ functions.
>
> The bash executable I was getting from building the devel branch did not
> have
I've noticed that a lib/sh/compat.c file was added that still provides
the declaration for the legacy legal_ functions.
The bash executable I was getting from building the devel branch did not
have those symbols though.
The reason was that lib/sh/Makefile was not getting regenerated, so the
recip
Many of the loadable builtins that set variables in the
examples/loadables directory don't work anymore because they still want
to call legal_identifier instead of valid_identifier.
$ ./bash -c 'enable -f {examples/loadables/,}mktemp; mktemp'
/tmp/shtmp.h2HpWZ
$ ./bash -c 'enable -f {e
On Mon, Nov 06, 2023 at 08:56:11AM -0500, Chet Ramey wrote:
> If nullglob is set, the non-matching pattern expands to the null string,
> which is removed by word splitting.
Well, I guess that is one way to look at it, but this explanation does
not make much sense in my opinion since the results of
fdflags -s was re-parsing the setspec for each fd argument.
This is problematic because it is using strtok() to parse it
destructively.
So, only the first part of the setspec will be set for all file
descriptors; the other parts will only be set for the first file
descriptor:
$ enable fdflags
Today, a user in the #bash IRC channel of libera.chat, misunderstood how
nullglob is supposed to work because is documented incorrectly in the
man page:
'nullglob'
If set, Bash allows filename patterns which match no files to
expand to a null string, rather than themselves.
On Thu, Oct 19, 2023 at 04:12:16PM -0400, Chet Ramey wrote:
> On 10/18/23 1:08 PM, Emanuele Torre wrote:
> > While we are at it, when examining this issue now, I have also noticed
> > that, regardless of whether brace expansion is enabled or not, the bash
> > parser always r
On Wed, Oct 18, 2023 at 11:24:11AM -0400, Chet Ramey wrote:
> On 10/18/23 10:50 AM, Chet Ramey wrote:
>
> > > Is it really ok to break that behaviour?
> >
> > That's why, if you want the first problem repaired, you have to specify
> > which word expansions are ok to parse and which are not. Shoul
On Wed, Oct 18, 2023 at 09:50:00AM -0400, Chet Ramey wrote:
> On 10/17/23 5:55 PM, Emanuele Torre wrote:
> > > braces.c
> > > - brace_gobbler: use extract_dollar_brace_string if we see ${ with
> > > the appropriate value of QUOTING, so we don't have to t
> braces.c
> - brace_gobbler: use extract_dollar_brace_string if we see ${ with
> the appropriate value of QUOTING, so we don't have to teach brace
> expansion more shell syntax.
> Report from Emanuele Torre
> - brace_gobbler: call the wo
In a PE pattern, if the pattern has a single quoted part that contains
$( and does not contain a closing parenthesis, and has \' at the
end, bash will try to parse a command substitution and fail.
$ echo "${HOME#'$('\'}"
bash: command substitution: line 3: unexpected EOF while looking
If you have a CHLD trap set, and you run any command that has more than
one command substitution, or an array subscript with more than one
command substituion in an arithmetic context, or also in a prompt
string, you will get parse errors.
$ ./bash -c 'trap : CHLD; let "x[\$(exit 20)0]"'
$ ./
On Thu, Aug 31, 2023 at 03:02:22PM -0500, Eric Blake wrote:
> On Thu, Aug 31, 2023 at 03:10:58PM -0400, Chet Ramey wrote:
> > Why not standardize another character, like %B? I suppose I'll have to look
> > at the etherpad for the discussion. I think that came up on the mailing
> > list, but I can't
On Tue, Aug 08, 2023 at 03:35:10PM -0400, Chet Ramey wrote:
> Anyway, there's a good reason to add ";&|" to the set of characters that
> inhibit history expansion if they follow the history expansion character.
Thank you! Please also "()<>" if possible.
o/
emanuele6
On Tue, Aug 08, 2023 at 09:24:48AM -0400, Zachary Santer wrote:
> Configuration Information:
> Machine: x86_64
> OS: msys
> Compiler: gcc
> Compilation CFLAGS: -march=nocona -msahf -mtune=generic -O2 -pipe
> -D_STATIC_BUILD
> uname output: MSYS_NT-10.0-19045 Zack2021HPPavilion 3.4.7.x86_64 2023-07-
! followed by a ; or another terminator is interpreted as an history
expansion with no pattern that can never match anything.
$ !; echo hi
bash: !: event not found
$ !&& echo hi
bash: !: event not found
It should not be intepreted as a history expansion that cannot possibly
match anythin
On Mon, Jul 03, 2023 at 05:24:49PM -0400, Chet Ramey wrote:
> It's really more like
>
> a=(); a[0]=1 a[1]=2 a[2]=3
>
> and the += variant omits the initial array flush.
Oh, yes. I knew it, but I forgot to mention it.
> > I would have expected:
> >
> >$ a=([1]=hi [100]=foo [-1002]=bar boo [
On Fri, Jun 30, 2023 at 12:16:46PM -0400, Chet Ramey wrote:
> > What I would have expected was something like this:
> >
> >$ x=([9223372036854775805]=foo)
> >$ x+=( {1..5} ); echo "this won't run"
> >bash: some "invalid assignment" error
> >$ declare -p x # no value gets appended s
On Fri, Jun 30, 2023 at 08:53:16AM +0200, Phi Debian wrote:
> Well
>
> ┌─none:/home/phi
> └─PW$ type sleep
> sleep is hashed (/usr/bin/sleep)
>
> So sleep is not a builtin here.
This patch is for the sleep loadable builtin example distributed with
bash.
You can activate it using
enable -f "$(
On Fri, Jun 30, 2023 at 03:28:36AM +1000, Martin D Kealey wrote:
> On Thu, 29 Jun 2023 at 19:45, Denys Vlasenko wrote:
>
> > IIRC bash used to allow numeric constants of the
> > BASE#DIGITS form even if the DIGITS part was empty.
> > IOW: not only "64#0", but "64#" too was accepted
> > as a valid
The fix in the most recent push did not fix the issue:
$ x=([9223372036854775805]=foo)
$ x+=( {1..5} )
$ echo "${x[@]}"
3 4 5 foo 1 2
It behaves exactly the same way: no error is printed, some elements are
prepended instead of appended, and there are invalid indices in the
output of decl
If an indexed array has no available slots after its last index, +=()
will overflow the last index, and set into an illegal negative index,
effectively prepending values instead of appending them.
$ x=([9223372036854775807]=hello)
$ x+=( and hi )
$ echo "${x[@]}"
and hi hello
$ x+=(
On Tue, May 30, 2023 at 02:42:46PM +0200, alex xmb ratchev wrote:
> does graph mean printable
Sort of. [[:print:]] matches all the printable characters
https://en.wikipedia.org/wiki/ASCII#Printable_characters
[[:graph:]] matches all the characters that are printable, but not
whitespace.
In POS
The documentation for glob character classes is innacurate:
> 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
On Sat, May 27, 2023 at 09:39:18AM -0700, Wiley Young wrote:
> Description:
>
> A syntax error on a variable assignment lead to $x being unset when `enable
> -n "$x" was executed, which produced this error message:
> ./test.sh: line 22: enable: cannot find _struct in shared object :
> /usr/bin/b
Since bash 5.2, enable mkdir is equivalent to enable -f mkdir mkdir.
But, if you use the -n flag, and mkdir is not a loaded builtin, it will
also be equivalent to enable -f mkdir mkdir (so the -n flag is
ignored), and the newly loaded foo will be enabled instead of disabled:
$ ./bash -c 'c
Error messages for fatal error e.g. ${x?foo} or rovar=foo or
$x expanded with nounset, report an error message prefixed by the string
"environment:" instead of "scriptname:" (or "$0:").
$ bash -c '${x?hi}' asd
asd: line 1: x: hi
$ bash -c 'a () { ${x?hi} ;}; a' asd
environment: lin
On Mon, May 22, 2023 at 09:27:17AM +1000, Martin D Kealey wrote:
> I just realised I expressed an opinion about associative arrays while the
> original post was about indexed arrays.
>
I simply reported that, specifically in arithmetic contexts, when using
a variable (not as the lhs of an = assig
This was already reported 12 and a half years ago, but there have not
been many replies:
https://lists.gnu.org/archive/html/bug-bash/2010-12/msg00128.html
The issue seems to be caused by expr_streval() only checking for unbound
identifiers at this line:
https://git.savannah.gnu.org/cgit/bash
On Thu, May 11, 2023 at 10:54:36AM +, Baumann, Moritz wrote:
> Sorry for bothering you again, but I might have misremembered: I looked
> through the manual again and could not find any mention of this behavior
> in any of the following sections:
>
> * Arrays
> * Bash Conditional Expressions
On Wed, May 10, 2023 at 05:44:54PM +, Baumann, Moritz wrote:
> In the case that lead me to submit this report, the error even occurred
> inside a check for the existence of an array key, which made the resulting
> message even weirder:
>
> if [[ -v "mistyped_array[$1]" ]]; then
> ...
> fi
⚠
On Wed, May 10, 2023 at 05:25:35PM +0200, Emanuele Torre wrote:
> On Wed, May 10, 2023 at 02:07:46PM +, Baumann, Moritz wrote:
> > Description:
> > When the nounset option is set, and you try to access a key of an
> > associative array that does not exi
On Wed, May 10, 2023 at 02:07:46PM +, Baumann, Moritz wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-musl
> Compiler: gcc
> Compilation CFLAGS: -Os -Wformat -Werror=format-security
> -Werror=int-conversion -DSYS_BASHRC='/etc/bash/bash
On Wed, May 10, 2023 at 09:05:20PM +0800, Clark Wang wrote:
> See the following example (with 5.2.15):
>
> bash-5.2$ PS1='$? >> '
> 0 >> eval '`'
> bash: unexpected EOF while looking for matching ``'
> 0 >><-- press ENTER
> 2 >><-- now $? is 2
>
>
> It looks like the failed eval
On Wed, May 03, 2023 at 04:56:16PM -0700, Tianon Gravi wrote:
> I'm getting the following error when building the latest "devel"
> (23935dbe8513437e69ca14d6b0890067dddceba3) on Alpine Linux 3.17:
Techincally ssize_t is not part of standard C, and, according to
POSIX, it should be defined in tha
This was causing crashes when non-interactive shells that read stdin,
either source a file that dups stdin, or run an eval command that dups
stdin:
$ bash <<< 'echo hi 9<&0'
hi
$ printf %s\\n 'echo hi 9<&0' > file; bash <<< '. ./file'
Segmentation fault (core dumped)
$ bash <<< 'eval "ec
FIGNORE makes bash only ignore filename completion results that end with
one of the specified suffixes and are not exactly equal to the suffix.
So, for example, FIGNORE=xyz will ignore `abcxyz', and `xyzxyz', but
not `xyz'.
>From the documentation it is not clear that FIGNORE should work this
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux t420 6.1.21-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 22 Mar 2023
14:30:48 + x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version:
On Mon, Apr 03, 2023 at 10:30:29AM -0400, Chet Ramey wrote:
> On 3/31/23 10:20 PM, Zev Weiss wrote:
>
> > Bash Version: 5.2
> > Patch Level: !PATCHLEVEL!
> > Release Status: release
> >
> > Description:
> >
> > When 'set -e' is enabled, file-content substitutions of the form $(<...)
> > cause an
On Thu, Mar 30, 2023 at 11:35:08AM -0600, Felipe Contreras wrote:
> > How can you say that the current implementation that bash, dash, etc.
> > use is not compliant to the POSIX specification?
>
> I have never said that.
The title of this thread is "IFS field splitting doesn't conform with
POSIX"
On Thu, Mar 30, 2023 at 07:51:59AM -0600, Felipe Contreras wrote:
> But you can't replicate 'a,b' that way, because b does not have a
> terminator. Obviously we'll want 'b' as a field, therefore one has to
> assume either 1) the end of the string is considered an implicit
> terminator, or 2) the te
---
parse.y | 1 +
1 file changed, 1 insertion(+)
diff --git a/parse.y b/parse.y
index 639912b6..65c1d88a 100644
--- a/parse.y
+++ b/parse.y
@@ -73,6 +73,7 @@
# include "jobs.h"
#else
extern int cleanup_dead_jobs (void);
+extern int count_all_jobs (void);
#endif /* JOB_CONTROL */
#if defi
On Sun, Mar 26, 2023 at 08:19:25AM +0200, Emanuele Torre wrote:
> -sa = xmalloc(n * sizeof(sort_element));
> +if (n)
> + sa = xmalloc (n * sizeof(sort_element));
> i = 0;
> for ( j = 0; j < hash->nbuckets; ++j ) {
>
- add some missing free()
- avoid calling xmalloc(0)
- fix f () { local b; asort -i b a ;} not updating b if b is declared
but doesn't have a value using builtin_find_indexed_array()
instead of find_or_make_array_variable():
bash-5.2$ typeset a=(z y x) b c=1; asort -i b a; asort -i c a
Before this patch, if allexport was set, $_ gained the "x" attribute
after PROMPT_COMMAND finished running, that would only get removed after
the next simple command is executed.
$ PROMPT_COMMAND=:
$ : foo
$ declare -p _
declare -- _="foo"
$ set -a
$ : bar
$ declare -p _
declare -x
On Mon, Feb 06, 2023 at 10:18:30AM -0500, Dale R. Worley wrote:
> The behavior of bash appears to be is "future changes in shell options
> using the 'set' builtin inside the current function invocation are
> restored to their prior values when the function returns".
Perhaps, the wording of the doc
Before this patch, running local - a second time in the same scope
would overwrite the previously saved options:
a () { local -; set -C; echo "2: $-"; local -; set -u; echo "3: $-" ;}
echo "1: $-" # 1: himBHs
a # 2: himBCHs
# 3: himuBCHs
echo "4: $-" # 4
aph after moving the suggestion of using
exec {BASH_XTRACEFD}<&1 to the bottom.
emanuele6
On 16/01/2023, Emanuele Torre wrote:
> On Mon, Jan 16, 2023 at 11:36:18AM -0600, dave.dram...@gmail.com wrote:
>> Description:
>>
>> I have `set -x` and `BASH_XTRACEFD=1` set in
On Mon, Jan 16, 2023 at 11:36:18AM -0600, dave.dram...@gmail.com wrote:
> Description:
>
> I have `set -x` and `BASH_XTRACEFD=1` set in a simple script that I
> have in
> a cron job. I'd like to see the progress of the script when run
> manually,
> hence `set -x`, but I want th
On Sat, Jan 07, 2023 at 03:00:58PM +0100, felix wrote:
>strU8DiffLen0() { local _cLen=${#1} LC_ALL=C;return $((${#1}-_cLen));}
Do not use `return' like that.
`return' is used to make functions report an exit status: 0 for success,
non-zero for various kinds of failure, just like executable pr
The unset builtin, when invoked without an option, should first try to
unset the variable (or array element) specified by its arguments, and
then fall back to trying to remove the function definition for the
function that has the name specified by the argument if it exists.
bash-5.1$ declare -
On Thu, Dec 29, 2022 at 05:35:48PM +, Alain D D Williams wrote:
> On Thu, Dec 29, 2022 at 06:23:09PM +0100, Steffen Nurpmeso wrote:
> > Hello.
> >
> > Name: bash
> > Path: /usr/ports/core
> > Version: 5.2.15
> > Release: 1
> >
> > $ i=10 j=20;echo $(( i +=
On Fri, Dec 23, 2022 at 06:53:08PM -0500, Chet Ramey wrote:
> On 12/23/22 7:24 AM, Emanuele Torre wrote:
> > About two months ago, I discovered, reading the bash source code for
> > printf, the %n format specifier.
> >
> > What it does is assign to the variable spe
About two months ago, I discovered, reading the bash source code for
printf, the %n format specifier.
What it does is assign to the variable specified as its argument, the
number of bytes that have been written so far (similarly to the C
counterpart).
This can be quite useful if you, for example,
The bash manual says:
If parameter is ‘@’ or ‘*’, the result is length positional parameters
beginning at offset. A negative offset is taken relative to one greater
than the greatest positional parameter, so an offset of -1 evaluates to
the last positional parameter. It is an expansion error i
On Sun, Dec 18, 2022 at 06:35:45AM +, Harald van Dijk wrote:
> The assumption here, that if (interactive), input is coming from
> stdin, does not hold when running bash -ic.
>
> Repeat-By:
> bash -ic 'set -o emacs'
Wow, this is a very old bug. I think this 2.04 bug report fr
On Wed, Dec 14, 2022 at 02:30:04PM -0500, Chet Ramey wrote:
> Try this.
>
> *** ../bash-20221202/lib/readline/readline.c 2022-12-06 09:48:50.0
> -0500
> --- lib/readline/readline.c 2022-12-14 14:20:32.0 -0500
> ***
> *** 591,595
> (*rl_redisplay_function
On Wed, Dec 14, 2022 at 12:31:39PM -0500, Chet Ramey wrote:
> On 12/13/22 9:00 AM, Emanuele Torre wrote:
> > This happens since 88d69b4fa224d93ef1d26b80229668397bb6496b .
> >
> > If bash is started with the TERM variable unset or empty, it will
> > segfault and crash
This happens since 88d69b4fa224d93ef1d26b80229668397bb6496b .
If bash is started with the TERM variable unset or empty, it will
segfault and crash if you press the Delete key twice (it only happens
for the first prompt, and if you don't press anything before the two
Delete key presses).
I was abl
On Tue, Dec 13, 2022 at 03:07:16AM -0500, Lawrence Velázquez wrote:
> Of course not. I only meant to demonstrate that "export" always
> creates global variables, so a function that utilizes "declare -gx"
> actually behaves more like "export" then your alias does.
This is a little inaccurate.
`ex
`declare -f "something="' fails with the following error:
$ declare -f 'a=x'
bash: declare: cannot use `-f' to make functions
$ f=a=x
$ decalre -f -- "$f"
bash: declare: cannot use `-f' to make functions
That error is not very useful. Bash makes `declare -f' fail with that
err
In Bash, it is possible to define functions that look like assignment
words using the function keyword:
function a=2 { printf hi\\n ;}
When `declare -f' is used to output all the function definitions, bash
will not output that function definition with the "function" keyword,
generating invali
On Mon, Nov 21, 2022 at 07:07:08PM -0500, d...@dabe.com wrote:
> emanuele6 suspects it has to do with
> https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00107.html
No, actually later, I said that it has probably been introduced earlier
since I tried running 'time (sleep 1)' in a versi
On Wed, Nov 16, 2022 at 02:05:56PM -0500, Chet Ramey wrote:
> It doesn't matter. `local -' is the only way to save and restore the
> options; `declare -p -' and `typeset -p -' should have no special meaning.
The `declare -p'/`typeset -p' commands and the `local -p' command are
different commands.
The 31f4d468b60eb27d768ef56d0a8b4982346465d9 commit on the devel branch,
addressed this issue, but only partially:
bash-5.1$ ./bash --version |& head -n 1
GNU bash, version 5.2.9(6)-maint (x86_64-pc-linux-gnu)
bash-5.1$ ./bash -c 'a () { local -; local -p; declare -p -; typeset -p -;
Since bash 5.2, local/typeset/declare -p without argument no longer
outputs "declare -- -" when local - is used.
But local/typeset/declare -p - still outputs "declare -- -" instead of
"local -".
bash-5.1$ a () { local -; local -p; declare -p -; typeset -p -;
local -p - ;}
bash-5.1$
On 24/10/2022, Robert Elz wrote:
> | The problem that was described is caused by that
> | optimisation (not the version that is applied to simple commands that
> | run external program, but to subshell compound command as mentioned).
>
> I understand that.
>
> | In case you did not underst
On 24/10/2022, Robert Elz wrote:
> It need not make a difference. The wait command is not intended to
> be just the wait(2) (or wait(3) whichever it is on the system in
> question) system call (or wrapper around another system call).
I don't see how this is relevant.
> There's no reason that w
I don't think the process running `cat' is a sibling of the subshell.
bash performs an optimisation that runs redirections applied to simple
commands that run external programs, or subshell compound commands after
the fork(). (to avoid having to restore file descriptors after running
the command.)
oops, sorry. ignore this email.
On 30/09/2022, Emanuele Torre wrote:
> ---
> execute_cmd.c | 9 -
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/execute_cmd.c b/execute_cmd.c
> index d0d1dd31..4d0fdcf7 100644
> --- a/execute_cmd.c
> +++ b/ex
---
execute_cmd.c | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/execute_cmd.c b/execute_cmd.c
index d0d1dd31..4d0fdcf7 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -3901,7 +3901,10 @@ execute_cond_node (cond)
}
else if (cond->type == COND_UNARY)
{
-
On 30/09/2022, Emanuele Torre wrote:
> In bash-5.2, using the ${parameter@Q} parameter expansion with an unset
> parameter, in an array subscript, in an arithmetic context, causes a
> segmentation fault.
Actually, using any parameter expansion with an unset parameter in an
array subscri
1 - 100 of 133 matches
Mail list logo