Bug 696742 - Terminating whitespace significant in "here" document marker
Summary: Terminating whitespace significant in "here" document marker
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: bash
Version: 5.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Roman Rakus
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-14 18:40 UTC by David Tonhofer
Modified: 2014-01-13 00:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-15 13:08:22 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description David Tonhofer 2011-04-14 18:40:02 UTC
Description of problem:

Whitespace is significant in a "here" document marker.

For example:

cat >> test.txt << HERE
   foo barr baz
HERE

would work perfectly if HERE has no whitespace at the end, but

cat >> test.txt << HERE
   foo barr baz
HERE 

with the last string being actually "HERE " would fail hard for nonobvious reasons.

--> Bash should trim the line before comparing it to the here "here" tag.

Version-Release number of selected component (if applicable):

bash-3.2-24.el5

How reproducible:

Always

Comment 1 Roman Rakus 2011-04-15 13:08:22 UTC
(In reply to comment #0)
> Description of problem:
> 
> Whitespace is significant in a "here" document marker.
> 
> For example:
> 
> cat >> test.txt << HERE
>    foo barr baz
> HERE
> 
> would work perfectly if HERE has no whitespace at the end, but
> 
> cat >> test.txt << HERE
>    foo barr baz
> HERE 
> 
> with the last string being actually "HERE " would fail hard for nonobvious
> reasons.
> 
> --> Bash should trim the line before comparing it to the here "here" tag.
Should not! See posix: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_07_04
> 
> Version-Release number of selected component (if applicable):
> 
> bash-3.2-24.el5
> 
> How reproducible:
> 
> Always


Note You need to log in before you can comment on or make changes to this bug.