From 99cac827bc2b8e177af3a70afcbcb15a25ac9736 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 20 Jun 2016 11:09:02 +0200 Subject: [PATCH 1/7] login: create /var/log/lastlog Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635 --- login-utils/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login-utils/login.c b/login-utils/login.c index c6cd340b69..3657f04cd7 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -662,7 +662,7 @@ static void log_lastlog(struct login_context *cxt) sa.sa_handler = SIG_IGN; sigaction(SIGXFSZ, &sa, &oldsa_xfsz); - fd = open(_PATH_LASTLOG, O_RDWR, 0); + fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); if (fd < 0) goto done; offset = cxt->pwd->pw_uid * sizeof(ll); From 53ce193e6497fc88c0896cfe1490579fc6bc4074 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Aug 2021 13:50:57 +0200 Subject: [PATCH 2/7] login: default motd file Add `/run/motd.d` to the hardcoded MOTD_FILE Addresses: https://github.com/coreos/console-login-helper-messages/issues/60 --- include/pathnames.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pathnames.h b/include/pathnames.h index 9be2baa837..7e7d9053f0 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -41,7 +41,7 @@ #ifndef _PATH_MAILDIR # define _PATH_MAILDIR "/var/spool/mail" #endif -#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/etc/motd" +#define _PATH_MOTDFILE "/usr/share/misc/motd:/run/motd:/run/motd.d:/etc/motd:/etc/motd.d" #ifndef _PATH_NOLOGIN # define _PATH_NOLOGIN "/etc/nologin" #endif From 0162cfc304e110411f15bc587739416cdeba6fb3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 23 Aug 2021 15:15:38 +0200 Subject: [PATCH 3/7] tests: make ./run.sh more robust Let's make upstream tests more stable to be usable in RHEL environment where we do not use ASAN and meson. Upstream: http://github.com/karelzak/util-linux/commit/331c5e0c54d9cb6f67dc3e825eec2d78c67d8ce6 Signed-off-by: Karel Zak --- tests/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run.sh b/tests/run.sh index 9d26406c4a..d020bfe88a 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -165,7 +165,7 @@ OPTS="$OPTS --srcdir=$top_srcdir --builddir=$top_builddir" if [ -z "$has_asan_opt" ]; then if [ -e "$top_builddir/Makefile" ]; then asan=$(awk '/^ASAN_LDFLAGS/ { print $3 }' $top_builddir/Makefile) - else + elif [ -f "$top_builddir/meson.conf" ]; then . "$top_builddir/meson.conf" fi if [ -n "$asan" ]; then From 202bbadd2167bcd765c6d4e297ce20dcbfc5dfc3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 23 Aug 2021 16:28:52 +0200 Subject: [PATCH 4/7] tests: make mount/fstab-all more robust Upstream: http://github.com/karelzak/util-linux/commit/85ae61dd6d956e7c9fe2b22b8c46bb1d0bfd13da Signed-off-by: Karel Zak --- tests/ts/mount/fstab-all | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ts/mount/fstab-all b/tests/ts/mount/fstab-all index acc64e462e..6b70188237 100755 --- a/tests/ts/mount/fstab-all +++ b/tests/ts/mount/fstab-all @@ -79,6 +79,7 @@ echo "${TS_DEVICE}4 ${MOUNTPOINT}D ext4 rw,defaults 0 0" >> $MY_FSTAB ts_init_subtest "basic" $TS_CMD_MOUNT --all --fstab $MY_FSTAB >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest @@ -87,6 +88,7 @@ ts_finalize_subtest ts_init_subtest "filter-type" $TS_CMD_MOUNT --all --fstab $MY_FSTAB -t ext4 >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}D [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest @@ -95,6 +97,7 @@ ts_finalize_subtest ts_init_subtest "filter-notype" $TS_CMD_MOUNT --all --fstab $MY_FSTAB -t noext4 >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C} [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest @@ -103,6 +106,7 @@ ts_finalize_subtest ts_init_subtest "filter-option" $TS_CMD_MOUNT --all --fstab $MY_FSTAB -O ro >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}C [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest @@ -111,6 +115,7 @@ ts_finalize_subtest ts_init_subtest "override-option" $TS_CMD_MOUNT --all --fstab $MY_FSTAB -o ro >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest @@ -132,6 +137,7 @@ $TS_CMD_MOUNT --all \ --target-prefix $MY_ROOT \ -o X-mount.mkdir >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" +udevadm settle $TS_CMD_UMOUNT $MY_ROOT/foo/{A,B,C,D} [ $? == 0 ] || ts_log "umount failed" ts_finalize_subtest From d39f86fb697fef651a6929b7efb18afdc73b8213 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Aug 2021 10:49:32 +0200 Subject: [PATCH 5/7] tests: make eject umount tests more robust Upstream: http://github.com/karelzak/util-linux/commit/abe16d0d34413555fbd621f90a0b93c2105116a2 Signed-off-by: Karel Zak --- tests/ts/eject/umount | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount index 2be281ee35..04f53ed995 100755 --- a/tests/ts/eject/umount +++ b/tests/ts/eject/umount @@ -83,6 +83,7 @@ mkfs.ext2 -q -F $TS_DEVICE udevadm settle mkdir -p $TS_MOUNTPOINT $TS_CMD_MOUNT $TS_DEVICE $TS_MOUNTPOINT +udevadm settle $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" deinit_device ts_finalize_subtest @@ -95,6 +96,7 @@ mkdir -p ${TS_MOUNTPOINT}1 mkdir -p ${TS_MOUNTPOINT}2 $TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 $TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 +udevadm settle $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" deinit_device ts_finalize_subtest @@ -115,6 +117,7 @@ mkdir -p ${TS_MOUNTPOINT}1 mkdir -p ${TS_MOUNTPOINT}2 $TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 $TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 +udevadm settle $TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success" deinit_device ts_finalize_subtest From b90d590d87a9657ac1df9b31c78fdc3a6d672e83 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 25 Aug 2021 22:05:00 +0200 Subject: [PATCH 6/7] ci: initial Packit configuration Enable a basic set of Packit jobs to build util-linux RPMs from a RHEL9/C9S specfile - on F34 for now, until we have public C9S images available in Copr. Some comments to the sed magic in the yaml configuration file: 1) We have to create a custom tarball by our own means, since the default Packit action doesn't include the necessary .tarball-version file. This wouldn't be necessary if we could use the `make distcheck` target, but the default builder chroot is missing some dependencies (like bison), so we have to fallback to `git archive`. 2) Consequently, we need to call autogen.sh from the specfile (normally we'd call it before `make distcheck` and already have a configure binary in the tarball) 3) Also consequently, explicitly run the `check` RPM phase during rpmbuild (by setting `_with_check 1`). This would be, also, normally executed by `make distcheck`. As requested, run the checks on push events into the rhel-9 branch instead of for each pull request. This workflow can be later extended to send the built RPMs to the Testing Farm (TFT)[0] for a more extensive testing. [0] https://packit.dev/docs/testing-farm/ --- .packit.yml | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .packit.yml diff --git a/.packit.yml b/.packit.yml new file mode 100644 index 0000000000..7417bd99bf --- /dev/null +++ b/.packit.yml @@ -0,0 +1,56 @@ +--- +# vi:ts=2 sw=2 et: +# +# Docs: https://packit.dev/docs/ + +specfile_path: .packit_rpm/util-linux.spec +synced_files: + - .packit.yaml + - src: .packit_rpm/util-linux.spec + dest: util-linux.spec +upstream_package_name: util-linux +downstream_package_name: util-linux +# `git describe` returns in util-linux's case 'v2.37.2-xxx' which breaks RPM version +# # detection (that expects 2.37.2-xxx'). Let's tweak the version string accordingly +upstream_tag_template: "v{version}" + +actions: + post-upstream-clone: + # Use the CentOS Stream specfile + - "git clone https://gitlab.com/redhat/centos-stream/rpms/util-linux.git .packit_rpm --depth=1" + # Drop the "sources" file so rebase-helper doesn't think we're a dist-git + - "rm -fv .packit_rpm/sources" + # Drop all patches, since they're already included in the tarball + - "sed -ri '/^Patch[0-9]+:/d' .packit_rpm/util-linux.spec" + # We need to call autogen, since we use a custom tarball + - "sed -i '/^### Dependencies/aBuildRequires: bison' .packit_rpm/util-linux.spec" + - "sed -i '/^unset LINGUAS/a./autogen.sh' .packit_rpm/util-linux.spec" + create-archive: + # We need to override the default create-archive action, since we need to tweak + # the resulting tarball and add a .tarball-version file to it, otherwise + # util-linux fails to detect its version during build + - "bash -c 'echo $PACKIT_PROJECT_VERSION >.tarball-version'" + - "bash -c 'git archive --prefix ${PACKIT_PROJECT_NAME_VERSION}/ --add-file .tarball-version --output .packit_rpm/${PACKIT_PROJECT_NAME_VERSION}.tar.gz HEAD'" + - "bash -c 'echo .packit_rpm/${PACKIT_PROJECT_NAME_VERSION}.tar.gz'" + +# Available targets can be listed via `copr-cli list-chroots` +jobs: +# Build test +- job: copr_build + trigger: commit + metadata: + branch: rhel-9 + targets: + # FIXME: change to CentOS 9 once it's available + - fedora-34-aarch64 + - fedora-34-ppc64le + - fedora-34-x86_64 + +# TODO: configure TFT +# Run tests (via testing farm) +#- job: tests +# trigger: pull_request +# metadata: +# targets: +# # FIXME: change to CentOS 9 once it's available +# - fedora-34-x86_64 From e66cdb93904f4607ffc8bd0df067e55aa006fb92 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Thu, 26 Aug 2021 11:54:33 +0200 Subject: [PATCH 7/7] ci: enable build tests --- .packit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.packit.yml b/.packit.yml index 7417bd99bf..001f379209 100644 --- a/.packit.yml +++ b/.packit.yml @@ -25,6 +25,8 @@ actions: # We need to call autogen, since we use a custom tarball - "sed -i '/^### Dependencies/aBuildRequires: bison' .packit_rpm/util-linux.spec" - "sed -i '/^unset LINGUAS/a./autogen.sh' .packit_rpm/util-linux.spec" + # Enable tests after build + - "sed -i '/^### Macros/a%define _with_check 1' .packit_rpm/util-linux.spec" create-archive: # We need to override the default create-archive action, since we need to tweak # the resulting tarball and add a .tarball-version file to it, otherwise