[comp.unix.shell] Bug in ksh 88[df] "print -u2" and/or "read" statement?

mavanamm@pb2esac.UUCP (Marnix van Ammers) (06/18/91)

This problem may exist in ksh version E as well, but for sure it's
in ksh versions D and F.  The trouble is that the ksh will replace a
character with the return character '\015' in the middle of some
text I'm trying to send to standard error output.  The following
script illustrates the problem:

################################# Start of script ###########################
print -u2  "I need to ask you a few questions."
print -u2  "Have you already filtered the data into a file (y/n) ? \c"
read       Answer
print -u2  "Before proceding, please enter file type [hex/octal/binary]: \c"
read       FileType
################################# End of script #############################

The last print statement has the 'l' in "please" changed to a return
character so that the resulting screen looks something like:
-------------------------------------------------------
I need to ask you a few questions.
Have you already filtered the data into a file (y/n) ?
ease enter file type [hex/octal/binary]:
-------------------------------------------------------

I have duplicated this on a 3B4000 and on a 3B15 running SYSV,
release 3.  I have the same trouble even with my "ENV" variable
unset and starting up a fresh ksh.

With trial and error I have found that the trouble is affected by
the COLUMN variable.  I have the problem with no COLUMN variable set
or with COLUMN set to 80 or less.  Ksh's behavior is similar to what
happens when you are on the command line editing a line longer than
COLUMNS characters and you get to the right edge of the screen (in
vi mode anyway).  You have to be "print"ing with "-u2" and you have
to do read's for this bug to show.  If you put almost any command
prior to the last read, the trouble will clear.  Simple deleting the
last read will also get rid of the trouble.

Is this a known bug?  Can other's duplicate this as well?

Thanks for any information.

Marnix A. van Ammers
Pacific Bell ESAC
415-645-5196