Bash-5.2-rc2 available

2022-07-25 Thread Chet Ramey
The second release candidate of bash-5.2 is now available with the URLs

ftp://ftp.cwru.edu/pub/bash/bash-5.2-rc2.tar.gz
https://ftp.gnu.org/pub/gnu/bash/bash-5.2-rc2.tar.gz

and from the bash-5.2-testing branch in the bash git repository
(http://git.savannah.gnu.org/cgit/bash.git/log/?h=bash-5.2-testing).
You can use

git clone --branch bash-5.2-testing git://git.savannah.gnu.org/bash.git

to clone the testing branch.

The CWRU FTP site works best if your client supports Extended Passive
(EPSV) mode.

This tar file includes the formatted documentation (you should be able to
generate updated versions yourself).

This release fixes several outstanding bugs in bash-5.1 and introduces
a number of new features. There are significant new features of note:

* The parser now calls itself recursively to parse command substitutions,
  and reconstitutes the text from the parsed command. This allows better
  syntax checking and catches errors much earlier;

* Bash-5.2 improves associative array subscript parsing with the goal of
  eliminating double evaluation for shell constructs such as arithmetic
  expansion and conditional commands, the `unset' builtin, and arguments
  to other builtin commands as long as assoc_expand_once is set;

* Associative arrays now allow assignment to and unsetting `@' and `*' keys,
  and the `unset' builtin treats `@' and `*' keys differently to allow this;

* There is an alternate array implementation, selectable at configuration
  time, that optimizes access speed over memory use (but can use considerably
  more memory for large sparse arrays);

* There is a configuration option to compile $"..." string translation out of
  the shell, and a runtime shell option to inhibit any additional expansion
  of translated strings;

* The new `varredir_close' shell option causes bash to automatically close
  file descriptors opened with {var}&word) to be printed
   incorrectly (>&word) if no file descriptor was supplied.

2. Changes to Readline

a. Fixed a bug that caused rl_eof_found to be set prematurely while reading a
   multi-character key sequence in callback mode.

3. New Features in Bash

a. In posix mode, the `printf' builtin checks for the `L' length modifier and
   uses long double for floating point conversion specifiers if it's present,
   double otherwise.

b. The `globbing' completion code now takes the `globstar' option into account.

c. `suspend -f' now forces the shell to suspend even if job control is not
   currently enabled.

4. New Features in Readline

--
This document details the changes between this version, bash-5.2-beta, and
the previous version, bash-5.2-alpha.

1. Changes to Bash

a. Fixed a problem with command-oriented history and multi-line commands that
   caused embedded blank lines to be run together.

b. Changed the way `&' is quoted when performing pattern substitution and
   `patsub_replacement' is enabled.

c. Fixed some integer overflows when expanding strings or reading the output
   of command substitution larger than 2GB.

d. `wait -p' without the `-n' option now does something useful if there are no
   jobs.

e. Fixed an issue with read timeouts in posix mode.

f. Changed here-document processing to process $'...' and $"..." only when they
   appear in the WORD portion of ${PARAM OP WORD} in the here-document body
   and the body is being expanded.

g. Changed alias expansion in command substitution to be posix-conformant
   (performed while initially parsing the command substitution) when in posix
   mode.

h. Bash optimizes away more forks in subshells.

i. Here-document construction now performs quote removal on the here-document
   delimiter only if it's marked as quoted, which prevents quote characters in
   command substitutions from being removed.

j. Prompt string expansion now gives invisible characters in the expansion of
   the \w, \W, and \s escape sequences a visible representation to avoid
   problems with redisplay.

k. Fixed a problem with SIGINT during the execution of a command bound with
   `bind -x' affecting the saved terminal settings.

l. Fixed an inconsistency with how $@ expands in a construct like ${@:+set}
   or ${array[@]:+set} in the presence of null positional parameters or
   array elements.

2. Changes to Readline

a. Prevent some display problems when running a command as the result of a
   trap or one bound using `bind -x' and the command generates output.

b. Fixed an issue with multi-line prompt strings that have one or more
   invisible characters at the end of a physical line.

c. Fixed an issue that caused a history line's undo list to be cleared when
   it should not have been.

3. New Features in Bash

a. There is a new bindable readline command name: `vi-edit-and-execute-command'.

4. New Features in Readline

a. Two new bindable string variables: active-region-start-color and
   active-region-end-color. The first sets the color used to 

Strange floating error with function in .bashrc

2022-07-25 Thread oxyd76
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   
  -fstack-clash-protection -fcf-protection -flto 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS 
uname output: Linux dell-lnx 4.19.251-1-MANJARO #1 SMP Thu Jul 7 16:57:35 UTC 
2022 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:

Hi everyone!
I create function for interact with termbin.com (pastebin like) service 
in my .bashrc:

termbin-clip() {
nc termbin.com  | xclip -sel clip
}

Example usage:

$ cat ~/.bashrc|termbin-clip

This example must be send content of .bashrc to the terrmbin.com and 
copy result url to the clipboard
but... MAY does'nt work. This is a "floating" error :(

For testing purpose i run bash without .basrc & .profile:

$ env -i bash --norc --noprofile
$ termbin-clip() { nc termbin.com  | tee; }
$ cat ~/.bashrc | termbin-clip

and it works!
As a result of the study, it turned out that there was a "source" line 
in .bashrc 
that led to a non-existent file:

#  Vagrant command completion (start)
. 
/opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/contrib/bash/completion.sh
#   Vagrant command completion (end)

I commented out the line, the function worked. After I registered the 
actual 
path to the file (2.2.19 version of vagrant) the function also 
continued to work.

Repeat-By:

Add to ~/.bashrc:

. /path/to/non/existent/file
termbin.clip() {
nc termbin.com  | tee
}

For testing:

$ echo "FooBar"|termbin-clip

and result link MAY does not get.
For get link you must remove or comment bad "source" line
from your .bashrc and repeat test.

--- BR Vadim "Oxyd" Priluzkiy



Re: Strange floating error with function in .bashrc

2022-07-25 Thread Emanuele Torre
I don't quite understand what you are saying or what issue you are
describing.

> Repeat-By:
>
> Add to ~/.bashrc:
>
> . /path/to/non/existent/file
> termbin.clip() {
> nc termbin.com  | tee
> }
>
> For testing:
>
> $ echo "FooBar"|termbin-clip

If you are wondering why `echo "FooBar"|termbin-clip' doesn't work in
the last example; it may be just because you typoed `termbin.clip' in
the function definition.