Fix formatting a trailing backslash
This commit is contained in:
parent
431009c66d
commit
08c529d014
@ -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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: A GNU utility for monitoring a program's use of system resources
|
||||
Name: time
|
||||
Version: 1.9
|
||||
Release: 22%{?dist}
|
||||
Release: 23%{?dist}
|
||||
# src/time.c: GPL-3.0-or-later
|
||||
# COPYING: GPL-3.0 text
|
||||
# doc/time.texi: GFDL-1.3-no-invariants-or-later
|
||||
@ -62,6 +62,9 @@ Patch3: time-1.9-Close-outfp-before-exec.patch
|
||||
# to increase RSS in 5 MB). In addition there is regression in ppc64le kernel
|
||||
# (bug #2212765) which always fails.
|
||||
Patch4: time-1.9-drop-flawed-rss-test.patch
|
||||
# Fix formatting a trailing backslash, proposed to the upstream,
|
||||
# <https://lists.gnu.org/archive/html/bug-time/2024-01/msg00000.html>
|
||||
Patch5: time-1.9-Fix-formatting-a-trailing-backslash-and-a-percent-si.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: bash
|
||||
@ -87,6 +90,7 @@ the results.
|
||||
touch -d "$(sed -n -e '/^Date: /{s/^[^:]*: //;p}' %{PATCH2})" doc/time.texi
|
||||
%patch -P3 -p1
|
||||
%patch -P4 -p1
|
||||
%patch -P5 -p1
|
||||
# Correct version VERSION flag for doc/time.texi
|
||||
# <https://lists.gnu.org/archive/html/bug-time/2021-01/msg00000.html>
|
||||
printf '%{version}\n' > .tarball-version
|
||||
@ -112,6 +116,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
# time(1) manual page lives in man-pages package, bug #1612294.
|
||||
|
||||
%changelog
|
||||
* Fri Jan 26 2024 Petr Pisar <ppisar@redhat.com> - 1.9-23
|
||||
- Fix formatting a trailing backslash
|
||||
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-22
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user