!21 Update to 2.0.3

From: @starlet-dx 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
This commit is contained in:
openeuler-ci-bot 2023-04-14 06:08:38 +00:00 committed by Gitee
commit c108dff9a4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 93 additions and 91 deletions

View File

@ -0,0 +1,61 @@
From 9147d3b66e0a263c2eb427b7892b34c925363854 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Thu, 17 Feb 2022 17:36:00 +0100
Subject: [PATCH] Don't error out when command receives SIGINT
Interrupting a running command isn't really an execution problem so
don't print an error or return a non-zero exit status.
This is also how it worked in versions older than 2.0.
Resolves: rhbz#1967686
---
src/fallback.c | 3 +++
src/scllib.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/fallback.c b/src/fallback.c
index 4b9c8fd..c907a34 100644
--- a/src/fallback.c
+++ b/src/fallback.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <signal.h>
#include "scllib.h"
#include "sclmalloc.h"
@@ -229,6 +230,8 @@ scl_rc fallback_run_command(char * const colnames[], const char *cmd, bool exec)
xasprintf(&bash_cmd, "/bin/bash %s", tmp);
status = system(bash_cmd);
if (status == -1 || !WIFEXITED(status)) {
+ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
+ goto exit;
debug("Problem with executing command \"%s\"\n", bash_cmd);
ret = ERUN;
goto exit;
diff --git a/src/scllib.c b/src/scllib.c
index a182194..2ba8df8 100644
--- a/src/scllib.c
+++ b/src/scllib.c
@@ -11,6 +11,7 @@
#include <rpm/rpmcli.h>
#include <errno.h>
#include <wordexp.h>
+#include <signal.h>
#include "config.h"
#include "errors.h"
@@ -341,6 +342,8 @@ scl_rc run_command(char * const colnames[], const char *cmd, bool exec)
status = system(cmd);
if (status == -1 || !WIFEXITED(status)) {
+ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
+ goto exit;
debug("Problem with executing program \"%s\"\n", cmd);
ret = ERUN;
goto exit;
--
2.35.1

View File

@ -0,0 +1,21 @@
From 864844ecc11f8cf65cd97bcffdb803211f7edaa4 Mon Sep 17 00:00:00 2001
From: Piotr Wilkosz <piotr.wilkosz@gmail.com>
Date: Mon, 23 May 2022 16:14:13 +0200
Subject: [PATCH] remove tmp file at exit
---
src/fallback.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/fallback.c b/src/fallback.c
index c907a34..e67654a 100644
--- a/src/fallback.c
+++ b/src/fallback.c
@@ -246,6 +246,7 @@ scl_rc fallback_run_command(char * const colnames[], const char *cmd, bool exec)
enable_path = _free(enable_path);
colpath = _free(colpath);
bash_cmd = _free(bash_cmd);
+ unlink(tmp);
return ret;
}

View File

@ -1,33 +0,0 @@
From 54ca3bd3293bd9815712d7d8aaf1fe45f13e5d5e Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Fri, 11 Oct 2019 12:41:11 +0200
Subject: [PATCH] fix direct 'scl_source --help' output
Wrap everything into 'if then else fi' statement, so we don't actually need 'return' statement. Without this wrapping hack, we'd need either 'exit' statement (if executed by /usr/bin/scl_source) or 'return' for 'source scl_source'. For more info see #20.
---
shell/scl_source | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/shell/scl_source b/shell/scl_source
index b0036bd..294740f 100755
--- a/shell/scl_source
+++ b/shell/scl_source
@@ -9,8 +9,7 @@ Options:
if [ $# -eq 0 -o $1 = "-h" -o $1 = "--help" ]; then
echo "$_scl_source_help"
- return 0
-fi
+else # main operation mode
if [ -z "$_recursion" ]; then
@@ -73,3 +72,5 @@ if [ $_recursion == "false" ]; then
_scl_scriptlet_name=""
_recursion="false"
fi
+
+fi # main operation mode
--
2.23.0

View File

@ -1,54 +0,0 @@
From 3538686a21279c60c916e82ece02efcd88ae95b9 Mon Sep 17 00:00:00 2001
From: Joe Orton <jorton@redhat.com>
Date: Thu, 8 Aug 2019 09:26:00 +0100
Subject: [PATCH] Fix crashes in "scl list-enabled":
* src/lib_common.c (merge_string_arrays):
Ensure elements of returned array are strdup()ed.
* src/scllib.c (get_enabled_collections):
Ensure all elements of returned array are strdup()ed.
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1728450
---
src/lib_common.c | 5 +++++
src/scllib.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lib_common.c b/src/lib_common.c
index 1aa49a0..2e7d116 100644
--- a/src/lib_common.c
+++ b/src/lib_common.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <wordexp.h>
+#include <assert.h>
#include "errors.h"
#include "scllib.h"
@@ -269,6 +270,10 @@ char **merge_string_arrays(char *const *array1, char *const *array2)
}
merged_array[++prev] = NULL;
+ for (int i = 0; i < prev; i++) {
+ merged_array[i] = xstrdup(merged_array[i]);
+ }
+
return merged_array;
}
diff --git a/src/scllib.c b/src/scllib.c
index ce8df90..3c32d65 100644
--- a/src/scllib.c
+++ b/src/scllib.c
@@ -107,8 +107,8 @@ scl_rc get_enabled_collections(char ***_enabled_collections)
sizeof(SCL_MODULES_PATH - 1))){
enabled_collections[i] += sizeof(SCL_MODULES_PATH);
- enabled_collections[i] = xstrdup(enabled_collections[i]);
}
+ enabled_collections[i] = xstrdup(enabled_collections[i]);
}
}

Binary file not shown.

BIN
scl-utils-2.0.3.tar.gz Normal file

Binary file not shown.

View File

@ -3,8 +3,8 @@
%global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler}
Name: scl-utils
Epoch: 1
Version: 2.0.2
Release: 5
Version: 2.0.3
Release: 1
Summary: Utilities for alternative packaging
License: GPLv2+
URL: https://github.com/sclorg/scl-utils
@ -13,10 +13,11 @@ Source1: macros.scl-filesystem
BuildRequires: gcc make
Buildrequires: cmake
Buildrequires: rpm-devel
Buildrequires: libcmocka-devel
Requires: %{_bindir}/modulecmd
Patch1: 0003-Scl-utils-layout-patch-from-fedora-famillecollet.com.patch
Patch100: scl-utils-2.0.2-rhbz-1728450.patch
Patch101: fix-direct-scl_source-help-output.patch
Patch100: BZ-2056462-do-not-error-out-on-SIGINT.patch
Patch101: BZ-2091000-remove-tmp-file.patch
Patch102: add-h-option-to-scl-command.patch
%description
Run-time utility for alternative packaging.
@ -49,6 +50,9 @@ mkdir modulefiles
mkdir prefixes
ln -s prefixes conf
%check
make check
%files
%dir %{_sysconfdir}/scl/modulefiles
%dir %{_sysconfdir}/scl/prefixes
@ -72,6 +76,9 @@ ln -s prefixes conf
%{_rpmconfigdir}/brp-scl-python-bytecompile
%changelog
* Fri Apr 14 2023 yaoxin <yao_xin001@hoperun.com> - 1:2.0.3-1
- Update to 2.0.3
* Thu Nov 17 2022 caodongxia <caodongxia@h-partners.com> - 1:2.0.2-5
- Replace oenEuler with the vendor macro