helpThe GNU Bourne-Again SHell - Support: sr #110538, Consecutive 0x01 bytes lost during...


sr #110538: Consecutive 0x01 bytes lost during expansion to local array variable

Submitter:  None
Submitted:  Sat 11 Sep 2021 12:30:37 AM UTC
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Sat 18 Sep 2021 09:14:00 PM UTC, comment #2: 

There is a fix in the devel branch tagged for bash-5.2.

Chet Ramey <chet>
Project Administrator
Wed 15 Sep 2021 08:55:30 PM UTC, comment #1: 

Yes, this is a problem with this form of compound assignment, since the assignment appears as an argument to a builtin command and undergoes another `round' of expansion. This ends up removing the 0x01 characters bash uses for internal quoting.

An easy workaround, while I look at the issue, is to use

local -a foo
foo=( "${var[@]}" )

Chet Ramey <chet>
Project Administrator
Sat 11 Sep 2021 12:30:37 AM UTC, original submission:


print_value() {
    local -a foo=("${var[@]}");
    echo -n "$foo" | xxd -p


Expected output: 010101010101

Actual output: 010101

$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>

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



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-18 chet StatusIn Progress Done
    2021-09-15 chet StatusNone In Progress

    Back to the top

    Powered by Savane 3.9