Re: here strings fold newlines on MacOS

2021-01-31 Thread Rich Lafferty
Ah, yep — sorry for the false positive. I *have* 5.1.0 installed (and bashbug 
picked that up!) but the context in which I encountered the bug was indeed 
Apple’s ancient version. I could’ve sworn I tested it in both, but clearly 
messed that up - verified it’s fixed in 5.1.0.

  -Rich

On Jan 31, 2021, 1:35 PM -0500, Chet Ramey , wrote:
> On 1/30/21 5:44 PM, Rich Lafferty wrote:
>
> > Bash Version: 5.1
> > Patch Level: 0
> > Release Status: release
> >
> > Description:
> > Here strings ('<<<') fold newlines into spaces on MacOS, but not on Linux,
> > leading to incompatibilites in bash code expected to work the same on both
> > platforms.
>
> This was fixed quite a while back, but still after Apple froze its version
> of bash at 3.2.57. Maybe you should file a bug report with Apple.
> (Just kidding, they don't care.)
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/


Re: here strings fold newlines on MacOS

2021-01-31 Thread Chet Ramey

On 1/30/21 5:44 PM, Rich Lafferty wrote:


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

Description:
Here strings ('<<<') fold newlines into spaces on MacOS, but not on Linux,
leading to incompatibilites in bash code expected to work the same on both
platforms.


This was fixed quite a while back, but still after Apple froze its version
of bash at 3.2.57. Maybe you should file a bug report with Apple.
(Just kidding, they don't care.)


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



Re: here strings fold newlines on MacOS

2021-01-30 Thread Lawrence Velázquez
> On Jan 30, 2021, at 9:28 PM, ""   
> wrote:
> 
> Are you certain that you're not testing /bin/bash (version 3.2.57) in the 
> case of macOS? I ask because the bug you describe is said to have been 
> addressed by the release of 4.4-beta [1].
> 
> z.  Bash no longer splits the expansion of here-strings, as the
>documentation has always said.


I can reproduce the OP's result with the system bash but not with 5.1
or 5.1 patch 4.


% /bin/bash --version | head -n 1
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
% /bin/bash -c 'od -bc <<< $(echo -e "foo\nbar")'
000   146 157 157 040 142 141 162 012
   f   o   o   b   a   r  \n
010


% work/destroot/opt/local/bin/bash --version | head -n 1
GNU bash, version 5.1.0(1)-release (x86_64-apple-darwin18.7.0)
% work/destroot/opt/local/bin/bash -c 'od -bc <<< $(echo -e "foo\nbar")'
000   146 157 157 012 142 141 162 012
   f   o   o  \n   b   a   r  \n
010


% bash --version | head -n 1
GNU bash, version 5.1.4(1)-release (x86_64-apple-darwin18.7.0)
% bash -c 'od -bc <<< $(echo -e "foo\nbar")'
000   146 157 157 012 142 141 162 012
   f   o   o  \n   b   a   r  \n
010


--
vq


Re: here strings fold newlines on MacOS

2021-01-30 Thread

On 30/01/2021 22:44, Rich Lafferty wrote:

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin18.7.0
Compiler: clang
Compilation CFLAGS: -DSSH_SOURCE_BASHRC
uname output: Darwin flounder.home.mati.ca 18.7.0 Darwin Kernel Version 18.7.0: 
Tue Nov 10 00:07:31 PST 2020; root:xnu-4903.278.51~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin18.7.0

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

Description:
Here strings ('<<<') fold newlines into spaces on MacOS, but not on Linux,
leading to incompatibilites in bash code expected to work the same on both
platforms.

Repeat-By:

On Linux:

$ od -bc <<< $(echo -e "foo\nbar")
000 146 157 157 012 142 141 162 012
  f o o \n b a r \n
010

On MacOS:

$ od -bc <<< $(echo -e "foo\nbar")
000 146 157 157 040 142 141 162 012
  f o o b a r \n
010


Are you certain that you're not testing /bin/bash (version 3.2.57) in 
the case of macOS? I ask because the bug you describe is said to have 
been addressed by the release of 4.4-beta [1].


z.  Bash no longer splits the expansion of here-strings, as the
documentation has always said.

You can work around it by double quoting the command substitution.

[1] https://tiswww.case.edu/php/chet/bash/CHANGES

--
Kerin Millar




here strings fold newlines on MacOS

2021-01-30 Thread Rich Lafferty
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin18.7.0
Compiler: clang
Compilation CFLAGS: -DSSH_SOURCE_BASHRC
uname output: Darwin flounder.home.mati.ca 18.7.0 Darwin Kernel Version 18.7.0: 
Tue Nov 10 00:07:31 PST 2020; root:xnu-4903.278.51~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin18.7.0

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

Description:
Here strings ('<<<') fold newlines into spaces on MacOS, but not on Linux,
leading to incompatibilites in bash code expected to work the same on both
platforms.

Repeat-By:

On Linux:

$ od -bc <<< $(echo -e "foo\nbar")
000 146 157 157 012 142 141 162 012
 f o o \n b a r \n
010

On MacOS:

$ od -bc <<< $(echo -e "foo\nbar")
000 146 157 157 040 142 141 162 012
 f o o b a r \n
010