Compare commits
No commits in common. 'c9' and 'c10-beta' have entirely different histories.
@ -0,0 +1,68 @@
|
|||||||
|
From f88ec3114dfdb5f284367d7602a06dc021409616 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||||
|
Date: Fri, 26 Jan 2024 10:36:07 +0100
|
||||||
|
Subject: [PATCH] Fix formatting a trailing backslash and a percent sign
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
There was a bug report that a trailing backslash leads to printing
|
||||||
|
a nul byte and an commandline:
|
||||||
|
|
||||||
|
$ /usr/bin/time -f 'abc\' sleep 1 2>&1 | hexdump -vC
|
||||||
|
00000000 61 62 63 3f 5c 00 73 6c 65 65 70 0a |abc?\.sleep.|
|
||||||
|
0000000c
|
||||||
|
|
||||||
|
This patch fixes it.
|
||||||
|
|
||||||
|
A similar fix was already in place for a trailing percent sign, but it
|
||||||
|
was missing printing an implicit newline as mandated by
|
||||||
|
the documentation. This patch fixes it either.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
src/time.c | 12 +++++++++---
|
||||||
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/time.c b/src/time.c
|
||||||
|
index 2f2b702..2184e4e 100644
|
||||||
|
--- a/src/time.c
|
||||||
|
+++ b/src/time.c
|
||||||
|
@@ -585,12 +585,13 @@ summarize (fp, fmt, command, resp)
|
||||||
|
break;
|
||||||
|
case '\0':
|
||||||
|
putc ('?', fp);
|
||||||
|
- return;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
putc ('?', fp);
|
||||||
|
putc (*fmt, fp);
|
||||||
|
}
|
||||||
|
- ++fmt;
|
||||||
|
+ if (*fmt != '\0')
|
||||||
|
+ ++fmt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\': /* Format escape. */
|
||||||
|
@@ -605,12 +606,17 @@ summarize (fp, fmt, command, resp)
|
||||||
|
case '\\':
|
||||||
|
putc ('\\', fp);
|
||||||
|
break;
|
||||||
|
+ case '\0':
|
||||||
|
+ putc ('?', fp);
|
||||||
|
+ putc ('\\', fp);
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
putc ('?', fp);
|
||||||
|
putc ('\\', fp);
|
||||||
|
putc (*fmt, fp);
|
||||||
|
}
|
||||||
|
- ++fmt;
|
||||||
|
+ if (*fmt != '\0')
|
||||||
|
+ ++fmt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
diff --color -ruN time-1.9.orig/Makefile.am time-1.9/Makefile.am
|
||||||
|
--- time-1.9.orig/Makefile.am 2017-11-08 16:31:54.000000000 -0500
|
||||||
|
+++ time-1.9/Makefile.am 2023-06-28 13:26:45.271212609 -0400
|
||||||
|
@@ -74,7 +74,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
TESTS = tests/help-version.sh \
|
||||||
|
- tests/time-max-rss.sh \
|
||||||
|
tests/time-exit-codes.sh \
|
||||||
|
tests/time-posix-quiet.sh
|
||||||
|
|
Loading…
Reference in new issue