Bug 644128 - problem with here-doc in function called from here-doc
Summary: problem with here-doc in function called from here-doc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh
Version: 5.5
Hardware: All
OS: Linux
low
high
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 644362
TreeView+ depends on / blocked
 
Reported: 2010-10-18 23:58 UTC by Herbert van den Bergh
Modified: 2012-02-21 05:50 UTC (History)
3 users (show)

Fixed In Version: ksh-20100621-1.el5
Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
If a here document (heredoc — specifies a string literal in command line shells) was combined with an auto-loaded function, interference with the here document processing could occur causing output to be truncated to 8 kB. This update improves the here document processing logic and auto-loaded functions no longer have a negative side effect on here documents.
Clone Of:
: 644362 (view as bug list)
Environment:
Last Closed: 2012-02-21 05:50:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0159 0 normal SHIPPED_LIVE ksh bug fix and enhancement update 2012-02-20 14:53:47 UTC

Description Herbert van den Bergh 2010-10-18 23:58:05 UTC
Description of problem:

(also submitted to ast-developers mail list, so this may look familiar)

There's a bug in ksh-2010-05-27 and earlier where the here document is getting 
truncated.  The main script has a 10KB here document with a couple 
command substitutions.  These command substitutions call a function 
which is auto-loaded via FPATH.  The function has a here document 
itself.  It appears that the here document processing in the function 
interferes with the here document of the script, causing the output to 
be truncated to 8KB.  

Version-Release number of selected component (if applicable):
ksh-2010-05-27 and earlier

How reproducible:
Every time.

Steps to Reproduce:


I include 2 test scripts.  The first small one is 
stored in the subdirectory ./functions/ .  Run it with:

$ ksh t1 > output

The output should be 10240 bytes, but is only 8192 bytes.

::::::::::::::
functions/t2
::::::::::::::
function t2
{
cat <<EOF | sed 's/1234567890/qwertyuiopasdfghj/'
${1}
EOF
}
::::::::::::::
t1
::::::::::::::
FPATH=`pwd`/functions
typeset -uf t2
cat <<EOF
1 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111 1

2 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222222
222222222222222222222222222222222222222222222222222222222222 2

3 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333333
333333333333333333333333333333333333333333333333333333333333 3

4 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444 4

5 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555555555555555 5

6 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666666
666666666666666666666666666666666666666666666666666666666666 6

7 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777777777777777777777 7

8 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888 8

9 34567890 $(t2 1234567890 ) 0123456789012345678901234567890123
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999 9

10 4567890 $(t2 1234567890 ) 0123456789012345678901234567890123
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
101010101010101010101010101010101010101010101010101010101010103
1010101010101010101010101010101010101010101010101010101010 END

EOF
::::::::::::::

Comment 1 Herbert van den Bergh 2010-10-19 00:00:01 UTC
Got a reply from David Korn saying the bug fix is in ksh93u which is available on the beta website,
	http://www.research.att.com/sw/download/beta/

Please update ksh to ksh93u.

Comment 2 Michal Hlavinka 2010-10-19 14:25:36 UTC
Well, the problem is there is no ksh93u version yet, there is only ksh93u- beta version and we probably won't update ksh to just beta. I think we can handle this better as update to  2010-06-21 (latest stable bugfix release) and backport the fix.

Comment 5 RHEL Program Management 2010-10-19 14:47:19 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2011-01-11 20:21:07 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2011-01-11 22:44:59 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 9 Martin Prpič 2011-03-16 15:58:01 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
If a here document (heredoc — specifies a string literal in command line shells) was combined with an auto-loaded function, interference with the here document processing could occur causing output to be truncated to 8 kB. This update improves the here document processing logic and auto-loaded functions no longer have a negative side effect on here documents.

Comment 10 RHEL Program Management 2011-05-31 13:19:53 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 12 errata-xmlrpc 2012-02-21 05:50:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0159.html


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