添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version: 249-rc1
Running the upstream-ci tests, I get tests which fail with an awk syntax error

D: Installing /lib/modules/5.10.0-7-amd64/kernel/crypto/keywrap.ko
D: Installing /lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1
D: Installing /sbin/dmeventd
D: Installing /lib/udev/rules.d/55-dm.rules
awk: line 1: syntax error at or near ,
make: Leaving directory '/tmp/autopkgtest.UU4tI9/tree/test/TEST-24-CRYPTSETUP'
--x-- Result of TEST-24-CRYPTSETUP: 2 --x--
make: *** [Makefile:2: setup] Error 2
--x-- Running TEST-29-PORTABLE --x--
+ make -C TEST-29-PORTABLE setup run
make: Entering directory '/tmp/autopkgtest.UU4tI9/tree/test/TEST-29-PORTABLE'
TEST-29-PORTABLE SETUP: test systemd-portabled
'/tmp/autopkgtest.UU4tI9/tree/build-deb/test/default.img' -> '/tmp/autopkgtest.UU4tI9/tree/build-deb/test/TEST-29-PORTABLE/../portabled.img'
Reusing existing cached image /tmp/autopkgtest.UU4tI9/tree/build-deb/test/TEST-29-PORTABLE/../portabled.img → /tmp/autopkgtest.UU4tI9/tree/buil
d-deb/test/portabled.img
'/tmp/autopkgtest.UU4tI9/tree/build-deb/test/portabled.img' -> '/var/tmp/systemd-test.9Et5r2/portabled.img'
I: Possible missing firmware "qat_c62x_mmp.bin" for kernel module "qat_c62x.ko"
I: Possible missing firmware "qat_c62x.bin" for kernel module "qat_c62x.ko"
I: Possible missing firmware "qat_895xcc_mmp.bin" for kernel module "qat_dh895xcc.ko"
I: Possible missing firmware "qat_895xcc.bin" for kernel module "qat_dh895xcc.ko"
I: Possible missing firmware "qat_c3xxx_mmp.bin" for kernel module "qat_c3xxx.ko"
I: Possible missing firmware "qat_c3xxx.bin" for kernel module "qat_c3xxx.ko"
I: Possible missing firmware "cxgb4/t6fw.bin" for kernel module "cxgb4.ko"
I: Possible missing firmware "cxgb4/t5fw.bin" for kernel module "cxgb4.ko"
I: Possible missing firmware "cxgb4/t4fw.bin" for kernel module "cxgb4.ko"
awk: line 1: syntax error at or near ,
make: Leaving directory '/tmp/autopkgtest.UU4tI9/tree/test/TEST-29-PORTABLE'
make: *** [Makefile:2: setup] Error 2
--x-- Result of TEST-29-PORTABLE: 2 --x--
--x-- Running TEST-50-DISSECT --x--
make: Entering directory '/tmp/autopkgtest.UU4tI9/tree/test/TEST-50-DISSECT'
+ make -C TEST-50-DISSECT setup run
TEST-50-DISSECT SETUP: test systemd-dissect
'/tmp/autopkgtest.UU4tI9/tree/build-deb/test/default.img' -> '/tmp/autopkgtest.UU4tI9/tree/build-deb/test/TEST-50-DISSECT/../dissect.img'
Reusing existing cached image /tmp/autopkgtest.UU4tI9/tree/build-deb/test/TEST-50-DISSECT/../dissect.img → /tmp/autopkgtest.UU4tI9/tree/build-d
eb/test/dissect.img
'/tmp/autopkgtest.UU4tI9/tree/build-deb/test/dissect.img' -> '/var/tmp/systemd-test.QLh1MN/dissect.img'
I: Possible missing firmware "qat_c62x_mmp.bin" for kernel module "qat_c62x.ko"
I: Possible missing firmware "qat_c62x.bin" for kernel module "qat_c62x.ko"
I: Possible missing firmware "qat_895xcc_mmp.bin" for kernel module "qat_dh895xcc.ko"
I: Possible missing firmware "qat_895xcc.bin" for kernel module "qat_dh895xcc.ko"
I: Possible missing firmware "qat_c3xxx_mmp.bin" for kernel module "qat_c3xxx.ko"
I: Possible missing firmware "qat_c3xxx.bin" for kernel module "qat_c3xxx.ko"
I: Possible missing firmware "cxgb4/t6fw.bin" for kernel module "cxgb4.ko"
I: Possible missing firmware "cxgb4/t5fw.bin" for kernel module "cxgb4.ko"
I: Possible missing firmware "cxgb4/t4fw.bin" for kernel module "cxgb4.ko"
awk: line 1: syntax error at or near ,
make: *** [Makefile:2: setup] Error 2
make: Leaving directory '/tmp/autopkgtest.UU4tI9/tree/test/TEST-50-DISSECT'
--x-- Result of TEST-50-DISSECT: 2 --x--

This comes from awk 'match($0, /PROGRAM==?"([^ "]+)/, m) { print m[1]; }' "$rule" | while read -r prog; do

which was last touched by 1b8fcd9

@mrc0mmand ^

Running TEST-50-DISSECT with set -x

+ ddebug 'Installing /lib/udev/rules.d/55-dm.rules'
+ dlog 5 'Installing /lib/udev/rules.d/55-dm.rules'
+ local lvl lvlc
+ '[' -z 4 ']'
+ lvl=5
+ shift
+ '[' 5 -le 4 ']'
+ return 0
+ cp --sparse=always -pfL /lib/udev/rules.d/55-dm.rules /var/tmp/systemd-test.5Zf4hR/root//lib/udev/rules.d/55-dm.rules
+ inst_rule_programs /lib/udev/rules.d/55-dm.rules
+ local rule=/lib/udev/rules.d/55-dm.rules
+ local prog bin
+ read -r prog
+ awk 'match($0, /PROGRAM==?"([^ "]+)/, m) { print m[1]; }' /lib/udev/rules.d/55-dm.rules
awk: line 1: syntax error at or near ,
+ cleanup_loopdev
+ '[' -n /dev/loop2 ']'
+ ddebug 'losetup -d /dev/loop2'
+ dlog 5 'losetup -d /dev/loop2'
+ local lvl lvlc
+ '[' -z 4 ']'
+ lvl=5
+ shift
+ '[' 5 -le 4 ']'
+ return 0
+ losetup -d /dev/loop2
+ unset LOOPDEV
make: *** [Makefile:2: setup] Error 2
mawk 1.3.4 20200120
random-funcs:       srandom/random
regex-funcs:        internal
compiled limits:
sprintf buffer      8192
maximum-integer     2147483647

Seems to be a gawk/mawk incompatibility.
Is gawk a hard dependency now?

mawk 1.3.4 20200120 random-funcs: srandom/random regex-funcs: internal compiled limits: sprintf buffer 8192 maximum-integer 2147483647

Seems to be a gawk/mawk incompatibility.
Is gawk a hard dependency now?

This is definitely an oversight from my side - so far I've been trying to keep the whole test/ part of systemd mawk-compatible, this one slipped my radar somehow. Right now I'm away from my computer, but I'll prep a patch later this afternoon when I get back.

The three-argument match() is a GNU AWK extension, thus breaking the
compatibility with mawk (used on Ubuntu/Debian, for example). Let's
replace it with a (hopefully) more portable sed expression to drop the
inadvertently introduced gawk dependency.
Fixes: systemd#19957

should we force the CI testbed to install mawk to avoid missing these?

Hm, I think mawk is by default installed (given its priority). The problem is, that once gawk is installed, it will take precedence over mawk as it has a higher alternatives priority.
So, we'd rather have to make sure that gawk is not installed then ensuring that mawk is installed.

link best version is /usr/bin/gawk link currently points to /usr/bin/gawk link awk is /usr/bin/awk slave awk.1.gz is /usr/share/man/man1/awk.1.gz slave nawk is /usr/bin/nawk slave nawk.1.gz is /usr/share/man/man1/nawk.1.gz /usr/bin/gawk - priority 10 slave awk.1.gz: /usr/share/man/man1/gawk.1.gz slave nawk: /usr/bin/gawk slave nawk.1.gz: /usr/share/man/man1/gawk.1.gz /usr/bin/mawk - priority 5 slave awk.1.gz: /usr/share/man/man1/mawk.1.gz slave nawk: /usr/bin/mawk slave nawk.1.gz: /usr/share/man/man1/mawk.1.gz

There is also this:

$ grep gawk -R
tools/check-directives.sh:command -v gawk &>/dev/null || exit 77
tools/check-directives.sh:    gawk -v sec_rx="${2:-""}" -v unit_type="${3:-""}" '

fwiw, I have no problem, if gawk becomes a build / test dependency. I just need to know in which direction this is going (keep mawk compatability or not)

The bit in check-directives.sh was originally written in perl, so I could rewrite it back if needed (I chose (g)awk during the latest rewrite just because I have more experience with it). Anyway, I don't have a strong opinion whether we should go with gawk as a test dep or not as there's usually at least one other way how to reasonably do the thing. But I guess fewer dependencies is usually better?

But I guess fewer dependencies is usually better?

I agree. But I'm less worried when it comes to build dependencies (unless they have a huge dependency chain).
If gawk makes your life easier / the code better maintainable, then use it.

But I guess fewer dependencies is usually better?

I agree. But I'm less worried when it comes to build dependencies (unless they have a huge dependency chain).
If gawk makes your life easier / the code better maintainable, then use it.

Sweet, in that case I'd definitely go with gawk (thus leaving https://salsa.debian.org/systemd-team/systemd/-/commit/1ff411aec1e1feaa1f1ff628eca276a2a617131a in place). As for #19961 - I don't really mind if it gets merged, since it does the same thing in the ~same amount of code.

Just to satisfy my own curiosity I tried to rewrite the gawk blob in check-directives.sh in perl and it (surprisingly to me) looks about the same[0], so dropping gawk completely is still quite easy.

Anyway, thanks!

diff --git a/tools/check-directives.sh b/tools/check-directives.sh
index 0661da4d3b..db99cb3290 100755
--- a/tools/check-directives.sh
+++ b/tools/check-directives.sh
@@ -6,29 +6,28 @@ set -o pipefail
 SOURCE_ROOT="${1:?Missing argument: project source root}"
 BUILD_ROOT="${2:?Missing argument: project build root}"
-command -v gawk &>/dev/null || exit 77
+command -v perl &>/dev/null || exit 77
 function generate_directives() {
-    gawk -v sec_rx="${2:-""}" -v unit_type="${3:-""}" '
-    match($0, /^([^ \t\.]+)\.([^ \t\.,]+)/, m) {
-        # res[section][directive] = 1
-        res[m[1]][m[2]] = 1;
+    perl -w -asF'/[\s,]+/' -ne '
+    if (my ($section, $directive) = ($F[0] =~ /^([^ \t\.]+)\.([^ \t\.,]+)/)) {
+        $res{$section}{$directive} = 1;
     END {
-        if (unit_type)
-            print unit_type
+        if ($unit_type) {
+            print "$unit_type\n";
-        for (section in res) {
-            if (sec_rx && section !~ sec_rx)
-                continue
+        foreach $section (keys %res) {
+            next unless $section =~ $sec_rx;
-            print "[" section "]";
-            for (directive in res[section]) {
-                print directive "=";
+            printf "[%s]\n", $section;
+            for $directive (keys %{$res{$section}}) {
+                printf "%s=\n", $directive;
-    ' "$1"
+    ' <"$1" -- -sec_rx="${2:-""}" -unit_type="${3:-""}"
 ret=0
The three-argument match() is a GNU AWK extension, thus breaking the
compatibility with mawk (used on Ubuntu/Debian, for example). Let's
replace it with a (hopefully) more portable sed expression to drop the
inadvertently introduced gawk dependency.
Fixes: #19957