diff --git a/.dir-locals.el b/.dir-locals.el index 815afe172a1..fde58d65bdd 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -20,8 +20,8 @@ (nxml-mode . ((nxml-child-indent . 2) (fill-column . 109))) (meson-mode . ((meson-indent-basic . 8))) - (sh-mode . ((sh-basic-offset . 8) - (sh-indentation . 8))) + (sh-mode . ((sh-basic-offset . 4) + (sh-indentation . 4))) (awk-mode . ((c-basic-offset . 8))) (nil . ((indent-tabs-mode . nil) (tab-width . 8) diff --git a/.editorconfig b/.editorconfig index 67d848b68d1..63b1d749cb1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,6 +19,10 @@ charset = utf-8 indent_style = space indent_size = 8 +[*.sh] +indent_style = space +indent_size = 4 + [meson.build] indent_style = space indent_size = 8 diff --git a/.vimrc b/.vimrc index a62546d8e2a..d40b57a665f 100644 --- a/.vimrc +++ b/.vimrc @@ -17,4 +17,5 @@ set expandtab set makeprg=GCC_COLORS=\ make set tw=79 au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab +au FileType sh set tw=80 shiftwidth=4 smarttab au FileType c set tw=109 diff --git a/coccinelle/run-coccinelle.sh b/coccinelle/run-coccinelle.sh index 22ab66d3dd5..520de0ac421 100755 --- a/coccinelle/run-coccinelle.sh +++ b/coccinelle/run-coccinelle.sh @@ -5,23 +5,23 @@ files="$(git ls-files ':/*.[ch]')" args= case "$1" in - -i) - args="$args --in-place" - shift - ;; + -i) + args="$args --in-place" + shift + ;; esac if ! parallel -h >/dev/null; then - echo 'Please install GNU parallel (package "parallel")' - exit 1 + echo 'Please install GNU parallel (package "parallel")' + exit 1 fi for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do - echo "--x-- Processing $SCRIPT --x--" - TMPFILE=`mktemp` - echo "+ spatch --sp-file $SCRIPT $args ..." - parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \ - spatch --sp-file $SCRIPT $args ::: $files \ - 2>"$TMPFILE" || cat "$TMPFILE" - echo -e "--x-- Processed $SCRIPT --x--\n" + echo "--x-- Processing $SCRIPT --x--" + TMPFILE=`mktemp` + echo "+ spatch --sp-file $SCRIPT $args ..." + parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \ + spatch --sp-file $SCRIPT $args ::: $files \ + 2>"$TMPFILE" || cat "$TMPFILE" + echo -e "--x-- Processed $SCRIPT --x--\n" done diff --git a/man/50-xdg-data-dirs.sh b/man/50-xdg-data-dirs.sh index 073174cb401..89e9fbb599b 100755 --- a/man/50-xdg-data-dirs.sh +++ b/man/50-xdg-data-dirs.sh @@ -5,7 +5,7 @@ XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share}" # add a directory if it exists if [[ -d /opt/foo/share ]]; then - XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS} + XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS} fi # write our output diff --git a/semaphoreci/gcc-compilation.sh b/semaphoreci/gcc-compilation.sh index 8755b850b60..ef499b8a356 100755 --- a/semaphoreci/gcc-compilation.sh +++ b/semaphoreci/gcc-compilation.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -ex # keep this in sync with setup.sh @@ -40,4 +39,9 @@ dpkg-buildpackage -S -I -I$(basename "$SEMAPHORE_CACHE_DIR") -d -us -uc -nc # now build the package and run the tests rm -rf "$ARTIFACTS_DIR" # autopkgtest exits with 2 for "some tests skipped", accept that -$AUTOPKGTESTDIR/runner/autopkgtest --apt-upgrade --env DEB_BUILD_OPTIONS=noudeb --env TEST_UPSTREAM=1 ../systemd_*.dsc -o "$ARTIFACTS_DIR" -- lxc -s $CONTAINER || [ $? -eq 2 ] +$AUTOPKGTESTDIR/runner/autopkgtest --apt-upgrade \ + --env DEB_BUILD_OPTIONS=noudeb \ + --env TEST_UPSTREAM=1 ../systemd_*.dsc \ + -o "$ARTIFACTS_DIR" \ + -- lxc -s $CONTAINER \ + || [ $? -eq 2 ] diff --git a/semaphoreci/setup.sh b/semaphoreci/setup.sh index c904a300a15..c39238a4e99 100755 --- a/semaphoreci/setup.sh +++ b/semaphoreci/setup.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -ex # default to Debian testing diff --git a/src/basic/generate-af-list.sh b/src/basic/generate-af-list.sh index 5bf244c49d1..6987877ebfd 100755 --- a/src/basic/generate-af-list.sh +++ b/src/basic/generate-af-list.sh @@ -2,5 +2,5 @@ set -eu $1 -E -dM -include sys/socket.h -include "$2" -include "$3" - = 7\n\ _Pragma(\"GCC diagnostic ignored \\\"-Wimplicit-fallthrough\\\"\")\n\ #endif\n\ %}" - print "struct key_name { const char* name; unsigned short id; };" - print "%null-strings" - print "%%" - } + print "struct key_name { const char* name; unsigned short id; };" + print "%null-strings" + print "%%" + } - /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 } - { print tolower($1) ", " $1 } + /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 } + { print tolower($1) ", " $1 } ' < "$1" diff --git a/src/udev/generate-keyboard-keys-list.sh b/src/udev/generate-keyboard-keys-list.sh index c055f7c7567..aa00c15c167 100755 --- a/src/udev/generate-keyboard-keys-list.sh +++ b/src/udev/generate-keyboard-keys-list.sh @@ -2,6 +2,6 @@ set -eu $1 -dM -include linux/input.h - / { next } - /^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/ { print $2 } + /\<(KEY_(MAX|MIN_INTERESTING))|(BTN_(MISC|MOUSE|JOYSTICK|GAMEPAD|DIGI|WHEEL|TRIGGER_HAPPY))\>/ { next } + /^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/ { print $2 } ' diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 1c64017aaa0..2314ec37ce5 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Basic systemd setup" RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes} diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh index 97eb2f409e8..aed1c591069 100755 --- a/test/TEST-02-CRYPTSETUP/test.sh +++ b/test/TEST-02-CRYPTSETUP/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="cryptsetup systemd setup" TEST_NO_NSPAWN=1 diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh index 93a387df596..89125109d89 100755 --- a/test/TEST-03-JOBS/test.sh +++ b/test/TEST-03-JOBS/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Job-related tests" TEST_NO_QEMU=1 diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh index e198cb6ede0..4e539aa151d 100755 --- a/test/TEST-04-JOURNAL/test-journal.sh +++ b/test/TEST-04-JOURNAL/test-journal.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -x set -e set -o pipefail diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh index 33bfcbf681a..f24a8f6be7a 100755 --- a/test/TEST-04-JOURNAL/test.sh +++ b/test/TEST-04-JOURNAL/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Journal-related tests" diff --git a/test/TEST-05-RLIMITS/test-rlimits.sh b/test/TEST-05-RLIMITS/test-rlimits.sh index ba665c59689..b4d79c9655c 100755 --- a/test/TEST-05-RLIMITS/test-rlimits.sh +++ b/test/TEST-05-RLIMITS/test-rlimits.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -x set -e set -o pipefail diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh index 3eb21657968..3c29b2ee3fe 100755 --- a/test/TEST-05-RLIMITS/test.sh +++ b/test/TEST-05-RLIMITS/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Resource limits-related tests" diff --git a/test/TEST-06-SELINUX/test-selinux-checks.sh b/test/TEST-06-SELINUX/test-selinux-checks.sh index 153fab3aacb..dae48cd4b2f 100755 --- a/test/TEST-06-SELINUX/test-selinux-checks.sh +++ b/test/TEST-06-SELINUX/test-selinux-checks.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -x set -e set -o pipefail diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh index 0c924ecbbdd..2b49b3d5ae3 100755 --- a/test/TEST-06-SELINUX/test.sh +++ b/test/TEST-06-SELINUX/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="SELinux tests" TEST_NO_NSPAWN=1 diff --git a/test/TEST-07-ISSUE-1981/test-segfault.sh b/test/TEST-07-ISSUE-1981/test-segfault.sh index 48f05d89fbb..82339c23cda 100755 --- a/test/TEST-07-ISSUE-1981/test-segfault.sh +++ b/test/TEST-07-ISSUE-1981/test-segfault.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -x set -e diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh index 499a36038c6..93ddb6f5fbb 100755 --- a/test/TEST-07-ISSUE-1981/test.sh +++ b/test/TEST-07-ISSUE-1981/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981" TEST_NO_QEMU=1 diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh index b01df3656b7..ef2aba0e17e 100755 --- a/test/TEST-08-ISSUE-2730/test.sh +++ b/test/TEST-08-ISSUE-2730/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730" TEST_NO_NSPAWN=1 diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh index 01eb4dbac89..8e7402fcd46 100755 --- a/test/TEST-09-ISSUE-2691/test.sh +++ b/test/TEST-09-ISSUE-2691/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2691" TEST_NO_NSPAWN=1 diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh index c85433d7d33..dc7a9acaa10 100755 --- a/test/TEST-10-ISSUE-2467/test.sh +++ b/test/TEST-10-ISSUE-2467/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467" diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh index 38c725fa704..3419b78fe79 100755 --- a/test/TEST-11-ISSUE-3166/test.sh +++ b/test/TEST-11-ISSUE-3166/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3166" TEST_NO_NSPAWN=1 diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh index 0c267e11a6c..31cf1b471ae 100755 --- a/test/TEST-12-ISSUE-3171/test.sh +++ b/test/TEST-12-ISSUE-3171/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3171" TEST_NO_QEMU=1 diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh index 774b7cbed5d..bd85b92caa5 100755 --- a/test/TEST-13-NSPAWN-SMOKE/test.sh +++ b/test/TEST-13-NSPAWN-SMOKE/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="systemd-nspawn smoke test" TEST_NO_NSPAWN=1 diff --git a/test/TEST-14-MACHINE-ID/test.sh b/test/TEST-14-MACHINE-ID/test.sh index 94358342047..33e311a1e7e 100755 --- a/test/TEST-14-MACHINE-ID/test.sh +++ b/test/TEST-14-MACHINE-ID/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="/etc/machine-id testing" TEST_NO_NSPAWN=1 diff --git a/test/TEST-15-DROPIN/test-dropin.sh b/test/TEST-15-DROPIN/test-dropin.sh index ab0a58caeac..02962a8a070 100755 --- a/test/TEST-15-DROPIN/test-dropin.sh +++ b/test/TEST-15-DROPIN/test-dropin.sh @@ -1,279 +1,278 @@ #! /bin/bash - set -e set -x _clear_service () { - systemctl stop $1.service 2>/dev/null || : - rm -f /{etc,run,usr/lib}/systemd/system/$1.service - rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d - rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires} + systemctl stop $1.service 2>/dev/null || : + rm -f /{etc,run,usr/lib}/systemd/system/$1.service + rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d + rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires} } clear_services () { - for u in $*; do - _clear_service $u - done - systemctl daemon-reload + for u in $*; do + _clear_service $u + done + systemctl daemon-reload } create_service () { - clear_services $1 + clear_services $1 - cat >/etc/systemd/system/$1.service</etc/systemd/system/$1.service</usr/lib/systemd/system/a.service.d/override.conf </usr/lib/systemd/system/a.service.d/override.conf </usr/lib/systemd/system/a.service.d/wants-b.conf</usr/lib/systemd/system/a.service.d/wants-b.conf<&2 + echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroup v2" >&2 fi echo OK > /testok diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh index 4ec80814780..bf80e8b5844 100755 --- a/test/TEST-20-MAINPIDGAMES/test.sh +++ b/test/TEST-20-MAINPIDGAMES/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="test changing main PID" diff --git a/test/TEST-20-MAINPIDGAMES/testsuite.sh b/test/TEST-20-MAINPIDGAMES/testsuite.sh index b183ec9a6b0..9471a5d7342 100755 --- a/test/TEST-20-MAINPIDGAMES/testsuite.sh +++ b/test/TEST-20-MAINPIDGAMES/testsuite.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -ex set -o pipefail diff --git a/test/TEST-21-SYSUSERS/test.sh b/test/TEST-21-SYSUSERS/test.sh index b1049e720d2..9f64e030b57 100755 --- a/test/TEST-21-SYSUSERS/test.sh +++ b/test/TEST-21-SYSUSERS/test.sh @@ -1,21 +1,19 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Sysuser-related tests" . $TEST_BASE_DIR/test-functions test_setup() { - mkdir -p $TESTDIR/etc/sysusers.d $TESTDIR/usr/lib/sysusers.d $TESTDIR/tmp + mkdir -p $TESTDIR/etc/sysusers.d $TESTDIR/usr/lib/sysusers.d $TESTDIR/tmp } prepare_testdir() { - rm -f $TESTDIR/etc/*{passwd,group,shadow} - for i in $1.initial-{passwd,group,shadow}; do - test -f $i && cp $i $TESTDIR/etc/${i#*.initial-} - done - return 0 + rm -f $TESTDIR/etc/*{passwd,group,shadow} + for i in $1.initial-{passwd,group,shadow}; do + test -f $i && cp $i $TESTDIR/etc/${i#*.initial-} + done + return 0 } preprocess() { @@ -30,92 +28,92 @@ preprocess() { compare() { if ! diff -u $TESTDIR/etc/passwd <(preprocess ${1%.*}.expected-passwd); then - echo "**** Unexpected output for $f" - exit 1 + echo "**** Unexpected output for $f" + exit 1 fi if ! diff -u $TESTDIR/etc/group <(preprocess ${1%.*}.expected-group); then - echo "**** Unexpected output for $f $2" - exit 1 + echo "**** Unexpected output for $f $2" + exit 1 fi } test_run() { - # ensure our build of systemd-sysusers is run - PATH=${BUILD_DIR}:$PATH + # ensure our build of systemd-sysusers is run + PATH=${BUILD_DIR}:$PATH - rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/* + rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/* - # happy tests - for f in test-*.input; do - echo "*** Running $f" - prepare_testdir ${f%.input} - cp $f $TESTDIR/usr/lib/sysusers.d/test.conf - systemd-sysusers --root=$TESTDIR + # happy tests + for f in test-*.input; do + echo "*** Running $f" + prepare_testdir ${f%.input} + cp $f $TESTDIR/usr/lib/sysusers.d/test.conf + systemd-sysusers --root=$TESTDIR - compare $f "" - done + compare $f "" + done - for f in test-*.input; do - echo "*** Running $f on stdin" - prepare_testdir ${f%.input} - touch $TESTDIR/etc/sysusers.d/test.conf - cat $f | systemd-sysusers --root=$TESTDIR - + for f in test-*.input; do + echo "*** Running $f on stdin" + prepare_testdir ${f%.input} + touch $TESTDIR/etc/sysusers.d/test.conf + cat $f | systemd-sysusers --root=$TESTDIR - - compare $f "on stdin" - done + compare $f "on stdin" + done - for f in test-*.input; do - echo "*** Running $f on stdin with --replace" - prepare_testdir ${f%.input} - touch $TESTDIR/etc/sysusers.d/test.conf - # this overrides test.conf which is masked on disk - cat $f | systemd-sysusers --root=$TESTDIR --replace=/etc/sysusers.d/test.conf - - # this should be ignored - cat test-1.input | systemd-sysusers --root=$TESTDIR --replace=/usr/lib/sysusers.d/test.conf - + for f in test-*.input; do + echo "*** Running $f on stdin with --replace" + prepare_testdir ${f%.input} + touch $TESTDIR/etc/sysusers.d/test.conf + # this overrides test.conf which is masked on disk + cat $f | systemd-sysusers --root=$TESTDIR --replace=/etc/sysusers.d/test.conf - + # this should be ignored + cat test-1.input | systemd-sysusers --root=$TESTDIR --replace=/usr/lib/sysusers.d/test.conf - - compare $f "on stdin with --replace" - done + compare $f "on stdin with --replace" + done - # test --inline - echo "*** Testing --inline" - prepare_testdir - # copy a random file to make sure it is ignored - cp $f $TESTDIR/etc/sysusers.d/confuse.conf - systemd-sysusers --root=$TESTDIR --inline \ - "u u1 222 - - /bin/zsh" \ - "g g1 111" + # test --inline + echo "*** Testing --inline" + prepare_testdir + # copy a random file to make sure it is ignored + cp $f $TESTDIR/etc/sysusers.d/confuse.conf + systemd-sysusers --root=$TESTDIR --inline \ + "u u1 222 - - /bin/zsh" \ + "g g1 111" - compare inline "(--inline)" + compare inline "(--inline)" - # test --replace - echo "*** Testing --inline with --replace" - prepare_testdir - # copy a random file to make sure it is ignored - cp $f $TESTDIR/etc/sysusers.d/confuse.conf - systemd-sysusers --root=$TESTDIR \ - --inline \ - --replace=/etc/sysusers.d/confuse.conf \ - "u u1 222 - - /bin/zsh" \ - "g g1 111" + # test --replace + echo "*** Testing --inline with --replace" + prepare_testdir + # copy a random file to make sure it is ignored + cp $f $TESTDIR/etc/sysusers.d/confuse.conf + systemd-sysusers --root=$TESTDIR \ + --inline \ + --replace=/etc/sysusers.d/confuse.conf \ + "u u1 222 - - /bin/zsh" \ + "g g1 111" - compare inline "(--inline --replace=…)" + compare inline "(--inline --replace=…)" - rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/* + rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/* - # tests for error conditions - for f in unhappy-*.input; do - echo "*** Running test $f" - prepare_testdir ${f%.input} - cp $f $TESTDIR/usr/lib/sysusers.d/test.conf - systemd-sysusers --root=$TESTDIR 2> /dev/null - journalctl -t systemd-sysusers -o cat | tail -n1 > $TESTDIR/tmp/err - if ! diff -u $TESTDIR/tmp/err ${f%.*}.expected-err; then - echo "**** Unexpected error output for $f" - cat $TESTDIR/tmp/err - exit 1 - fi - done + # tests for error conditions + for f in unhappy-*.input; do + echo "*** Running test $f" + prepare_testdir ${f%.input} + cp $f $TESTDIR/usr/lib/sysusers.d/test.conf + systemd-sysusers --root=$TESTDIR 2> /dev/null + journalctl -t systemd-sysusers -o cat | tail -n1 > $TESTDIR/tmp/err + if ! diff -u $TESTDIR/tmp/err ${f%.*}.expected-err; then + echo "**** Unexpected error output for $f" + cat $TESTDIR/tmp/err + exit 1 + fi + done } do_test "$@" diff --git a/test/TEST-22-TMPFILES/test.sh b/test/TEST-22-TMPFILES/test.sh index 13e191bd92a..5c509f63fb8 100755 --- a/test/TEST-22-TMPFILES/test.sh +++ b/test/TEST-22-TMPFILES/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Tmpfiles related tests" TEST_NO_QEMU=1 diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh index 2e76451f5b2..6ed22be3664 100755 --- a/test/TEST-23-TYPE-EXEC/test.sh +++ b/test/TEST-23-TYPE-EXEC/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="test Type=exec" diff --git a/test/TEST-23-TYPE-EXEC/testsuite.sh b/test/TEST-23-TYPE-EXEC/testsuite.sh index 4f7cc44310f..b161d97a7c5 100755 --- a/test/TEST-23-TYPE-EXEC/testsuite.sh +++ b/test/TEST-23-TYPE-EXEC/testsuite.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -ex set -o pipefail diff --git a/test/TEST-24-UNIT-TESTS/test.sh b/test/TEST-24-UNIT-TESTS/test.sh index fc8c89fe0ae..038303edf8f 100755 --- a/test/TEST-24-UNIT-TESTS/test.sh +++ b/test/TEST-24-UNIT-TESTS/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="Run unit tests under containers" RUN_IN_UNPRIVILEGED_CONTAINER=yes diff --git a/test/TEST-24-UNIT-TESTS/testsuite.sh b/test/TEST-24-UNIT-TESTS/testsuite.sh index 7c7a0685562..e33d04d043b 100755 --- a/test/TEST-24-UNIT-TESTS/testsuite.sh +++ b/test/TEST-24-UNIT-TESTS/testsuite.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh #set -ex #set -o pipefail diff --git a/test/TEST-25-IMPORT/test.sh b/test/TEST-25-IMPORT/test.sh index 188e7233bbf..7fe367c3be6 100755 --- a/test/TEST-25-IMPORT/test.sh +++ b/test/TEST-25-IMPORT/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="test importd" diff --git a/test/TEST-25-IMPORT/testsuite.sh b/test/TEST-25-IMPORT/testsuite.sh index 2bb96f137df..380ba3d82de 100755 --- a/test/TEST-25-IMPORT/testsuite.sh +++ b/test/TEST-25-IMPORT/testsuite.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -ex set -o pipefail diff --git a/test/TEST-26-SETENV/test.sh b/test/TEST-26-SETENV/test.sh index fb9c18926fa..9a2913d330c 100755 --- a/test/TEST-26-SETENV/test.sh +++ b/test/TEST-26-SETENV/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="test setenv" diff --git a/test/TEST-26-SETENV/testsuite.sh b/test/TEST-26-SETENV/testsuite.sh index 2d93cb49c98..0abbf953265 100755 --- a/test/TEST-26-SETENV/testsuite.sh +++ b/test/TEST-26-SETENV/testsuite.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -ex set -o pipefail diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh index 724dbef2319..fb35f80ec1a 100755 --- a/test/TEST-27-STDOUTFILE/test.sh +++ b/test/TEST-27-STDOUTFILE/test.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -e TEST_DESCRIPTION="test StandardOutput=file:" diff --git a/test/TEST-27-STDOUTFILE/testsuite.sh b/test/TEST-27-STDOUTFILE/testsuite.sh index 6975b7966f2..2c813da720e 100755 --- a/test/TEST-27-STDOUTFILE/testsuite.sh +++ b/test/TEST-27-STDOUTFILE/testsuite.sh @@ -1,13 +1,15 @@ #!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh set -ex set -o pipefail systemd-analyze log-level debug systemd-analyze log-target console -systemd-run --wait --unit=one -p StandardOutput=file:/tmp/stdout -p StandardError=file:/tmp/stderr -p Type=exec sh -c 'echo x ; echo y >&2' +systemd-run --wait --unit=one \ + -p StandardOutput=file:/tmp/stdout \ + -p StandardError=file:/tmp/stderr \ + -p Type=exec \ + sh -c 'echo x ; echo y >&2' cmp /tmp/stdout <&2' +systemd-run --wait --unit=two \ + -p StandardOutput=file:/tmp/stdout \ + -p StandardError=file:/tmp/stderr \ + -p Type=exec \ + sh -c 'echo z ; echo a >&2' cmp /tmp/stdout <&2' +systemd-run --wait --unit=three \ + -p StandardOutput=append:/tmp/stdout \ + -p StandardError=append:/tmp/stderr \ + -p Type=exec \ + sh -c 'echo b ; echo c >&2' cmp /tmp/stdout <mnt/cmdline.txt objcopy \ - --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \ - --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \ - --add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \ - --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \ - --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \ - "$boot_stub" mnt/EFI/Linux/linux-test.efi + --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \ + --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \ + --add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \ + --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \ + --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \ + "$boot_stub" mnt/EFI/Linux/linux-test.efi # install entries mkdir -p mnt/loader/entries diff --git a/test/test-functions b/test/test-functions index 6016fd21ace..50c6e969025 100644 --- a/test/test-functions +++ b/test/test-functions @@ -159,15 +159,15 @@ run_qemu() { exit 1 fi -if [[ "$LOOKS_LIKE_SUSE" ]]; then - PARAMS+="rd.hostonly=0" -elif [[ "$LOOKS_LIKE_ARCH" ]]; then - PARAMS+="rw" -else - PARAMS+="ro" -fi + if [[ "$LOOKS_LIKE_SUSE" ]]; then + PARAMS+="rd.hostonly=0" + elif [[ "$LOOKS_LIKE_ARCH" ]]; then + PARAMS+="rw" + else + PARAMS+="ro" + fi -KERNEL_APPEND="$PARAMS \ + KERNEL_APPEND="$PARAMS \ root=/dev/sda1 \ raid=noautodetect \ loglevel=2 \ @@ -1639,7 +1639,7 @@ do_test() { exit 0 fi -# Detect lib paths + # Detect lib paths [[ $libdir ]] || for libdir in /lib64 /lib; do [[ -d $libdir ]] && libdirs+=" $libdir" && break done diff --git a/tools/add-git-hook.sh b/tools/add-git-hook.sh index c1db99b18af..5b1bf17219e 100755 --- a/tools/add-git-hook.sh +++ b/tools/add-git-hook.sh @@ -4,7 +4,7 @@ set -eu cd "$MESON_SOURCE_ROOT" if [ ! -f .git/hooks/pre-commit.sample -o -f .git/hooks/pre-commit ]; then - exit 2 # not needed + exit 2 # not needed fi cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit diff --git a/tools/check-directives.sh b/tools/check-directives.sh index 99f8f9d4519..e8c6e600407 100755 --- a/tools/check-directives.sh +++ b/tools/check-directives.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -e function generate_directives() { @@ -12,18 +11,18 @@ function generate_directives() { ret=0 if [[ $(generate_directives src/network/networkd-network-gperf.gperf | wc -l) -ne $(wc -l &2 - exit 2 - fi - found="$c" + if [ -n "$found" ]; then + echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2 + exit 2 + fi + found="$c" done if [ -z "$found" ]; then - echo 'Specify build directory with $BUILD_DIR' >&2 - exit 1 + echo 'Specify build directory with $BUILD_DIR' >&2 + exit 1 fi echo "$(realpath $found)" diff --git a/tools/find-double-newline.sh b/tools/find-double-newline.sh index 6a6790b4b2a..51204eb7c90 100755 --- a/tools/find-double-newline.sh +++ b/tools/find-double-newline.sh @@ -4,39 +4,38 @@ TOP=`git rev-parse --show-toplevel` case "$1" in + recdiff) + if [ "$2" = "" ] ; then + DIR="$TOP" + else + DIR="$2" + fi - recdiff) - if [ "$2" = "" ] ; then - DIR="$TOP" - else - DIR="$2" - fi + find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \; + ;; - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \; - ;; + recpatch) + if [ "$2" = "" ] ; then + DIR="$TOP" + else + DIR="$2" + fi - recpatch) - if [ "$2" = "" ] ; then - DIR="$TOP" - else - DIR="$2" - fi + find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \; + ;; - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \; - ;; + diff) + T=`mktemp` + sed '/^$/N;/^\n$/D' < "$2" > "$T" + diff -u "$2" "$T" + rm -f "$T" + ;; - diff) - T=`mktemp` - sed '/^$/N;/^\n$/D' < "$2" > "$T" - diff -u "$2" "$T" - rm -f "$T" - ;; + patch) + sed -i '/^$/N;/^\n$/D' "$2" + ;; - patch) - sed -i '/^$/N;/^\n$/D' "$2" - ;; - - *) - echo "Expected recdiff|recpatch|diff|patch as verb." >&2 - ;; + *) + echo "Expected recdiff|recpatch|diff|patch as verb." >&2 + ;; esac diff --git a/tools/find-tabs.sh b/tools/find-tabs.sh index e32eac8f329..95249f9c9cd 100755 --- a/tools/find-tabs.sh +++ b/tools/find-tabs.sh @@ -4,39 +4,38 @@ TOP=`git rev-parse --show-toplevel` case "$1" in + recdiff) + if [ "$2" = "" ] ; then + DIR="$TOP" + else + DIR="$2" + fi - recdiff) - if [ "$2" = "" ] ; then - DIR="$TOP" - else - DIR="$2" - fi + find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \; + ;; - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \; - ;; + recpatch) + if [ "$2" = "" ] ; then + DIR="$TOP" + else + DIR="$2" + fi - recpatch) - if [ "$2" = "" ] ; then - DIR="$TOP" - else - DIR="$2" - fi + find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \; + ;; - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \; - ;; + diff) + T=`mktemp` + sed 's/\t/ /g' < "$2" > "$T" + diff -u "$2" "$T" + rm -f "$T" + ;; - diff) - T=`mktemp` - sed 's/\t/ /g' < "$2" > "$T" - diff -u "$2" "$T" - rm -f "$T" - ;; + patch) + sed -i 's/\t/ /g' "$2" + ;; - patch) - sed -i 's/\t/ /g' "$2" - ;; - - *) - echo "Expected recdiff|recpatch|diff|patch as verb." >&2 - ;; + *) + echo "Expected recdiff|recpatch|diff|patch as verb." >&2 + ;; esac diff --git a/tools/meson-apply-m4.sh b/tools/meson-apply-m4.sh index 6abe177ac51..5fad8cd94fc 100755 --- a/tools/meson-apply-m4.sh +++ b/tools/meson-apply-m4.sh @@ -5,18 +5,18 @@ CONFIG=$1 TARGET=$2 if [ $# -ne 2 ]; then - echo 'Invalid number of arguments.' - exit 1 + echo 'Invalid number of arguments.' + exit 1 fi if [ ! -f $CONFIG ]; then - echo "$CONFIG not found." - exit 2 + echo "$CONFIG not found." + exit 2 fi if [ ! -f $TARGET ]; then - echo "$TARGET not found." - exit 3 + echo "$TARGET not found." + exit 3 fi DEFINES=$(awk '$1 == "#define" && $3 == "1" { printf "-D%s ", $2 }' $CONFIG) diff --git a/tools/meson-check-api-docs.sh b/tools/meson-check-api-docs.sh index a654368f9e4..bd320562adc 100755 --- a/tools/meson-check-api-docs.sh +++ b/tools/meson-check-api-docs.sh @@ -1,5 +1,4 @@ #!/bin/sh - set -eu sd_good=0 @@ -8,27 +7,27 @@ udev_good=0 udev_total=0 for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | sort -u` ; do - if test -f ${MESON_BUILD_ROOT}/man/$symbol.3 ; then - echo "✓ Symbol $symbol() is documented." - good=1 - else - printf " \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m\n" - good=0 - fi + if test -f ${MESON_BUILD_ROOT}/man/$symbol.3 ; then + echo "✓ Symbol $symbol() is documented." + good=1 + else + printf " \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m\n" + good=0 + fi - case $symbol in - sd_*) - ((sd_good+=good)) - ((sd_total+=1)) - ;; - udev_*) - ((udev_good+=good)) - ((udev_total+=1)) - ;; - *) - echo 'unknown symbol prefix' - exit 1 - esac + case $symbol in + sd_*) + ((sd_good+=good)) + ((sd_total+=1)) + ;; + udev_*) + ((udev_good+=good)) + ((udev_total+=1)) + ;; + *) + echo 'unknown symbol prefix' + exit 1 + esac done echo "libsystemd: $sd_good/$sd_total libudev: $udev_good/$udev_total" diff --git a/tools/meson-check-help.sh b/tools/meson-check-help.sh index 69157105f29..a0e304ca9c8 100755 --- a/tools/meson-check-help.sh +++ b/tools/meson-check-help.sh @@ -5,19 +5,19 @@ export SYSTEMD_LOG_LEVEL=info # output width if "$1" --help | grep -v 'default:' | grep -E -q '.{80}.'; then - echo "$(basename "$1") --help output is too wide:" - "$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}' - exit 1 + echo "$(basename "$1") --help output is too wide:" + "$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}' + exit 1 fi # no --help output to stdout if "$1" --help 2>&1 1>/dev/null | grep .; then - echo "$(basename "$1") --help prints to stderr" - exit 2 + echo "$(basename "$1") --help prints to stderr" + exit 2 fi # error output to stderr if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then - echo "$(basename "$1") with an unknown parameter does not print to stderr" - exit 3 + echo "$(basename "$1") with an unknown parameter does not print to stderr" + exit 3 fi diff --git a/tools/meson-git-contrib.sh b/tools/meson-git-contrib.sh index 514daa0949a..b40e97ba624 100755 --- a/tools/meson-git-contrib.sh +++ b/tools/meson-git-contrib.sh @@ -2,8 +2,8 @@ set -eu git shortlog -s `git describe --abbrev=0`.. | \ - cut -c8- | \ - sed 's/ / /g' | \ - awk '{ print $$0 "," }' | \ - sed -e 's/ / /g' | \ - sort -u + cut -c8- | \ + sed 's/ / /g' | \ + awk '{ print $$0 "," }' | \ + sed -e 's/ / /g' | \ + sort -u diff --git a/tools/meson-hwdb-update.sh b/tools/meson-hwdb-update.sh index 8bdc58ac7f6..39efd75192b 100755 --- a/tools/meson-hwdb-update.sh +++ b/tools/meson-hwdb-update.sh @@ -5,23 +5,23 @@ cd "$1" unset permissive if [ "${2:-}" = "-p" ]; then - permissive=1 - shift + permissive=1 + shift else - permissive=0 + permissive=0 fi if [ "${2:-}" != "-n" ]; then ( - [ -z "$permissive" ] || set +e - set -x + [ -z "$permissive" ] || set +e + set -x - curl -L -o usb.ids 'http://www.linux-usb.org/usb.ids' - curl -L -o pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids' - curl -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt' - curl -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt' - curl -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt' - curl -L -o pnp_id_registry.html 'https://uefi.org/uefi-pnp-export' - curl -L -o acpi_id_registry.html 'https://uefi.org/uefi-acpi-export' + curl -L -o usb.ids 'http://www.linux-usb.org/usb.ids' + curl -L -o pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids' + curl -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt' + curl -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt' + curl -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt' + curl -L -o pnp_id_registry.html 'https://uefi.org/uefi-pnp-export' + curl -L -o acpi_id_registry.html 'https://uefi.org/uefi-acpi-export' ) fi set -x diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh index 501cd43d47c..da0d13a341f 100755 --- a/tools/meson-make-symlink.sh +++ b/tools/meson-make-symlink.sh @@ -6,7 +6,7 @@ set -eu mkdir -vp "$(dirname "${DESTDIR:-}$2")" if [ "$(dirname $1)" = . ]; then - ln -vfs -T "$1" "${DESTDIR:-}$2" + ln -vfs -T "$1" "${DESTDIR:-}$2" else - ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" + ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" fi diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index c8033d00a17..a8605b6bc94 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -8,8 +8,8 @@ tag="$2" fallback="$3" if [ -n "$tag" ]; then - echo "$tag" - exit 0 + echo "$tag" + exit 0 fi # Apparently git describe has a bug where it always considers the work-tree diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh index 9a116be1142..610bb9c2353 100755 --- a/tools/oss-fuzz.sh +++ b/tools/oss-fuzz.sh @@ -29,7 +29,7 @@ mkdir -p $build fuzzflag="oss-fuzz=true" if [ -z "$FUZZING_ENGINE" ]; then - fuzzflag="llvm-fuzz=true" + fuzzflag="llvm-fuzz=true" fi meson $build -D$fuzzflag -Db_lundef=false @@ -38,7 +38,7 @@ ninja -C $build fuzzers # The seed corpus is a separate flat archive for each fuzzer, # with a fixed name ${fuzzer}_seed_corpus.zip. for d in "$(dirname "$0")/../test/fuzz/fuzz-"*; do - zip -jqr $OUT/$(basename "$d")_seed_corpus.zip "$d" + zip -jqr $OUT/$(basename "$d")_seed_corpus.zip "$d" done # get fuzz-dns-packet corpus diff --git a/travis-ci/managers/travis_wait.bash b/travis-ci/managers/travis_wait.bash index acf6ad15e46..59de6638d6c 100644 --- a/travis-ci/managers/travis_wait.bash +++ b/travis-ci/managers/travis_wait.bash @@ -3,59 +3,59 @@ # as soon as Travis CI has started to provide an easy way to export the functions to bash scripts. travis_jigger() { - local cmd_pid="${1}" - shift - local timeout="${1}" - shift - local count=0 + local cmd_pid="${1}" + shift + local timeout="${1}" + shift + local count=0 - echo -e "\\n" + echo -e "\\n" - while [[ "${count}" -lt "${timeout}" ]]; do - count="$((count + 1))" - echo -ne "Still running (${count} of ${timeout}): ${*}\\r" - sleep 60 - done + while [[ "${count}" -lt "${timeout}" ]]; do + count="$((count + 1))" + echo -ne "Still running (${count} of ${timeout}): ${*}\\r" + sleep 60 + done - echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n" - kill -9 "${cmd_pid}" + echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n" + kill -9 "${cmd_pid}" } travis_wait() { - local timeout="${1}" + local timeout="${1}" - if [[ "${timeout}" =~ ^[0-9]+$ ]]; then - shift - else - timeout=20 - fi + if [[ "${timeout}" =~ ^[0-9]+$ ]]; then + shift + else + timeout=20 + fi - local cmd=("${@}") - local log_file="travis_wait_${$}.log" + local cmd=("${@}") + local log_file="travis_wait_${$}.log" - "${cmd[@]}" &>"${log_file}" & - local cmd_pid="${!}" + "${cmd[@]}" &>"${log_file}" & + local cmd_pid="${!}" - travis_jigger "${!}" "${timeout}" "${cmd[@]}" & - local jigger_pid="${!}" - local result + travis_jigger "${!}" "${timeout}" "${cmd[@]}" & + local jigger_pid="${!}" + local result - { - set +e - wait "${cmd_pid}" 2>/dev/null - result="${?}" - ps -p"${jigger_pid}" &>/dev/null && kill "${jigger_pid}" - set -e - } + { + set +e + wait "${cmd_pid}" 2>/dev/null + result="${?}" + ps -p"${jigger_pid}" &>/dev/null && kill "${jigger_pid}" + set -e + } - if [[ "${result}" -eq 0 ]]; then - echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}" - else - echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}" - fi + if [[ "${result}" -eq 0 ]]; then + echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}" + else + echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}" + fi - echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n" - cat "${log_file}" + echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n" + cat "${log_file}" - return "${result}" + return "${result}" } diff --git a/travis-ci/managers/xenial.sh b/travis-ci/managers/xenial.sh index af60114d34d..4822bdd4b73 100755 --- a/travis-ci/managers/xenial.sh +++ b/travis-ci/managers/xenial.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -e set -x diff --git a/travis-ci/scripts/build-docker-image.sh b/travis-ci/scripts/build-docker-image.sh index a18bf5fa858..69f9d69ce77 100755 --- a/travis-ci/scripts/build-docker-image.sh +++ b/travis-ci/scripts/build-docker-image.sh @@ -7,7 +7,7 @@ echo -e "\n\033[33;1mBuilding docker image: coverity-$TRAVIS_COMMIT.\033[0m" docker build \ ---build-arg DOCKER_USER=$USER \ ---build-arg DOCKER_USER_UID=`id -u` \ ---build-arg DOCKER_USER_GID=`id -g` \ ---force-rm -t coverity-${TRAVIS_COMMIT} --pull=true . + --build-arg DOCKER_USER=$USER \ + --build-arg DOCKER_USER_UID=`id -u` \ + --build-arg DOCKER_USER_GID=`id -g` \ + --force-rm -t coverity-${TRAVIS_COMMIT} --pull=true . diff --git a/travis-ci/tools/get-coverity.sh b/travis-ci/tools/get-coverity.sh index d364b541e27..3634e57ad60 100755 --- a/travis-ci/tools/get-coverity.sh +++ b/travis-ci/tools/get-coverity.sh @@ -18,18 +18,18 @@ sudo apt-get update && sudo apt-get -y install wget # Get coverity tool if [ ! -d $TOOL_BASE ]; then - # Download Coverity Scan Analysis Tool - if [ ! -e $TOOL_ARCHIVE ]; then - echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" - wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" - fi + # Download Coverity Scan Analysis Tool + if [ ! -e $TOOL_ARCHIVE ]; then + echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" + wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" + fi - # Extract Coverity Scan Analysis Tool - echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m" - mkdir -p $TOOL_BASE - pushd $TOOL_BASE - tar xzf $TOOL_ARCHIVE - popd + # Extract Coverity Scan Analysis Tool + echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m" + mkdir -p $TOOL_BASE + pushd $TOOL_BASE + tar xzf $TOOL_ARCHIVE + popd fi echo -e "\033[33;1mCoverity Scan Analysis Tool can be found at $TOOL_BASE ...\033[0m" diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh index e2b260398c5..a483d75b86f 100755 --- a/units/meson-add-wants.sh +++ b/units/meson-add-wants.sh @@ -6,23 +6,23 @@ target="$2" unit="$3" case "$target" in - */?*) # a path, but not just a slash at the end - dir="${DESTDIR:-}${target}" - ;; - *) - dir="${DESTDIR:-}${unitdir}/${target}" - ;; + */?*) # a path, but not just a slash at the end + dir="${DESTDIR:-}${target}" + ;; + *) + dir="${DESTDIR:-}${unitdir}/${target}" + ;; esac unitpath="${DESTDIR:-}${unitdir}/${unit}" case "$target" in - */) - mkdir -vp -m 0755 "$dir" - ;; - *) - mkdir -vp -m 0755 "$(dirname "$dir")" - ;; + */) + mkdir -vp -m 0755 "$dir" + ;; + *) + mkdir -vp -m 0755 "$(dirname "$dir")" + ;; esac ln -vfs --relative "$unitpath" "$dir" diff --git a/xorg/50-systemd-user.sh b/xorg/50-systemd-user.sh index 5588185c503..bfee5f691c4 100755 --- a/xorg/50-systemd-user.sh +++ b/xorg/50-systemd-user.sh @@ -3,5 +3,5 @@ systemctl --user import-environment DISPLAY XAUTHORITY if command -v dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY + dbus-update-activation-environment DISPLAY XAUTHORITY fi