Accepting request 896081 from home:michals

- Adjust to usermerge. On Tumbleweed /lib and /usr/lib are the same directory
  and the canonical location is in /usr. Document and read only /usr to prevent
  reading the same file twice.
  On earlier releases preserve compatibility for files placed in /lib and read
  both.
  + kmod-usrmerge.patch
  * Refresh usr-lib-modprobe.patch
- Remove test patches included in release 29
  - kmod-populate-modules-Use-more-bash-more-quotes.patch
  - kmod-testsuite-compress-modules-if-feature-is-enabled.patch
  - kmod-also-test-xz-compression.patch

OBS-URL: https://build.opensuse.org/request/show/896081
OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=188
This commit is contained in:
Jan Engelhardt 2021-05-29 17:41:53 +00:00 committed by Git OBS Bridge
parent 07400734ee
commit d0a8f9a8ff
8 changed files with 137 additions and 249 deletions

View File

@ -1,39 +0,0 @@
From 07aed32d80f306372e13701181cb827e6d0d7cff Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@intel.com>
Date: Fri, 29 Jan 2021 18:36:00 -0800
Subject: [PATCH 2/2] testsuite: also test xz compression
---
testsuite/populate-modules.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index ae43884984b8..099f02669156 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -72,6 +72,9 @@ map=(
gzip_array=(
"test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
+ )
+
+xz_array=(
"test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
)
@@ -112,6 +115,12 @@ if feature_enabled ZLIB; then
done
fi
+if feature_enabled XZ; then
+ for m in "${xz_array[@]}"; do
+ xz "$ROOTFS/$m"
+ done
+fi
+
if feature_enabled ZSTD; then
for m in "${zstd_array[@]}"; do
zstd --rm $ROOTFS/$m
--
2.26.2

View File

@ -1,65 +0,0 @@
From 3cee67ddd75114f9557ab7e13ef1751c277d9bd3 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 25 Mar 2020 11:03:58 -0400
Subject: [PATCH] populate-modules: Use more bash, more quotes
We're already using associatives arrays, so there's no reason we should
be using 'test'.
---
testsuite/populate-modules.sh | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index 358e7405dcf8..b0cc932818e0 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -85,15 +85,15 @@ attach_pkcs7_array=(
"test-modinfo/mod-simple-pkcs7.ko"
)
-for k in ${!map[@]}; do
+for k in "${!map[@]}"; do
dst=${ROOTFS}/$k
src=${MODULE_PLAYGROUND}/${map[$k]}
- if test "${dst: -1}" = "/"; then
- install -d $dst
- install -t $dst $src
+ if [[ $dst = */ ]]; then
+ install -d "$dst"
+ install -t "$dst" "$src"
else
- install -D $src $dst
+ install -D "$src" "$dst"
fi
done
@@ -101,7 +101,7 @@ done
# gzip these modules
for m in "${gzip_array[@]}"; do
- gzip $ROOTFS/$m
+ gzip "$ROOTFS/$m"
done
# zstd-compress these modules
@@ -110,13 +110,13 @@ for m in "${zstd_array[@]}"; do
done
for m in "${attach_sha1_array[@]}"; do
- cat ${MODULE_PLAYGROUND}/dummy.sha1 >> ${ROOTFS}/$m
+ cat "${MODULE_PLAYGROUND}/dummy.sha1" >>"${ROOTFS}/$m"
done
for m in "${attach_sha256_array[@]}"; do
- cat ${MODULE_PLAYGROUND}/dummy.sha256 >> ${ROOTFS}/$m
+ cat "${MODULE_PLAYGROUND}/dummy.sha256" >>"${ROOTFS}/$m"
done
for m in "${attach_pkcs7_array[@]}"; do
- cat ${MODULE_PLAYGROUND}/dummy.pkcs7 >> ${ROOTFS}/$m
+ cat "${MODULE_PLAYGROUND}/dummy.pkcs7" >>"${ROOTFS}/$m"
done
--
2.26.2

View File

@ -1,103 +0,0 @@
From 4be01b2fc8f44c35184138ee9e21f2bc146c9056 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@intel.com>
Date: Fri, 29 Jan 2021 18:35:59 -0800
Subject: [PATCH 1/2] testsuite: compress modules if feature is enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since the output needs to be the same, regardless if the module is
compressed, change populate-modules.sh to conditionally compress the
module if that feature is enabled.
This way we can execute the tests with any build-time configuration and
it should still pass.
Suggested-by: Michal Suchánek <msuchanek@suse.de>
---
Makefile.am | 2 +-
testsuite/populate-modules.sh | 27 ++++++++++++++++++---------
testsuite/test-depmod.c | 2 --
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 702a665f0334..8c79349f1eb9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -250,7 +250,7 @@ CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) &
find $(ROOTFS) -type d -exec chmod +w {} \; && \
find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
$(top_srcdir)/testsuite/populate-modules.sh \
- $(MODULE_PLAYGROUND) $(ROOTFS) ) && \
+ $(MODULE_PLAYGROUND) $(ROOTFS) $(top_builddir)/config.h ) && \
touch testsuite/stamp-rootfs
build-module-playground:
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index b0cc932818e0..ae43884984b8 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -4,6 +4,12 @@ set -e
MODULE_PLAYGROUND=$1
ROOTFS=$2
+CONFIG_H=$3
+
+feature_enabled() {
+ local feature=$1
+ grep KMOD_FEATURES $CONFIG_H | head -n 1 | grep -q \+$feature
+}
declare -A map
map=(
@@ -99,15 +105,18 @@ done
# start poking the final rootfs...
-# gzip these modules
-for m in "${gzip_array[@]}"; do
- gzip "$ROOTFS/$m"
-done
-
-# zstd-compress these modules
-for m in "${zstd_array[@]}"; do
- zstd --rm $ROOTFS/$m
-done
+# compress modules with each format if feature is enabled
+if feature_enabled ZLIB; then
+ for m in "${gzip_array[@]}"; do
+ gzip "$ROOTFS/$m"
+ done
+fi
+
+if feature_enabled ZSTD; then
+ for m in "${zstd_array[@]}"; do
+ zstd --rm $ROOTFS/$m
+ done
+fi
for m in "${attach_sha1_array[@]}"; do
cat "${MODULE_PLAYGROUND}/dummy.sha1" >>"${ROOTFS}/$m"
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 261559cab89b..d7802d7b2e0b 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -25,7 +25,6 @@
#include "testsuite.h"
-#ifdef ENABLE_ZLIB
#define MODULES_ORDER_UNAME "4.4.4"
#define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
@@ -57,7 +56,6 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
{ }
},
});
-#endif
#define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
static noreturn int depmod_search_order_simple(const struct test *t)
--
2.26.2

View File

@ -37,9 +37,7 @@ Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch6: 0012-modprobe-print-unsupported-status.patch Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: usr-lib-modprobe.patch Patch7: usr-lib-modprobe.patch
Patch8: no-stylesheet-download.patch Patch8: no-stylesheet-download.patch
Patch10: kmod-populate-modules-Use-more-bash-more-quotes.patch Patch9: kmod-usrmerge.patch
Patch11: kmod-testsuite-compress-modules-if-feature-is-enabled.patch
Patch12: kmod-also-test-xz-compression.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: docbook5-xsl-stylesheets BuildRequires: docbook5-xsl-stylesheets

68
kmod-usrmerge.patch Normal file
View File

@ -0,0 +1,68 @@
From 6572069f71045f304780cb63a5a090a275fc22dd Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Sat, 29 May 2021 08:10:36 +0200
Subject: [PATCH] modprobe.d, depmod.d: Only read from /usr/lib, not /lib.
With usrmerge /lib is linked to /usr/lib and the modprobe.d files would
be interpreted twice. It is possible to write non-idempotent modprobe.d
files leading to weird errors.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
libkmod/libkmod.c | 1 -
man/depmod.d.xml | 1 -
man/modprobe.d.xml | 1 -
tools/depmod.c | 1 -
4 files changed, 4 deletions(-)
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index ddf13fb3d822..262f5d1512c9 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -66,7 +66,6 @@ static const char *default_config_paths[] = {
"/run/modprobe.d",
"/usr/local/lib/modprobe.d",
PREFIX "/lib/modprobe.d",
- "/lib/modprobe.d",
NULL
};
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 8a898cf4a9eb..b315e931d635 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -39,7 +39,6 @@
</refnamediv>
<refsynopsisdiv>
- <para><filename>/lib/depmod.d/*.conf</filename></para>
<para><filename>/usr/lib/depmod.d/*.conf</filename></para>
<para><filename>/usr/local/lib/depmod.d/*.conf</filename></para>
<para><filename>/run/depmod.d/*.conf</filename></para>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 8a7c696dcee1..08d789176dd3 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -40,7 +40,6 @@
</refnamediv>
<refsynopsisdiv>
- <para><filename>/lib/modprobe.d/*.conf</filename></para>
<para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
<para><filename>/usr/local/lib/modprobe.d/*.conf</filename></para>
<para><filename>/run/modprobe.d/*.conf</filename></para>
diff --git a/tools/depmod.c b/tools/depmod.c
index 8f6a4f8cd7cb..3a4708316581 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -55,7 +55,6 @@ static const char *default_cfg_paths[] = {
"/run/depmod.d",
"/usr/local/lib/depmod.d",
PREFIX "/lib/depmod.d",
- "/lib/depmod.d",
NULL
};
--
2.26.2

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sat May 29 09:58:09 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- Adjust to usermerge. On Tumbleweed /lib and /usr/lib are the same directory
and the canonical location is in /usr. Document and read only /usr to prevent
reading the same file twice.
On earlier releases preserve compatibility for files placed in /lib and read
both.
+ kmod-usrmerge.patch
* Refresh usr-lib-modprobe.patch
- Remove test patches included in release 29
- kmod-populate-modules-Use-more-bash-more-quotes.patch
- kmod-testsuite-compress-modules-if-feature-is-enabled.patch
- kmod-also-test-xz-compression.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu May 27 22:20:42 UTC 2021 - Jan Engelhardt <jengelh@inai.de> Thu May 27 22:20:42 UTC 2021 - Jan Engelhardt <jengelh@inai.de>

View File

@ -37,6 +37,7 @@ Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch6: 0012-modprobe-print-unsupported-status.patch Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: usr-lib-modprobe.patch Patch7: usr-lib-modprobe.patch
Patch8: no-stylesheet-download.patch Patch8: no-stylesheet-download.patch
Patch9: kmod-usrmerge.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: docbook5-xsl-stylesheets BuildRequires: docbook5-xsl-stylesheets
@ -100,6 +101,11 @@ in %lname.
%prep %prep
%autosetup -p1 %autosetup -p1
# When not on tumbleweed read both /lib and /usr/lib
# on Tumbleweed /lib and /usr/lib are the same - don't apply files twice
%if 0%{?suse_version} <= 1500
%patch9 -p1 -R
%endif
%build %build
autoreconf -fi autoreconf -fi

View File

@ -1,6 +1,10 @@
From fc1b2c14e2ca4d7ccd4a3b75a435ab7d927533bc Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 12 Jan 2021 16:54:46 +0100 Date: Tue, 12 Jan 2021 16:54:46 +0100
Subject: [PATCH] modprobe.d: load from /usr/lib. Subject: [PATCH] modprobe.d, depmod.d: load from /usr/lib.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is an ongoing effort to limit use of files outside of /usr (or There is an ongoing effort to limit use of files outside of /usr (or
$prefix on general). Currently all modprobe.d paths are hardcoded to $prefix on general). Currently all modprobe.d paths are hardcoded to
@ -10,26 +14,18 @@ Cc: Marcus Rückert <mrueckert@suse.com>
Cc: Takashi Iwai <tiwai@suse.com> Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dominique Leuenberger <dimstar@opensuse.org> Cc: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
From: Jan Engelhardt <jengelh@inai.de>
Date: 2021-05-28 00:17:47.552369139 +0200
If you make the build flexible and allow varying values for ``--sysconfdir``,
then permit the same for ``--prefix``.
An obvious side effect is that with little change, the unnecessary hard
dependency on merged /usr goes away.
--- ---
Makefile.am | 1 + Makefile.am | 1 +
libkmod/libkmod.c | 2 +- libkmod/libkmod.c | 1 +
man/modprobe.d.xml | 2 +- man/depmod.d.xml | 1 +
tools/depmod.c | 2 +- man/modprobe.d.xml | 1 +
4 files changed, 4 insertions(+), 3 deletions(-) tools/depmod.c | 1 +
5 files changed, 5 insertions(+)
Index: kmod-29/Makefile.am diff --git a/Makefile.am b/Makefile.am
=================================================================== index d859c240178f..8553368988c0 100644
--- kmod-29.orig/Makefile.am --- a/Makefile.am
+++ kmod-29/Makefile.am +++ b/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \ @@ -19,6 +19,7 @@ AM_CPPFLAGS = \
-include $(top_builddir)/config.h \ -include $(top_builddir)/config.h \
-I$(top_srcdir) \ -I$(top_srcdir) \
@ -38,42 +34,54 @@ Index: kmod-29/Makefile.am
${zlib_CFLAGS} ${zlib_CFLAGS}
AM_CFLAGS = $(OUR_CFLAGS) AM_CFLAGS = $(OUR_CFLAGS)
Index: kmod-29/libkmod/libkmod.c diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
=================================================================== index 7c2b889d713e..ddf13fb3d822 100644
--- kmod-29.orig/libkmod/libkmod.c --- a/libkmod/libkmod.c
+++ kmod-29/libkmod/libkmod.c +++ b/libkmod/libkmod.c
@@ -65,7 +65,7 @@ static const char *default_config_paths[ @@ -65,6 +65,7 @@ static const char *default_config_paths[] = {
SYSCONFDIR "/modprobe.d", SYSCONFDIR "/modprobe.d",
"/run/modprobe.d", "/run/modprobe.d",
"/usr/local/lib/modprobe.d", "/usr/local/lib/modprobe.d",
- "/lib/modprobe.d",
+ PREFIX "/lib/modprobe.d", + PREFIX "/lib/modprobe.d",
"/lib/modprobe.d",
NULL NULL
}; };
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
Index: kmod-29/man/modprobe.d.xml index b315e931d635..8a898cf4a9eb 100644
=================================================================== --- a/man/depmod.d.xml
--- kmod-29.orig/man/modprobe.d.xml +++ b/man/depmod.d.xml
+++ kmod-29/man/modprobe.d.xml @@ -39,6 +39,7 @@
@@ -40,7 +40,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
- <para><filename>/lib/modprobe.d/*.conf</filename></para> + <para><filename>/lib/depmod.d/*.conf</filename></para>
<para><filename>/usr/lib/depmod.d/*.conf</filename></para>
<para><filename>/usr/local/lib/depmod.d/*.conf</filename></para>
<para><filename>/run/depmod.d/*.conf</filename></para>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 0ab3e9110a7e..8a7c696dcee1 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -41,6 +41,7 @@
<refsynopsisdiv>
<para><filename>/lib/modprobe.d/*.conf</filename></para>
+ <para><filename>/usr/lib/modprobe.d/*.conf</filename></para> + <para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
<para><filename>/usr/local/lib/modprobe.d/*.conf</filename></para> <para><filename>/usr/local/lib/modprobe.d/*.conf</filename></para>
<para><filename>/run/modprobe.d/*.conf</filename></para> <para><filename>/run/modprobe.d/*.conf</filename></para>
<para><filename>/etc/modprobe.d/*.conf</filename></para> <para><filename>/etc/modprobe.d/*.conf</filename></para>
Index: kmod-29/tools/depmod.c diff --git a/tools/depmod.c b/tools/depmod.c
=================================================================== index eb810b811e35..8f6a4f8cd7cb 100644
--- kmod-29.orig/tools/depmod.c --- a/tools/depmod.c
+++ kmod-29/tools/depmod.c +++ b/tools/depmod.c
@@ -54,7 +54,7 @@ static const char *default_cfg_paths[] = @@ -54,6 +54,7 @@ static const char *default_cfg_paths[] = {
SYSCONFDIR "/depmod.d", SYSCONFDIR "/depmod.d",
"/run/depmod.d", "/run/depmod.d",
"/usr/local/lib/depmod.d", "/usr/local/lib/depmod.d",
- "/lib/depmod.d",
+ PREFIX "/lib/depmod.d", + PREFIX "/lib/depmod.d",
"/lib/depmod.d",
NULL NULL
}; };
--
2.26.2