This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mksh 49-1 no longer handles Windows line endings


Hi,

The latest version of mksh no longer handles Windows line endings in
ksh scripts when in a text-mode file system.

To reproduce:

$ mount -o text c:/textmode /textmode
(or use an existing text-mode mount)

$ echo -e "\necho \"test\"\n" > /textmode/test.ksh
$ ksh /textmode/test.ksh
: not foundsh[1]:
test
: not foundsh[3]:

$ d2u /textmode/test.ksh
dos2unix: converting file /textmode/test.ksh to Unix format...

$ ksh /textmode/test.ksh
test

Reverting to 48b-1 and retesting gives the correct behaviour
regardless of whether it has dos or unix line endings.


I have investigated the differences in the source code of the two
versions and found that 49-1 added O_BINARY flag to all of the open
calls. I took these flags out and was able to confirm that it fixes
the issue. I have attached two patches that do the same thing. One
removes the flag, the other commented out the #ifdef O_BINARY line in
the header so that #define O_BINARY 0 is always defined. These aren't
intended as actual patches to mksh, merely examples of how to fix the
issue.

The mksh changelog (https://www.mirbsd.org/mksh.htm#clog), indicates
why this change was made:
[tg] Add O_BINARY to all open(2) calls for OS/2 kLIBC support

The website also indicates that "No workarounds for .exe suffixes or
other platform-specific quirks have been or will be added." So I doubt
I could get this fixed upstream. Could the maintainer please take a
look at this?

Cheers,

Ryan Dortmans

Attachment: mksh491_fix1.patch
Description: Binary data

Attachment: mksh491_fix2.patch
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]