tcsh/tcsh-6.19.00-031-always-send-prusage-to-stdout.patch
David Kaspar [Dee'Kej] 4aac049647 tcsh-6.19.00-031-always-send-prusage-to-stdout.patch added
This patch should fix regression in:
  tcsh-6.19.00-026-quote-backslashes-properly.patch

  More info: <http://mx.gw.com/pipermail/tcsh-bugs/2016-June/001067.html>
2016-07-18 13:06:04 +02:00

114 lines
2.8 KiB
Diff

From bd339ea54ce5bd0a4925ae47856cf4bee8174f44 Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Sat, 9 Jul 2016 00:45:29 +0000
Subject: [PATCH 1/2] Always send rusage output to stdout (David Kaspar)
---
Fixes | 1 +
sh.time.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/Fixes b/Fixes
index 981d676..ce17ff9 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 13. always send prusage to stdout.
12. PR/526: Fix double \\ printing from previous fix in history expansion.
10. PR/526: Quote backslashes properly so they can be preserved in ``
expansions
diff --git a/sh.time.c b/sh.time.c
index 23fc7d7..5767ae7 100644
--- a/sh.time.c
+++ b/sh.time.c
@@ -293,6 +293,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
# endif /* _SEQUENT_ */
#endif /* BSDTIMES */
{
+ int ohaderr = haderr;
#ifdef BSDTIMES
time_t t =
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
@@ -334,12 +335,14 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
((e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
+ haderr = 0;
#else /* !BSDTIMES */
# ifdef _SEQUENT_
int ms = (int)
((e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
cp = "%Uu %Ss %E %P %I+%Oio %Fpf+%Ww";
+ haderr = 0;
# else /* !_SEQUENT_ */
# ifndef POSIX
time_t ms = ((time_t)((e - b) / HZ) * 100) +
@@ -350,6 +353,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
# endif /* POSIX */
cp = "%Uu %Ss %E %P";
+ haderr = 0;
/*
* the tms stuff is not very precise, so we fudge it.
@@ -678,6 +682,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
break;
}
xputchar('\n');
+ haderr = ohaderr;
}
#if defined(BSDTIMES) || defined(_SEQUENT_)
--
2.5.5
From fa50bfd63c4b6c68a75b52da9b0284f0f1fcbd89 Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Sat, 9 Jul 2016 00:49:28 +0000
Subject: [PATCH 2/2] add new test for time output.
---
tests/commands.at | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/commands.at b/tests/commands.at
index b78fb26..cf0fcf0 100644
--- a/tests/commands.at
+++ b/tests/commands.at
@@ -1470,6 +1470,7 @@ OK
AT_CLEANUP
+
AT_SETUP([jobs output])
AT_DATA([jobs_stdout.csh],
@@ -1487,3 +1488,22 @@ endif
AT_CHECK([tcsh -f jobs_stdout.csh], 0, [ignore])
AT_CLEANUP
+
+AT_SETUP([time output])
+
+
+AT_DATA([time_output.csh],
+[[
+set time_output=`time sleep 1 > /dev/null`
+echo $time_output > ./output_result
+
+if ( -z ./output_result) then
+ echo "FAIL: 'time' output is not being displayed to stdout!"
+ exit 1
+else
+ exit 0
+endif
+]])
+AT_CHECK([tcsh -f time_output.csh], 0, [ignore])
+
+AT_CLEANUP
--
2.5.5