Public bug reported:

Here documents from the command line with tabs are not handled
correctly.  Here is a transcript showing the problem - there is a tab in
front of "This is indented" in the file:

dzu@zarniwoop:~$ cat tab-test
#!/bin/bash

cat <<STOP
This is unindented
        This is indented
STOP
dzu@zarniwoop:~$ bash tab-test
This is unindented
        This is indented
dzu@zarniwoop:~$ echo "Now using mouse to copy&paste here-document"
Now using mouse to copy&paste here-document
dzu@zarniwoop:~$ cat <<STOP
> This is unindented
> This is indented
> STOP
This is unindented
This is indented
dzu@zarniwoop:~$ 

Dash handles this correctly:

dzu@zarniwoop:~$ dash
$ dash tab-test
This is unindented
        This is indented
$ echo "Now using mouse to copy&paste here-document"
Now using mouse to copy&paste here-document
$ cat <<STOP
This is unindented
        This is indented
STOP
> > > This is unindented
        This is indented
$ 

The prompts in the dash output are suspicious but redirecting the output
into a file yields correct output.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: bash 4.4.18-2ubuntu1.2
ProcVersionSignature: Ubuntu 4.18.0-25.26~18.04.1-generic 4.18.20
Uname: Linux 4.18.0-25-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
CurrentDesktop: GNOME
Date: Fri Jul 19 11:45:27 2019
InstallationDate: Installed on 2019-05-28 (51 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: bash
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1837202

Title:
  leading tabs in here-documents are always stripped even when they
  should not

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1837202/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to