2016-04-26 15:54:31 +00:00
|
|
|
From b31ff7ce0ae4b221b54e329e44d4df1e9b337c40 Mon Sep 17 00:00:00 2001
|
|
|
|
From: David Kaspar [Dee'Kej] <dkaspar@redhat.com>
|
|
|
|
Date: Tue, 26 Apr 2016 16:58:15 +0200
|
|
|
|
Subject: [PATCH] tcsh-6.19.00-tcsh_posix_status-deprecated.patch
|
2015-05-27 08:53:52 +00:00
|
|
|
|
2014-08-27 14:17:54 +00:00
|
|
|
---
|
|
|
|
sh.c | 2 ++
|
|
|
|
sh.h | 1 +
|
|
|
|
sh.proc.c | 2 +-
|
2016-04-26 15:54:31 +00:00
|
|
|
sh.set.c | 16 ++++++++++++++++
|
2014-08-27 14:17:54 +00:00
|
|
|
tc.const.c | 2 ++
|
2016-04-26 15:54:31 +00:00
|
|
|
tests/variables.at | 31 +++++++++++++++++++++++++++++++
|
|
|
|
6 files changed, 53 insertions(+), 1 deletion(-)
|
2014-08-27 14:17:54 +00:00
|
|
|
|
|
|
|
diff --git a/sh.c b/sh.c
|
2015-05-27 08:53:52 +00:00
|
|
|
index b760f04..242556a 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/sh.c
|
|
|
|
+++ b/sh.c
|
2015-05-27 08:53:52 +00:00
|
|
|
@@ -355,6 +355,8 @@ main(int argc, char **argv)
|
2014-08-27 14:17:54 +00:00
|
|
|
anyerror = 1; /* for compatibility */
|
|
|
|
setcopy(STRanyerror, STRNULL, VAR_READWRITE);
|
|
|
|
|
|
|
|
+ tcsh_posix_status = 0;
|
|
|
|
+
|
|
|
|
/* Default history size to 100 */
|
|
|
|
setcopy(STRhistory, str2short("100"), VAR_READWRITE);
|
2015-05-27 08:53:52 +00:00
|
|
|
sethistory(100);
|
2014-08-27 14:17:54 +00:00
|
|
|
diff --git a/sh.h b/sh.h
|
2016-04-26 15:54:31 +00:00
|
|
|
index 608fc99..c0a5f0b 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/sh.h
|
|
|
|
+++ b/sh.h
|
2016-04-26 15:54:31 +00:00
|
|
|
@@ -568,6 +568,7 @@ EXTERN int editing IZERO; /* doing filename expansion and line editing */
|
2014-08-27 14:17:54 +00:00
|
|
|
EXTERN int noediting IZERO; /* initial $term defaulted to noedit */
|
|
|
|
EXTERN int bslash_quote IZERO;/* PWP: tcsh-style quoting? (in sh.c) */
|
|
|
|
EXTERN int anyerror IZERO; /* propagate errors from pipelines/backq */
|
|
|
|
+EXTERN int tcsh_posix_status IZERO; /* negation for anyerror */
|
|
|
|
EXTERN int compat_expr IZERO;/* csh-style expressions? */
|
|
|
|
EXTERN int isoutatty IZERO; /* is SHOUT a tty */
|
|
|
|
EXTERN int isdiagatty IZERO;/* is SHDIAG a tty */
|
|
|
|
diff --git a/sh.proc.c b/sh.proc.c
|
2016-04-26 15:54:31 +00:00
|
|
|
index ce37c4d..2ffdee0 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/sh.proc.c
|
|
|
|
+++ b/sh.proc.c
|
2016-04-26 15:54:31 +00:00
|
|
|
@@ -561,7 +561,7 @@ pjwait(struct process *pp)
|
2014-08-27 14:17:54 +00:00
|
|
|
do {
|
|
|
|
/* In case of pipelines only the result of the last
|
|
|
|
* command should be taken in account */
|
|
|
|
- if (!anyerror && !(fp->p_flags & PBRACE)
|
|
|
|
+ if ((!anyerror || tcsh_posix_status) && !(fp->p_flags & PBRACE)
|
|
|
|
&& ((fp->p_flags & PPOU) || (fp->p_flags & PBACKQ)))
|
|
|
|
continue;
|
|
|
|
if (fp->p_reason)
|
|
|
|
diff --git a/sh.set.c b/sh.set.c
|
2016-04-26 15:54:31 +00:00
|
|
|
index 7498169..090129c 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/sh.set.c
|
|
|
|
+++ b/sh.set.c
|
2016-04-26 15:54:31 +00:00
|
|
|
@@ -41,6 +41,8 @@ RCSID("$tcsh: sh.set.c,v 3.86 2014/10/28 18:40:46 christos Exp $")
|
|
|
|
#include <langinfo.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#include <stdio.h>
|
|
|
|
+
|
|
|
|
extern int GotTermCaps;
|
|
|
|
int numeof = 0;
|
|
|
|
|
|
|
|
@@ -109,6 +111,18 @@ update_vars(Char *vp)
|
2014-08-27 14:17:54 +00:00
|
|
|
else if (eq(vp, STRanyerror)) {
|
|
|
|
anyerror = 1;
|
|
|
|
}
|
|
|
|
+ else if (eq(vp, STRtcsh_posix_status)) {
|
2016-04-26 15:54:31 +00:00
|
|
|
+ static error_msg_printed = 0;
|
|
|
|
+
|
|
|
|
+ if (error_msg_printed == 0) {
|
|
|
|
+ fprintf(stderr, "tcsh: Warning: 'tcsh_posix_status' variable is"
|
|
|
|
+ " deprecated and will be removed in Fedora 25\n"
|
|
|
|
+ "tcsh: Note: Use 'anyerror' variable instead\n");
|
|
|
|
+ error_msg_printed = 1;
|
|
|
|
+ }
|
|
|
|
+
|
2014-08-27 14:17:54 +00:00
|
|
|
+ tcsh_posix_status = 1;
|
|
|
|
+ }
|
|
|
|
else if (eq(vp, STRsymlinks)) {
|
|
|
|
Char *pn = varval(vp);
|
|
|
|
|
2016-04-26 15:54:31 +00:00
|
|
|
@@ -774,6 +788,8 @@ unset(Char **v, struct command *c)
|
2014-08-27 14:17:54 +00:00
|
|
|
loginsh = 0;
|
|
|
|
if (adrof(STRanyerror) == 0)
|
|
|
|
anyerror = 0;
|
|
|
|
+ if (adrof(STRtcsh_posix_status) == 0)
|
|
|
|
+ tcsh_posix_status = 0;
|
|
|
|
if (adrof(STRwordchars) == 0)
|
|
|
|
word_chars = STR_WORD_CHARS;
|
|
|
|
if (adrof(STRedit) == 0)
|
|
|
|
diff --git a/tc.const.c b/tc.const.c
|
2016-04-26 15:54:31 +00:00
|
|
|
index e71d2ae..f383714 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/tc.const.c
|
|
|
|
+++ b/tc.const.c
|
|
|
|
@@ -44,6 +44,8 @@ Char STRrootdefautologout[] = { '1', '5', '\0' };
|
|
|
|
Char STRautomatic[] = { 'a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c',
|
|
|
|
'\0' };
|
|
|
|
Char STRanyerror[] = { 'a', 'n', 'y', 'e', 'r', 'r', 'o', 'r', '\0' };
|
|
|
|
+Char STRtcsh_posix_status[] = {'t', 'c', 's', 'h', '_', 'p', 'o', 's', 'i', 'x',
|
|
|
|
+ '_', 's', 't', 'a', 't', 'u', 's', '\0' };
|
|
|
|
Char STRhangup[] = { 'h', 'a', 'n', 'g', 'u', 'p', '\0' };
|
|
|
|
Char STRaout[] = { 'a', '.', 'o', 'u', 't', '\0' };
|
|
|
|
Char STRtty[] = { 't', 't', 'y', '\0' };
|
|
|
|
diff --git a/tests/variables.at b/tests/variables.at
|
2016-04-26 15:54:31 +00:00
|
|
|
index fabe7ab..9b2376e 100644
|
2014-08-27 14:17:54 +00:00
|
|
|
--- a/tests/variables.at
|
|
|
|
+++ b/tests/variables.at
|
2016-04-26 15:54:31 +00:00
|
|
|
@@ -970,6 +970,37 @@ AT_CHECK([tcsh -f -c 'echo $?tcsh'], ,
|
2014-08-27 14:17:54 +00:00
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
+AT_SETUP([$ tcsh_posix_status])
|
|
|
|
+
|
|
|
|
+AT_DATA([exit_status.csh],
|
|
|
|
+[[echo $?tcsh_posix_status
|
|
|
|
+false | true ; echo $?
|
|
|
|
+set tcsh_posix_status = 1 ; echo $?tcsh_posix_status $tcsh_posix_status
|
|
|
|
+false | true ; echo $?
|
|
|
|
+set tcsh_posix_status = 0 ; echo $?tcsh_posix_status $tcsh_posix_status
|
|
|
|
+# Note it is still set!
|
|
|
|
+false | true ; echo $?
|
|
|
|
+unset tcsh_posix_status ; echo $?tcsh_posix_status
|
|
|
|
+false | true ; echo $?
|
|
|
|
+]])
|
|
|
|
+
|
|
|
|
+AT_CHECK([tcsh -f exit_status.csh],,
|
|
|
|
+[0
|
|
|
|
+1
|
|
|
|
+1 1
|
|
|
|
+0
|
|
|
|
+1 0
|
|
|
|
+0
|
|
|
|
+0
|
|
|
|
+1
|
2016-04-26 15:54:31 +00:00
|
|
|
+],
|
|
|
|
+[tcsh: Warning: 'tcsh_posix_status' variable is deprecated and will be removed in Fedora 25
|
|
|
|
+tcsh: Note: Use 'anyerror' variable instead
|
2014-08-27 14:17:54 +00:00
|
|
|
+])
|
|
|
|
+
|
|
|
|
+AT_CLEANUP
|
|
|
|
+
|
|
|
|
+
|
|
|
|
AT_SETUP([$ term])
|
|
|
|
|
|
|
|
AT_DATA([term.csh],
|
|
|
|
--
|
2016-04-26 15:54:31 +00:00
|
|
|
2.5.5
|
2014-08-27 14:17:54 +00:00
|
|
|
|