1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Revert <> redir FD except in posix mode (re: eeee77ed, 60516872)

eeee77ed implemented a POSIX compliance fix that caused a potential
incompatibility with existing ksh scripts; it made the (rarely
used) read/write redirection operator, <>, default to file
descriptor 0 (standard input) as POSIX specified, instead of 1
(standard output) which is traditional ksh93 behaviour. So ksh
scripts needed to change all <> to 1<> to override the new default.

This commit reverts that change, except in the new posix mode.

src/cmd/ksh93/sh/lex.c:
- Make FD for <> default to 0 in POSIX mode, 1 otherwise.

src/cmd/ksh93/tests/io.sh:
- Revert <> regression test changes from 60516872; we no longer
  need 1<> instead of <> in ksh code.
This commit is contained in:
Martijn Dekker 2020-09-01 08:36:28 +01:00
parent fd977388a2
commit c607c48c84
4 changed files with 10 additions and 5 deletions

View file

@ -3423,7 +3423,8 @@ otherwise, the file is created.
Open file
.I word\^
for reading and writing
as standard input.
as standard output.
If the \fBposix\fR option is active, it defaults to standard input instead.
.TP
.BI <>; word
The same as
@ -7040,6 +7041,7 @@ to fail or zero if no command has failed.
Enable POSIX standard compatibility mode. This option
is on by default if ksh is invoked as \fBsh\fR. It
causes file descriptors > 2 to be left open when invoking another program,
makes the \fB<>\fR redirection operator default to standard input,
enables octal numbers in \fBlet\fR shell arithmetic (see \fBletoctal\fR), and
disables the \fB&>\fR redirection shorthand.
.TP 8