Re: Another redisplay issue in single-byte locales

2024-11-06 Thread Chet Ramey

On 8/13/24 10:23 PM, Grisha Levit wrote:

In a single-byte locale, if the prompt is wider than the screen width
and contains invisible characters on the last line, and the input line
is also wider than the screen width, redisplay gets messed up:


Thanks for the report. The code that handled this only handled the case
where the invisible characters are on the first line of the prompt.


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


[bug #66412] Missing space in documentation

2024-11-06 Thread anonymous
URL:
  

 Summary: Missing space in documentation
   Group: The GNU Bourne-Again SHell
   Submitter: None
   Submitted: Wed 06 Nov 2024 09:23:39 AM UTC
Category: None
Severity: 3 - Normal
  Item Group: None
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any


___

Follow-up Comments:


---
Date: Wed 06 Nov 2024 09:23:39 AM UTC By: Anonymous
There's a tiny mistake in the "Pattern Matching" section of the documentation:
A space is missing in "Theextglob option changes the behavior of the parser"
(note: "extglob" is set in bold).

The mistake is located in line 3987 of the man page (bash.1), but it's also
present in all other formats (HTML, PDF, PS).







___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/


signature.asc
Description: PGP signature


Re: This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo ${#foo[@]}

2024-11-06 Thread Greg Wooledge
On Thu, Nov 07, 2024 at 02:38:05 +, David Linden wrote:
> Description:
>   This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo 
> ${#foo[@]}
>   How am I supposed to determine that a declared associative array is 
> empty?

The easiest way would be to ensure that the array variable is actually
created:

set -u; declare -A foo=(); echo "${#foo[@]}"

Without the =() part, declare -A only creates a placeholder, which will
assign the -A flag to a future variable named foo, if one is ever created.
You need an assignment to create the variable.



This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo ${#foo[@]}

2024-11-06 Thread David Linden
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -DSYSLOG_HISTORY -O2 -g -pipe 
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 
-fexceptions -fstack-protector-strong -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
-Wno-parentheses -Wno-format-security
uname output: Linux engdev2 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Wed Sep 11 
18:02:00 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.4
Patch Level: 20
Release Status: release

Description:
This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo 
${#foo[@]}
How am I supposed to determine that a declared associative array is 
empty?
Or even use it in a conditional even one where the value won't be 
evaluated?

Repeat-By:

Bash 4.2:

(21:10)$ bash --version; bash -c 'set -u; declare -A foo; echo 
${#foo[@]}; echo $((0 && ${#foo[@]}))'
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute 
it.
There is NO WARRANTY, to the extent permitted by law.
>>> 0
>>> 0

Bash 4.4:

(21:14)$ bash --version; bash -c 'set -u; declare -A foo; echo 
${#foo[@]}'
GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute 
it.
There is NO WARRANTY, to the extent permitted by law.
>>> bash: foo: unbound variable
(21:14)$ bash --version; bash -c 'set -u; declare -A foo; echo 
$((0 && ${#foo[@]}))'
GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute 
it.
There is NO WARRANTY, to the extent permitted by law.
>>> bash: foo: unbound variable

Perhaps related, ${#foo[@]:-0} is now considered a bad substitution; in 4.2 it 
was OK.



RE: [EXTERNAL] - Re: This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo ${#foo[@]}

2024-11-06 Thread David Linden
Thanks, and for the quick reply.

Language lawyers...

I'm curious what motivated the change.  Naively it seems creating a placeholder 
for a potential future array keeping track of attributes is more work than just 
creating an empty array.  The change is "surprising" to a user, at least this 
user.

-Original Message-
From: Greg Wooledge  
Sent: Wednesday, November 6, 2024 10:26 PM
To: David Linden 
Cc: bug-bash@gnu.org
Subject: [EXTERNAL] - Re: This errors in 4.4, did not in 4.2: set -u; declare 
-A foo; echo ${#foo[@]}

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you feel that the email is suspicious, please report it using 
PhishAlarm.


On Thu, Nov 07, 2024 at 02:38:05 +, David Linden wrote:
> Description:
>   This errors in 4.4, did not in 4.2: set -u; declare -A foo; echo 
> ${#foo[@]}
>   How am I supposed to determine that a declared associative array is 
> empty?

The easiest way would be to ensure that the array variable is actually
created:

set -u; declare -A foo=(); echo "${#foo[@]}"

Without the =() part, declare -A only creates a placeholder, which will assign 
the -A flag to a future variable named foo, if one is ever created.
You need an assignment to create the variable.