bash -xv issue with stderr
Configuration Information [Automatically generated, do not change]: Machine: aarch64 OS: darwin24.0.0 Compiler: clang Compilation CFLAGS: -DSSH_SOURCE_BASHRC -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.' uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 Machine Type: aarch64-apple-darwin24.0.0 Bash Version: 5.2 Patch Level: 37 Release Status: release Description: Redirecting stderr to file causes output of bash -xv to be writte to file as well Repeat-By: test_bash.sh: " test_fun() { echo "to stderr" >&2 } test_fun &>out " bash -xv test_bash.sh: " test_fun() { echo "to stderr" >&2 } test_fun &>out + test_fun " out: " + echo 'to stderr' to stderr " Fix:
bash -xv issue with stderr
Configuration Information [Automatically generated, do not change]: Machine: aarch64 OS: darwin24.0.0 Compiler: clang Compilation CFLAGS: -DSSH_SOURCE_BASHRC -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/\ bash:.' uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 Machine Type: aarch64-apple-darwin24.0.0 Bash Version: 5.2 Patch Level: 37 Release Status: release Description: Redirecting stderr to file causes output of bash -xv to be writte to file as well Repeat-By: test_bash.sh: " test_fun() { echo "to stderr" >&2 } test_fun &>out " bash -xv test_bash.sh: " test_fun() { echo "to stderr" >&2 } test_fun &>out + test_fun " out: " + echo 'to stderr' to stderr " Fix:
Re: bash -xv issue with stderr
On 11/2/24 1:41 PM, monochro...@linuxinlaws.eu wrote: Bash Version: 5.2 Patch Level: 37 Release Status: release Description: Redirecting stderr to file causes output of bash -xv to be writte to file as well That's where the shell writes -v and -x output. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ OpenPGP_signature.asc Description: OpenPGP digital signature
Re: bash -xv issue with stderr
~ $ bash mb.test.3stderr + echo foo exec 3<&2 BASH_XTRACEFD=3 set -x { echo foo >&2 } 2>&- On Sat, Nov 2, 2024, 19:25 wrote: > Configuration Information [Automatically generated, do not change]: > Machine: aarch64 > OS: darwin24.0.0 > Compiler: clang > Compilation CFLAGS: -DSSH_SOURCE_BASHRC > -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/\ > bash:.' > uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel > Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; > root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 > Machine Type: aarch64-apple-darwin24.0.0 > > Bash Version: 5.2 > Patch Level: 37 > Release Status: release > > Description: > Redirecting stderr to file causes output of bash -xv to be writte > to file as well > > Repeat-By: > > test_bash.sh: > " > test_fun() { > echo "to stderr" >&2 > } > > test_fun &>out > " > bash -xv test_bash.sh: > " > test_fun() { > echo "to stderr" >&2 > } > > test_fun &>out > + test_fun > " > > out: > " > + echo 'to stderr' > to stderr > " > > Fix: > >
Re: degraded error message in case of hash-bang interpreter error
On 11/2/24 8:43 AM, hmms...@kpnplanet.nl wrote: Bash Version: 5.2 Patch Level: 9 Release Status: release Description: If the interpreter after #! is wrong, a non-informative message prints Repeat-By: "unix2dos bashscript" starting with #!/bin/bash ./bashscript bash: ./bashscript: cannot execute: required file not found This was changed a couple of years ago, as the result of https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00051.html -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ OpenPGP_signature.asc Description: OpenPGP digital signature
Re: bash -xv issue with stderr
exec 3<&2 BASH_XTRACEFD=3 set -x { echo foo >&2 } 2>&- replace &- with file to out log the echo On Sat, Nov 2, 2024, 20:37 wrote: > Configuration Information [Automatically generated, do not change]: > Machine: aarch64 > OS: darwin24.0.0 > Compiler: clang > Compilation CFLAGS: -DSSH_SOURCE_BASHRC > -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.' > uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel > Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; > root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 > Machine Type: aarch64-apple-darwin24.0.0 > > Bash Version: 5.2 > Patch Level: 37 > Release Status: release > > Description: > Redirecting stderr to file causes output of bash -xv to be writte > to file as well > > Repeat-By: > > test_bash.sh: > " > test_fun() { > echo "to stderr" >&2 > } > > test_fun &>out > " > bash -xv test_bash.sh: > " > test_fun() { > echo "to stderr" >&2 > } > > test_fun &>out > + test_fun > " > > out: > " > + echo 'to stderr' > to stderr > " > > Fix: > > >
Re: bash -xv issue with stderr
i think .. BASH_XTRACEFD=3 .. alone may also do .. u try .. On Sat, Nov 2, 2024, 20:55 #!microsuxx wrote: > exec 3<&2 > BASH_XTRACEFD=3 > set -x > { > echo foo >&2 > } 2>&- > > replace &- with file to out log the echo > > On Sat, Nov 2, 2024, 20:37 wrote: > >> Configuration Information [Automatically generated, do not change]: >> Machine: aarch64 >> OS: darwin24.0.0 >> Compiler: clang >> Compilation CFLAGS: -DSSH_SOURCE_BASHRC >> -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.' >> uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel >> Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; >> root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 >> Machine Type: aarch64-apple-darwin24.0.0 >> >> Bash Version: 5.2 >> Patch Level: 37 >> Release Status: release >> >> Description: >> Redirecting stderr to file causes output of bash -xv to be writte >> to file as well >> >> Repeat-By: >> >> test_bash.sh: >> " >> test_fun() { >> echo "to stderr" >&2 >> } >> >> test_fun &>out >> " >> bash -xv test_bash.sh: >> " >> test_fun() { >> echo "to stderr" >&2 >> } >> >> test_fun &>out >> + test_fun >> " >> >> out: >> " >> + echo 'to stderr' >> to stderr >> " >> >> Fix: >> >> >>
degraded error message in case of hash-bang interpreter error
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection uname output: Linux lap2.home 6.0.9-300.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 16 17:36:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu Bash Version: 5.2 Patch Level: 9 Release Status: release Description: If the interpreter after #! is wrong, a non-informative message prints Repeat-By: "unix2dos bashscript" starting with #!/bin/bash ./bashscript bash: ./bashscript: cannot execute: required file not found Before version 5.2: ./bashscript bash: ./bashscript: /bin/bash^M: bad interpreter: No such file or directory Fix: Probably some code has to be moved in execute_cmd.c