From 762685cdfc5af1b370ccad8bfd27ec924c9182ca Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 16 Nov 2020 14:02:48 -0800 Subject: [PATCH] RHEL 9.0.0 Alpha bootstrap The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/time#71b1dd06b6211b4a7ae733b714ff0d5bf0b52dec --- time-1.9-Close-outfp-before-exec.patch | 34 ++++++++++++++++++++++++++ time.spec | 14 ++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 time-1.9-Close-outfp-before-exec.patch diff --git a/time-1.9-Close-outfp-before-exec.patch b/time-1.9-Close-outfp-before-exec.patch new file mode 100644 index 0000000..3902bb6 --- /dev/null +++ b/time-1.9-Close-outfp-before-exec.patch @@ -0,0 +1,34 @@ +From 6a5c4499aab677d19157c7adcf598d14267283c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 16 Nov 2020 17:45:04 +0100 +Subject: [PATCH] Close outfp before exec +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When called with --outfile, we open an output file to which +we log timing results. Close that descriptor in the child +fork before exec'ing the process to be timed. + +Reported-by: Ed Santiago +Signed-off-by: Petr Písař +--- + src/time.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/time.c b/src/time.c +index f76265a..2f2b702 100644 +--- a/src/time.c ++++ b/src/time.c +@@ -738,6 +738,8 @@ run_command (cmd, resp) + error (EXIT_CANCELED, errno, "cannot fork"); + else if (pid == 0) + { /* If child. */ ++ if (outfp != stderr) ++ fclose(outfp); + /* Don't cast execvp arguments; that causes errors on some systems, + versus merely warnings if the cast is left off. */ + execvp (cmd[0], cmd); +-- +2.25.4 + diff --git a/time.spec b/time.spec index 2f092d1..3d0b376 100644 --- a/time.spec +++ b/time.spec @@ -1,7 +1,7 @@ Summary: A GNU utility for monitoring a program's use of system resources Name: time Version: 1.9 -Release: 10%{?dist} +Release: 12%{?dist} # src/time.c: GPLv3+ # COPYING: GPLv3 text # doc/time.texi: GFDL @@ -49,6 +49,10 @@ Patch1: time-1.9-Improve-info-directory-index-entry-description.patch # Clarify RSS size as kibibytes in a documentation, proposed to an upstream, # Patch2: time-1.9-Use-kibibytes-instead-of-kilobytes-in-a-documentatio.patch +# Do not leak a file descriptor of the --output argument to a command, +# proposed to an upstream, +# +Patch3: time-1.9-Close-outfp-before-exec.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -69,6 +73,7 @@ the results. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 autoreconf -fi %build @@ -91,6 +96,13 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir # time(1) manual page lives in man-pages package, bug #1612294. %changelog +* Mon Nov 16 2020 Petr Pisar - 1.9-12 +- Fix a regression in closing a file descriptor if no --output was given + (bug #1898138) + +* Wed Nov 11 2020 Petr Pisar - 1.9-11 +- Do not leak a file descriptor of the --output argument to a command + * Wed Jul 29 2020 Fedora Release Engineering - 1.9-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild