helpThe GNU Bourne-Again SHell - Support: sr #110485, Variable substitution into...

 
 

sr #110485: Variable substitution into multiline JSON text fails after 4 variables

Submitted by:  None
Submitted on:  Wed 05 May 2021 04:15:35 PM UTC
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Works For Me
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Tue 11 May 2021 01:25:18 PM UTC, comment #1: 

I can't reproduce this on macOS or RHEL.

Chet Ramey <chet>
Project Administrator
Wed 05 May 2021 04:15:35 PM UTC, original submission:  

The following used to work:

```
json=$(cat <<-EOF
{
    "UserPoolId": "$user_pool",
    "Username": "$email",
    "UserAttributes": [
        {
            "Name": "name",
            "Value": "$name"
        },
        {
            "Name": "custom:default_state",
            "Value": "$default_state"
        },
        {
            "Name": "custom:default_jurisdiction",
            "Value": "$default_jurisdiction"
        },
        {
            "Name": "custom:app_roles",
            "Value": "$app_roles"
        },
        {
            "Name": "custom:app_organisations",
            "Value": "$app_organisations"
        },
        {
            "Name": "email",
            "Value": "$email"
        },
        {
            "Name": "email_verified",
            "Value": "true"
        },
        {
            "Name": "custom:default_case_type",
            "Value": "$default_case_type"
        }
    ],
    "MessageAction": "SUPPRESS"
}
EOF
)
```

But no longer works in:
```
GNU bash, version 5.1.4(1)-release (x86_64-apple-darwin20.2.0)
Copyright (C) 2020 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.
```

Some other helpful info:
1. Stripping out all of the JSON fluff and leaving only the variables and the variables are all interpolated
2. Reducing the variable count to 4 variables and the interpolation works with the remaining JSON fluff.

So some combination of {} and variables seems to have happened in latest bash.

I'm not 100% sure what version of bash I was using where this previously worked.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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 dwayne (Original Submitter)
  •  

    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-05-11 chet StatusNone => Works For Me
    2021-05-05 dwayne Carbon-Copy- => Added dwayne

    Back to the top


    Powered by Savane 3.9