mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
I/O: Properly handle EIO error (Solaris patch 275-20855453)
This change is pulled from here: https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/275-20855453.patch https://github.com/att/ast/issues/30 George Lijo wrote on 17 Feb 2017: > Here's a reproducible testcase on a Solaris11 host running > ksh93u+(2012-08-01). > $ cat a.sh > #!/bin/sh > > AAA="aaa" > echo 'insert character' > BBB=`echo ${AAA} | sed "s/aaa/bbb/g"` > logger "variable BBB = ${BBB}" > > $ cat t.sh > #!/bin/ksh > > sleep 10 > /bin/ksh ./a.sh > exit 0 > > $ > > $ ./t.sh > > The expected result is: > > Apr 9 12:43:34 lab user: [ID 702911 user.notice] variable BBB = bbb > > because variable "BBB" is supposed to be set to 'bbb' in a.sh. > > But if the parent shell is terminated, the variable is wrongly set. > > user@xxxxx$ telnet lab > ... > $ ./t.sh & <--- Run t.sh in background. > [1] 2067 > $ logout <--- CTRL + D to exit while t.sh is running. > Connection to lab closed by foreign host. > > Again, access the system and check the output: > > user@xxxxx$ telnet lab > ... > $ tail -f /var/adm/messages > : > Apr 9 12:47:47 lab user: [ID 702911 user.notice] variable BBB = > insert character <--- !!! > Apr 9 12:47:47 lab bbb > <--- !!! > > Thus the variable is wrongly set. (The previous echo string was > not cleared.) > > The issue happens because the EIO error during the logout is not > handled properly. src/cmd/ksh93/sh/io.c, src/lib/libast/include/error.h: - Amend the ERROR_PIPE() macro to check for EIO as well as EPIPE and ECONNRESET.
This commit is contained in:
parent
3f38f8a285
commit
7c47ab56fe
2 changed files with 4 additions and 4 deletions
|
@ -64,9 +64,9 @@
|
|||
|
||||
#ifndef ERROR_PIPE
|
||||
#ifdef ECONNRESET
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==ECONNRESET)
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==ECONNRESET||(e)==EIO)
|
||||
#else
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE)
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==EIO)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@
|
|||
#define ERROR_SET 0x0080 /* set context */
|
||||
|
||||
#ifdef ECONNRESET
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==ECONNRESET)
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==ECONNRESET||(e)==EIO)
|
||||
#else
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE)
|
||||
#define ERROR_PIPE(e) ((e)==EPIPE||(e)==EIO)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue