diff --git a/.packit.yml b/.packit.yml new file mode 100644 index 0000000000..001f379209 --- /dev/null +++ b/.packit.yml @@ -0,0 +1,58 @@ +--- +# 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" + # 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 + # 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 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 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); 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 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 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