|
Panu Matilainen |
b0f8f4 |
From fff4b0b2249223fccddcce9eea8658ddd12f30a0 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
b0f8f4 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
b0f8f4 |
Date: Fri, 3 Nov 2023 11:34:54 +0200
|
|
Panu Matilainen |
b0f8f4 |
Subject: [PATCH 1/4] Use macro error reporting for %add_sysuser errors
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
Lua has error() but no warning() (obviously) which we'll want in the next
|
|
Panu Matilainen |
b0f8f4 |
step, so for consistency lets just use macro.error() instead.
|
|
Panu Matilainen |
b0f8f4 |
---
|
|
Panu Matilainen |
b0f8f4 |
macros.in | 4 ++--
|
|
Panu Matilainen |
b0f8f4 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/macros.in b/macros.in
|
|
Panu Matilainen |
b0f8f4 |
index a047d1e388..1f6d8b252f 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/macros.in
|
|
Panu Matilainen |
b0f8f4 |
+++ b/macros.in
|
|
Panu Matilainen |
b0f8f4 |
@@ -1325,14 +1325,14 @@ end
|
|
Panu Matilainen |
b0f8f4 |
prefix = 'Provides: '
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
if #arg < 2 then
|
|
Panu Matilainen |
b0f8f4 |
- error('not enough arguments')
|
|
Panu Matilainen |
b0f8f4 |
+ macros.error({'not enough arguments'})
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
if arg[1] == 'g' then
|
|
Panu Matilainen |
b0f8f4 |
type = 'group'
|
|
Panu Matilainen |
b0f8f4 |
elseif arg[1] == 'u' then
|
|
Panu Matilainen |
b0f8f4 |
type = 'user'
|
|
Panu Matilainen |
b0f8f4 |
else
|
|
Panu Matilainen |
b0f8f4 |
- error('invalid sysuser type: '..arg[1])
|
|
Panu Matilainen |
b0f8f4 |
+ macros.error({'invalid sysuser type: '..arg[1]})
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
name = arg[2]
|
|
Panu Matilainen |
b0f8f4 |
line = table.concat(arg, ' ')
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
From 8e392aef642fba1f63b6d86b11fad85d63d94ba1 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
b0f8f4 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
b0f8f4 |
Date: Fri, 3 Nov 2023 11:51:11 +0200
|
|
Panu Matilainen |
b0f8f4 |
Subject: [PATCH 2/4] Fix an apparent thinko/typo in the sysusers test spec
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
I'm quite sure I didn't really intend to test duplicate files behavior
|
|
Panu Matilainen |
b0f8f4 |
here...
|
|
Panu Matilainen |
b0f8f4 |
---
|
|
Panu Matilainen |
b0f8f4 |
tests/data/SPECS/klang.spec | 3 ++-
|
|
Panu Matilainen |
b0f8f4 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
index 7e917fdc7f..e6cce1add8 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
+++ b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
@@ -28,6 +28,7 @@ Summary: %{SUMMARY} server
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
%install
|
|
Panu Matilainen |
b0f8f4 |
mkdir -p ${RPM_BUILD_ROOT}/var/lib/klangd
|
|
Panu Matilainen |
b0f8f4 |
+mkdir -p ${RPM_BUILD_ROOT}/var/lib/plongd
|
|
Panu Matilainen |
b0f8f4 |
mkdir -p ${RPM_BUILD_ROOT}/usr/bin/
|
|
Panu Matilainen |
b0f8f4 |
mkdir -p ${RPM_BUILD_ROOT}/etc
|
|
Panu Matilainen |
b0f8f4 |
mkdir -p ${RPM_BUILD_ROOT}/%{_sysusersdir}
|
|
Panu Matilainen |
b0f8f4 |
@@ -59,5 +60,5 @@ EOF
|
|
Panu Matilainen |
b0f8f4 |
%{_sysusersdir}/klangd.conf
|
|
Panu Matilainen |
b0f8f4 |
%{_sysusersdir}/plong.conf
|
|
Panu Matilainen |
b0f8f4 |
%attr(-,klangd,klangd) /var/lib/klangd
|
|
Panu Matilainen |
b0f8f4 |
-%attr(-,plong,klong) /var/lib/klangd
|
|
Panu Matilainen |
b0f8f4 |
+%attr(-,plong,klong) /var/lib/plongd
|
|
Panu Matilainen |
b0f8f4 |
/usr/bin/klangd
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
From 59a212dbe3cb19331582c9c022105ae47b9ace21 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
b0f8f4 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
b0f8f4 |
Date: Fri, 3 Nov 2023 11:53:11 +0200
|
|
Panu Matilainen |
b0f8f4 |
Subject: [PATCH 3/4] Handle unsupported 'r' and 'm' sysusers types more
|
|
Panu Matilainen |
b0f8f4 |
gracefully
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
People will want to use existing sysusers.d files through rpm and while
|
|
Panu Matilainen |
b0f8f4 |
we don't support 'r' and 'm' at this time, we shouldn't really call
|
|
Panu Matilainen |
b0f8f4 |
them "invalid" and error out. Issue a warning instead, and ignore.
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
This is the first half of
|
|
Panu Matilainen |
b0f8f4 |
https://bugzilla.redhat.com/show_bug.cgi?id=2246236
|
|
Panu Matilainen |
b0f8f4 |
---
|
|
Panu Matilainen |
b0f8f4 |
macros.in | 3 +++
|
|
Panu Matilainen |
b0f8f4 |
tests/data/SPECS/klang.spec | 2 ++
|
|
Panu Matilainen |
b0f8f4 |
tests/rpmi.at | 7 +++++++
|
|
Panu Matilainen |
b0f8f4 |
3 files changed, 12 insertions(+)
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/macros.in b/macros.in
|
|
Panu Matilainen |
b0f8f4 |
index 1f6d8b252f..fefb351ac3 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/macros.in
|
|
Panu Matilainen |
b0f8f4 |
+++ b/macros.in
|
|
Panu Matilainen |
b0f8f4 |
@@ -1331,6 +1331,9 @@ end
|
|
Panu Matilainen |
b0f8f4 |
type = 'group'
|
|
Panu Matilainen |
b0f8f4 |
elseif arg[1] == 'u' then
|
|
Panu Matilainen |
b0f8f4 |
type = 'user'
|
|
Panu Matilainen |
b0f8f4 |
+ elseif arg[1] == 'r' or arg[1] == 'm' then
|
|
Panu Matilainen |
b0f8f4 |
+ macros.warn({'ignoring unsupported sysuser type: '..arg[1]})
|
|
Panu Matilainen |
b0f8f4 |
+ return
|
|
Panu Matilainen |
b0f8f4 |
else
|
|
Panu Matilainen |
b0f8f4 |
macros.error({'invalid sysuser type: '..arg[1]})
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
index e6cce1add8..e7c03cd7f8 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
+++ b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
@@ -47,6 +47,8 @@ EOF
|
|
Panu Matilainen |
b0f8f4 |
cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/plong.conf
|
|
Panu Matilainen |
b0f8f4 |
u plong - "Plong fu" /var/lib/plong /sbin/nologin
|
|
Panu Matilainen |
b0f8f4 |
g klong -
|
|
Panu Matilainen |
b0f8f4 |
+m ding dong
|
|
Panu Matilainen |
b0f8f4 |
+r - 123-321
|
|
Panu Matilainen |
b0f8f4 |
EOF
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
%files common
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/tests/rpmi.at b/tests/rpmi.at
|
|
Panu Matilainen |
b0f8f4 |
index 6339a70a7c..94d8967b12 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/tests/rpmi.at
|
|
Panu Matilainen |
b0f8f4 |
+++ b/tests/rpmi.at
|
|
Panu Matilainen |
b0f8f4 |
@@ -1481,7 +1481,14 @@ AT_SETUP([rpm -i sysusers])
|
|
Panu Matilainen |
b0f8f4 |
AT_KEYWORDS([install build sysusers])
|
|
Panu Matilainen |
b0f8f4 |
RPMDB_INIT
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
+RPMTEST_CHECK([
|
|
Panu Matilainen |
b0f8f4 |
runroot rpmbuild -bb --quiet /data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
+],
|
|
Panu Matilainen |
b0f8f4 |
+[0],
|
|
Panu Matilainen |
b0f8f4 |
+[],
|
|
Panu Matilainen |
b0f8f4 |
+[warning: ignoring unsupported sysuser type: m
|
|
Panu Matilainen |
b0f8f4 |
+warning: ignoring unsupported sysuser type: r
|
|
Panu Matilainen |
b0f8f4 |
+])
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
RPMTEST_CHECK([
|
|
Panu Matilainen |
b0f8f4 |
runroot rpm -U /build/RPMS/noarch/klang-client-1.0-1.noarch.rpm
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
From c47f71a72e7f885615c677e88ce92810ed1f00c8 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
b0f8f4 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
b0f8f4 |
Date: Fri, 3 Nov 2023 12:15:58 +0200
|
|
Panu Matilainen |
b0f8f4 |
Subject: [PATCH 4/4] Fix comment line handling in sysusers.d(8) files
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
sysusers.d(8) format permits empty lines and commits, and so must we.
|
|
Panu Matilainen |
b0f8f4 |
Add some extra fluff to the test-case for this.
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
This is the second half of
|
|
Panu Matilainen |
b0f8f4 |
https://bugzilla.redhat.com/show_bug.cgi?id=2246236
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
Fixes: #2741
|
|
Panu Matilainen |
b0f8f4 |
---
|
|
Panu Matilainen |
b0f8f4 |
fileattrs/sysusers.attr | 4 ++++
|
|
Panu Matilainen |
b0f8f4 |
tests/data/SPECS/klang.spec | 5 +++++
|
|
Panu Matilainen |
b0f8f4 |
2 files changed, 9 insertions(+)
|
|
Panu Matilainen |
b0f8f4 |
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/fileattrs/sysusers.attr b/fileattrs/sysusers.attr
|
|
Panu Matilainen |
b0f8f4 |
index f7a3e838d1..48d4caede9 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/fileattrs/sysusers.attr
|
|
Panu Matilainen |
b0f8f4 |
+++ b/fileattrs/sysusers.attr
|
|
Panu Matilainen |
b0f8f4 |
@@ -6,6 +6,9 @@
|
|
Panu Matilainen |
b0f8f4 |
# For groups created as a side-effect, only provide the group.
|
|
Panu Matilainen |
b0f8f4 |
%__sysusers_provides() %{lua:
|
|
Panu Matilainen |
b0f8f4 |
for line in io.lines(macros["1"]) do
|
|
Panu Matilainen |
b0f8f4 |
+ if line:sub(1, 1) == '#' then
|
|
Panu Matilainen |
b0f8f4 |
+ goto continue
|
|
Panu Matilainen |
b0f8f4 |
+ end
|
|
Panu Matilainen |
b0f8f4 |
fields = {}
|
|
Panu Matilainen |
b0f8f4 |
for w in line:gmatch("%S+") do
|
|
Panu Matilainen |
b0f8f4 |
table.insert(fields, w)
|
|
Panu Matilainen |
b0f8f4 |
@@ -14,5 +17,6 @@
|
|
Panu Matilainen |
b0f8f4 |
table.insert(fields, 1, '-b')
|
|
Panu Matilainen |
b0f8f4 |
print(macros.add_sysuser(fields))
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
+ ::continue::
|
|
Panu Matilainen |
b0f8f4 |
end
|
|
Panu Matilainen |
b0f8f4 |
}
|
|
Panu Matilainen |
b0f8f4 |
diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
index e7c03cd7f8..64bd90c104 100644
|
|
Panu Matilainen |
b0f8f4 |
--- a/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
+++ b/tests/data/SPECS/klang.spec
|
|
Panu Matilainen |
b0f8f4 |
@@ -45,7 +45,12 @@ cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/klangd.conf
|
|
Panu Matilainen |
b0f8f4 |
u klangd - "Klang server" /var/lib/klangd /sbin/nologin
|
|
Panu Matilainen |
b0f8f4 |
EOF
|
|
Panu Matilainen |
b0f8f4 |
cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/plong.conf
|
|
Panu Matilainen |
b0f8f4 |
+
|
|
Panu Matilainen |
b0f8f4 |
+# Real life files have all sorts of anomalies
|
|
Panu Matilainen |
b0f8f4 |
u plong - "Plong fu" /var/lib/plong /sbin/nologin
|
|
Panu Matilainen |
b0f8f4 |
+#...such as empty lines
|
|
Panu Matilainen |
b0f8f4 |
+
|
|
Panu Matilainen |
b0f8f4 |
+# and comments comments
|
|
Panu Matilainen |
b0f8f4 |
g klong -
|
|
Panu Matilainen |
b0f8f4 |
m ding dong
|
|
Panu Matilainen |
b0f8f4 |
r - 123-321
|