main - configure: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=21edfc4a5ea11d888f5...
Commit: 21edfc4a5ea11d888f506b41d36a0ec983dc63c9
Parent: 391138ff303c85999782e1341a5e1d8a28810486
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Feb 10 19:50:22 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 20:54:05 2023 +0100
configure: update
---
configure | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 147 insertions(+), 17 deletions(-)
diff --git a/configure b/configure
index 2406deddc..e84333ec7 100755
--- a/configure
+++ b/configure
@@ -805,6 +805,7 @@ UDEV_LIBS
UDEV_CFLAGS
BLKID_LIBS
BLKID_CFLAGS
+SYSTEMD_RUN_CMD
SYSTEMD_LIBS
SYSTEMD_CFLAGS
LOCKD_IDM_LIBS
@@ -988,6 +989,7 @@ enable_dmfilemapd
enable_notify_dbus
enable_systemd_journal
enable_app_machineid
+with_systemd_run
enable_blkid_wiping
enable_udev_sync
enable_udev_rules
@@ -1803,6 +1805,7 @@ Optional Packages:
lvmlockd pidfile [PID_DIR/lvmlockd.pid]
--with-lvmpolld-pidfile=PATH
lvmpolld pidfile [PID_DIR/lvmpolld.pid]
+ --with-systemd-run=PATH systemd-run tool: [autodetect]
--with-python-sys-prefix
use Python's sys.prefix and sys.exec_prefix values
--with-python_prefix override the default PYTHON_PREFIX
@@ -12785,6 +12788,138 @@ fi
################################################################################
+# Check whether --with-systemd-run was given.
+if test ${with_systemd_run+y}
+then :
+ withval=$with_systemd_run; SYSTEMD_RUN_CMD=$withval
+else $as_nop
+ SYSTEMD_RUN_CMD="autodetect"
+fi
+
+
+if test "$SYSTEMD_RUN_CMD" = "autodetect"
+then :
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}systemd-run", so it can be a program name with args.
+set dummy ${ac_tool_prefix}systemd-run; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_SYSTEMD_RUN_CMD+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ case $SYSTEMD_RUN_CMD in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SYSTEMD_RUN_CMD="$SYSTEMD_RUN_CMD" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_path_SYSTEMD_RUN_CMD="$as_dir$ac_word$ac_exec_ext"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+SYSTEMD_RUN_CMD=$ac_cv_path_SYSTEMD_RUN_CMD
+if test -n "$SYSTEMD_RUN_CMD"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SYSTEMD_RUN_CMD" >&5
+printf "%s\n" "$SYSTEMD_RUN_CMD" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_SYSTEMD_RUN_CMD"; then
+ ac_pt_SYSTEMD_RUN_CMD=$SYSTEMD_RUN_CMD
+ # Extract the first word of "systemd-run", so it can be a program name with args.
+set dummy systemd-run; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_ac_pt_SYSTEMD_RUN_CMD+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ case $ac_pt_SYSTEMD_RUN_CMD in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_SYSTEMD_RUN_CMD="$ac_pt_SYSTEMD_RUN_CMD" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_SYSTEMD_RUN_CMD="$as_dir$ac_word$ac_exec_ext"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_SYSTEMD_RUN_CMD=$ac_cv_path_ac_pt_SYSTEMD_RUN_CMD
+if test -n "$ac_pt_SYSTEMD_RUN_CMD"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_SYSTEMD_RUN_CMD" >&5
+printf "%s\n" "$ac_pt_SYSTEMD_RUN_CMD" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+ if test "x$ac_pt_SYSTEMD_RUN_CMD" = x; then
+ SYSTEMD_RUN_CMD=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ SYSTEMD_RUN_CMD=$ac_pt_SYSTEMD_RUN_CMD
+ fi
+else
+ SYSTEMD_RUN_CMD="$ac_cv_path_SYSTEMD_RUN_CMD"
+fi
+
+ if test -z "$SYSTEMD_RUN_CMD"
+then :
+ SYSTEMD_RUN_CMD="/usr/bin/systemd-run"
+fi
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for defined systemd-run" >&5
+printf %s "checking for defined systemd-run... " >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SYSTEMD_RUN_CMD" >&5
+printf "%s\n" "$SYSTEMD_RUN_CMD" >&6; }
+fi
+
+################################################################################
+
# Check whether --enable-blkid_wiping was given.
if test ${enable_blkid_wiping+y}
then :
@@ -12798,12 +12933,6 @@ fi
# so lvresize can check detected flag here
#
DEFAULT_USE_BLKID_WIPING=0
-if test "$BLKID_WIPING" != "no"
-then :
- blkdir_version=">= 2.24"
-else $as_nop
- blkid_version=""
-fi
pkg_failed=no
@@ -12814,12 +12943,12 @@ if test -n "$BLKID_CFLAGS"; then
pkg_cv_BLKID_CFLAGS="$BLKID_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid \$blkid_version \""; } >&5
- ($PKG_CONFIG --exists --print-errors "blkid $blkid_version ") 2>&5
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid >= 2.24\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "blkid >= 2.24") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_BLKID_CFLAGS=`$PKG_CONFIG --cflags "blkid $blkid_version " 2>/dev/null`
+ pkg_cv_BLKID_CFLAGS=`$PKG_CONFIG --cflags "blkid >= 2.24" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12831,12 +12960,12 @@ if test -n "$BLKID_LIBS"; then
pkg_cv_BLKID_LIBS="$BLKID_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid \$blkid_version \""; } >&5
- ($PKG_CONFIG --exists --print-errors "blkid $blkid_version ") 2>&5
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid >= 2.24\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "blkid >= 2.24") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_BLKID_LIBS=`$PKG_CONFIG --libs "blkid $blkid_version " 2>/dev/null`
+ pkg_cv_BLKID_LIBS=`$PKG_CONFIG --libs "blkid >= 2.24" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12857,14 +12986,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- BLKID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "blkid $blkid_version " 2>&1`
+ BLKID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "blkid >= 2.24" 2>&1`
else
- BLKID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "blkid $blkid_version " 2>&1`
+ BLKID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "blkid >= 2.24" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$BLKID_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (blkid $blkid_version ) were not met:
+ as_fn_error $? "Package requirements (blkid >= 2.24) were not met:
$BLKID_PKG_ERRORS
@@ -12897,8 +13026,8 @@ printf "%s\n" "yes" >&6; }
HAVE_BLKID=1
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for blkdid.h supports SUBLKS_FSINFO." >&5
-printf %s "checking for blkdid.h supports SUBLKS_FSINFO.... " >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for blkdid.h defines BLKID_SUBLKS_FSINFO." >&5
+printf %s "checking for blkdid.h defines BLKID_SUBLKS_FSINFO.... " >&6; }
if test ${ac_cv_have_blkid_sublks_fsinfo+y}
then :
printf %s "(cached) " >&6
@@ -15954,6 +16083,7 @@ printf "%s\n" "#define LVM_CONFIGURE_LINE \"$CONFIGURE_LINE\"" >>confdefs.h
+
################################################################################
3 months, 3 weeks
main - configure.ac: support systemd-run binary path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=391138ff303c8599978...
Commit: 391138ff303c85999782e1341a5e1d8a28810486
Parent: 2a72f8a49cf6601db7c987c7c4d6a72a29a59a1e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Feb 10 19:49:42 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 20:54:05 2023 +0100
configure.ac: support systemd-run binary path
Allow users to specify their path to systemd-run binary:
configure --with-systemd-run=/my/path/system-run
By defaults it autodetected in $PATH and fallbacks to:
/usr/bin/systemd-run.
---
configure.ac | 14 ++++++++++++++
udev/69-dm-lvm.rules.in | 2 +-
udev/Makefile.in | 6 +++---
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 49b06145d..3177012e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1101,6 +1101,19 @@ AS_IF([test "$NOTIFYDBUS_SUPPORT" = "yes" || test "$SYSTEMD_JOURNAL_SUPPORT" = "
PKG_CHECK_MODULES(SYSTEMD, [systemd], [SYSTEMD_LIBS="-lsystemd"], $bailout)
])
+################################################################################
+dnl -- Support override for systemd-run path if they need to (NixOS builds)
+AC_ARG_WITH(systemd-run,
+ AS_HELP_STRING([--with-systemd-run=PATH],
+ [systemd-run tool: [autodetect]]),
+ SYSTEMD_RUN_CMD=$withval, SYSTEMD_RUN_CMD="autodetect")
+
+AS_IF([test "$SYSTEMD_RUN_CMD" = "autodetect"],
+ [AC_PATH_TOOL(SYSTEMD_RUN_CMD, systemd-run)
+ AS_IF([test -z "$SYSTEMD_RUN_CMD"], [SYSTEMD_RUN_CMD="/usr/bin/systemd-run"])],
+ [AC_MSG_CHECKING([for defined systemd-run])
+ AC_MSG_RESULT([$SYSTEMD_RUN_CMD])])
+
################################################################################
dnl -- Enable blkid wiping functionality
@@ -1908,6 +1921,7 @@ AC_SUBST(SBINDIR)
AC_SUBST(SELINUX_LIBS)
AC_SUBST(SELINUX_PC)
AC_SUBST(SYSCONFDIR)
+AC_SUBST(SYSTEMD_RUN_CMD)
AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
AC_SUBST(STATIC_LINK)
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 3cda30023..ff1568145 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -76,7 +76,7 @@ LABEL="lvm_scan"
# it's better suited to appearing in the journal.
IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event --udevoutput --journal=output $env{DEVNAME}"
-ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} (LVM_EXEC)/lvm vgchange -aay --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
+ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="(SYSTEMDRUN) --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} (LVM_EXEC)/lvm vgchange -aay --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
GOTO="lvm_end"
LABEL="lvm_end"
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 106fca113..5ee30d09c 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2009-2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2009-2023 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -22,7 +22,7 @@ LVM_RULES=11-dm-lvm.rules 69-dm-lvm.rules
DM_DIR=$(shell $(GREP) "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | $(AWK) '{print $$3}')
-BINDIR=@bindir@
+SYSTEMDRUN=@SYSTEMD_RUN_CMD@
ifeq ("@UDEV_RULE_EXEC_DETECTION@", "yes")
SBIN=\$$env{DM_SBIN_PATH}
DM_EXEC_RULE=ENV{DM_SBIN_PATH}=\"\/sbin\"\\nTEST!=\"\$$env{DM_SBIN_PATH}\/dmsetup\", ENV{DM_SBIN_PATH}=\"\/usr\/sbin\"
@@ -44,7 +44,7 @@ BLKID_RULE=IMPORT{program}=\"${SBIN}\/blkid -o udev -p \$$tempnode\"
endif
%.rules: $(srcdir)/%.rules.in
- $(Q) $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BINDIR)+$(BINDIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@
+ $(Q) $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(SYSTEMDRUN)+$(SYSTEMDRUN)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@
%_install: %.rules
@echo " [INSTALL] $<"
3 months, 3 weeks
main - configure.ac: better blkid test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2a72f8a49cf6601db7c...
Commit: 2a72f8a49cf6601db7c987c7c4d6a72a29a59a1e
Parent: 7d419b374a0bd2ebcc56e77d2578684aee998cbd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Feb 10 19:19:31 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 20:53:10 2023 +0100
configure.ac: better blkid test
Previous commit e67ebc5c40948bcbea536fd407535009a76ede00 used incorrect check
for blkid version.
Fix it by always checking for at least version 2.24,
as we can't use older version anyway.
Added BLKID_SUBLKS_FSINFO is present in newer version.
---
configure.ac | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7f9b3e664..49b06145d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1113,12 +1113,11 @@ AC_ARG_ENABLE(blkid_wiping,
# so lvresize can check detected flag here
#
DEFAULT_USE_BLKID_WIPING=0
-AS_IF([test "$BLKID_WIPING" != "no"], [blkdir_version=">= 2.24"], [blkid_version=""])
-PKG_CHECK_MODULES([BLKID], [blkid $blkid_version ], [
+PKG_CHECK_MODULES([BLKID], [blkid >= 2.24], [
HAVE_BLKID=1
- AC_CACHE_CHECK([for blkdid.h supports SUBLKS_FSINFO.],
+ AC_CACHE_CHECK([for blkdid.h defines BLKID_SUBLKS_FSINFO.],
[ac_cv_have_blkid_sublks_fsinfo],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <blkid/blkid.h>
#ifndef BLKID_SUBLKS_FSINFO
3 months, 3 weeks
main - tests: reduce shellcheck warns
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7d419b374a0bd2ebcc5...
Commit: 7d419b374a0bd2ebcc56e77d2578684aee998cbd
Parent: 773bc013778df631f9ee14e7a79d5f02211b1e67
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 16:05:40 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
tests: reduce shellcheck warns
Reduce warnings in tests.
---
test/shell/fsadm-crypt-fsresize.sh | 2 +-
test/shell/fsadm-crypt.sh | 2 +-
test/shell/hints.sh | 4 ++--
test/shell/idm_fabric_failure.sh | 12 ++++++------
test/shell/idm_fabric_failure_half_brain.sh | 10 +++++-----
test/shell/idm_fabric_failure_timeout.sh | 8 ++++----
test/shell/idm_ilm_failure.sh | 6 +++---
test/shell/large-physical-sector-size.sh | 2 +-
test/shell/lvconvert-mirror-updown.sh | 4 ++--
test/shell/lvconvert-mirror.sh | 4 ++--
test/shell/lvconvert-repair-cache.sh | 4 ++--
test/shell/lvconvert-snapshot-thin.sh | 2 +-
test/shell/lvextend-raid.sh | 18 +++++++++---------
test/shell/lvmlockd-lv-types.sh | 2 +-
test/shell/metadata-bad-text.sh | 6 +++---
test/shell/metadata-zero-space.sh | 10 +++-------
test/shell/mirror-names.sh | 4 ++--
test/shell/multi_hosts_lv_ex_timeout_hosta.sh | 14 +++++++-------
test/shell/multi_hosts_lv_hosta.sh | 8 ++++----
test/shell/multi_hosts_lv_sh_timeout_hosta.sh | 18 +++++++++---------
test/shell/open-file-limit.sh | 6 +++---
test/shell/pvck-repair.sh | 4 ++--
test/shell/report-format.sh | 6 +++---
test/shell/udev-pvscan-vgchange.sh | 6 +++---
test/shell/vgchange-pvs-online.sh | 6 +++---
25 files changed, 82 insertions(+), 86 deletions(-)
diff --git a/test/shell/fsadm-crypt-fsresize.sh b/test/shell/fsadm-crypt-fsresize.sh
index 65f555b29..56cd5c508 100644
--- a/test/shell/fsadm-crypt-fsresize.sh
+++ b/test/shell/fsadm-crypt-fsresize.sh
@@ -89,7 +89,7 @@ test ! -d "$mount_dir" && mkdir "$mount_dir"
crypt_close() {
aux udev_wait
cryptsetup remove "$1"
- if [ "$?" -eq 0 -a -n "$DROP_SYMLINK" ]; then
+ if [ "$?" -eq 0 ] && [ -n "$DROP_SYMLINK" ]; then
rm -f "$DM_DEV_DIR/mapper/$1"
fi
}
diff --git a/test/shell/fsadm-crypt.sh b/test/shell/fsadm-crypt.sh
index 4d6efbc63..4415cea8f 100644
--- a/test/shell/fsadm-crypt.sh
+++ b/test/shell/fsadm-crypt.sh
@@ -82,7 +82,7 @@ test ! -d "$mount_dir" && mkdir "$mount_dir"
crypt_close() {
aux udev_wait
cryptsetup remove "$1"
- if [ "$?" -eq 0 -a -n "$DROP_SYMLINK" ]; then
+ if [ "$?" -eq 0 ] && [ -n "$DROP_SYMLINK" ]; then
rm -f "$DM_DEV_DIR/mapper/$1"
fi
}
diff --git a/test/shell/hints.sh b/test/shell/hints.sh
index 68e61153d..7fe0e33f5 100644
--- a/test/shell/hints.sh
+++ b/test/shell/hints.sh
@@ -110,12 +110,12 @@ not grep scan: tmptest
if which strace; then
strace -e io_submit pvs 2>&1|tee tmptest
-test "$(grep io_submit tmptest | wc -l)" -eq 3
+test "$(grep -c io_submit tmptest)" -eq 3
# test that 'pvs -a' submits seven reads, one for each device,
# and one more in vg_read rescan check
strace -e io_submit pvs -a 2>&1|tee tmptest
-test "$(grep io_submit tmptest | wc -l)" -eq 7
+test "$(grep -c io_submit tmptest)" -eq 7
fi
#
diff --git a/test/shell/idm_fabric_failure.sh b/test/shell/idm_fabric_failure.sh
index 633dd9d73..edca86b9c 100644
--- a/test/shell/idm_fabric_failure.sh
+++ b/test/shell/idm_fabric_failure.sh
@@ -24,13 +24,13 @@ vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
# Create new logic volume
lvcreate -a ey --zero n -l 50%FREE -n $lv1 $vg
-DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
-DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
-DRIVE3=`dmsetup deps -o devname $dev3 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE1=$(dmsetup deps -o devname "$dev1" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
+DRIVE2=$(dmsetup deps -o devname "$dev2" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
+DRIVE3=$(dmsetup deps -o devname "$dev3" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
-HOST1=`readlink /sys/block/$DRIVE1 | awk -F'/' '{print $6}'`
-HOST2=`readlink /sys/block/$DRIVE2 | awk -F'/' '{print $6}'`
-HOST3=`readlink /sys/block/$DRIVE3 | awk -F'/' '{print $6}'`
+HOST1=$(readlink "/sys/block/$DRIVE1" | awk -F'/' '{print $6}')
+HOST2=$(readlink "/sys/block/$DRIVE2" | awk -F'/' '{print $6}')
+HOST3=$(readlink "/sys/block/$DRIVE3" | awk -F'/' '{print $6}')
# Emulate fabric failure
echo 1 > "/sys/block/$DRIVE1/device/delete"
diff --git a/test/shell/idm_fabric_failure_half_brain.sh b/test/shell/idm_fabric_failure_half_brain.sh
index 784b26896..e6496461c 100644
--- a/test/shell/idm_fabric_failure_half_brain.sh
+++ b/test/shell/idm_fabric_failure_half_brain.sh
@@ -21,8 +21,8 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 2
aux extend_filter_LVMTEST
-DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
-DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE1=$(dmsetup deps -o devname "$dev1" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
+DRIVE2=$(dmsetup deps -o devname "$dev2" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
[ "$(basename -- $DRIVE1)" = "$(basename -- $DRIVE2)" ] && die "Need to pass two different drives!?"
@@ -42,14 +42,14 @@ drive_list=($DRIVE1)
# Find all drives with the same WWN and delete them from system,
# so that we can emulate the same drive with multiple paths are
# disconnected with system.
-drive_wwn=`udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}'`
+drive_wwn=$(udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}')
for dev in /dev/*; do
if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
- wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ wwn=$(udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}')
if [ "$wwn" = "$drive_wwn" ]; then
base_name="$(basename -- ${dev})"
drive_list+=("$base_name")
- host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ host_list+=( $(readlink "/sys/block/$base_name" | awk -F'/' '{print $6}') )
fi
fi
done
diff --git a/test/shell/idm_fabric_failure_timeout.sh b/test/shell/idm_fabric_failure_timeout.sh
index 2466f94f0..2924d81a6 100644
--- a/test/shell/idm_fabric_failure_timeout.sh
+++ b/test/shell/idm_fabric_failure_timeout.sh
@@ -21,7 +21,7 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 1
aux extend_filter_LVMTEST
-DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE1=$(dmsetup deps -o devname "$dev1" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
# The previous device-mapper are removed, but LVM still can directly
# access VGs from the specified physical drives. So enable drives
@@ -39,14 +39,14 @@ drive_list=( "$DRIVE1" )
# Find all drives with the same WWN and delete them from system,
# so that we can emulate the same drive with multiple paths are
# disconnected with system.
-drive_wwn=`udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}'`
+drive_wwn=$(udevadm info /dev/${DRIVE1} | awk -F= '/E: ID_WWN=/ {print $2}')
for dev in /dev/*; do
if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
- wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ wwn=$(udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}')
if [ "$wwn" = "$drive_wwn" ]; then
base_name="$(basename -- ${dev})"
drive_list+=("$base_name")
- host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ host_list+=( $(readlink "/sys/block/$base_name" | awk -F'/' '{print $6}') )
fi
fi
done
diff --git a/test/shell/idm_ilm_failure.sh b/test/shell/idm_ilm_failure.sh
index 4b48476fe..6b8e591c1 100644
--- a/test/shell/idm_ilm_failure.sh
+++ b/test/shell/idm_ilm_failure.sh
@@ -21,9 +21,9 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 3
aux extend_filter_LVMTEST
-DRIVE1=`dmsetup deps -o devname $dev1 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
-DRIVE2=`dmsetup deps -o devname $dev2 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
-DRIVE3=`dmsetup deps -o devname $dev3 | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//'`
+DRIVE1=$(dmsetup deps -o devname "$dev1" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
+DRIVE2=$(dmsetup deps -o devname "$dev2" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
+DRIVE3=$(dmsetup deps -o devname "$dev3" | awk '{gsub(/[()]/,""); print $4;}' | sed 's/[0-9]*$//')
if [ "$DRIVE1" = "$DRIVE2" ] || [ "$DRIVE1" = "$DRIVE3" ] || [ "$DRIVE2" = "$DRIVE3" ]; then
die "Need to pass three different drives!?"
diff --git a/test/shell/large-physical-sector-size.sh b/test/shell/large-physical-sector-size.sh
index d076d862c..b60341889 100644
--- a/test/shell/large-physical-sector-size.sh
+++ b/test/shell/large-physical-sector-size.sh
@@ -32,7 +32,7 @@ get_devs
vgcreate $SHARED $vg "$dev1"
-for i in `seq 1 40`; do lvcreate -an -l1 $vg; done;
+for i in $(seq 1 40); do lvcreate -an -l1 $vg; done;
lvs $vg
diff --git a/test/shell/lvconvert-mirror-updown.sh b/test/shell/lvconvert-mirror-updown.sh
index fd7a45ecd..4aea4967f 100644
--- a/test/shell/lvconvert-mirror-updown.sh
+++ b/test/shell/lvconvert-mirror-updown.sh
@@ -22,8 +22,8 @@ get_devs
vgcreate $SHARED -s 64k "$vg" "${DEVICES[@]}"
# Use zero devices for big mirror legs
-aux zero_dev "$dev2" $(get first_extent_sector "$dev2"):
-aux zero_dev "$dev3" $(get first_extent_sector "$dev3"):
+aux zero_dev "$dev2" "$(get first_extent_sector "$dev2"):"
+aux zero_dev "$dev3" "$(get first_extent_sector "$dev3"):"
lvcreate -aey -L90 --type mirror --corelog --regionsize 16k -m1 -n $lv1 $vg "$dev1" "$dev2"
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 160b086f6..17ed033b2 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -316,8 +316,8 @@ fi
# Test pulling primary image before mirror in-sync (should fail)
# Test pulling primary image after mirror in-sync (should work)
#
-aux zero_dev "$dev2" $(get first_extent_sector "$dev2"):
-aux zero_dev "$dev4" $(get first_extent_sector "$dev4"):
+aux zero_dev "$dev2" "$(get first_extent_sector "$dev2"):"
+aux zero_dev "$dev4" "$(get first_extent_sector "$dev4"):"
SHOULD=
aux throttle_dm_mirror || SHOULD=should
diff --git a/test/shell/lvconvert-repair-cache.sh b/test/shell/lvconvert-repair-cache.sh
index 49cfbb1f9..851a6117e 100644
--- a/test/shell/lvconvert-repair-cache.sh
+++ b/test/shell/lvconvert-repair-cache.sh
@@ -69,7 +69,7 @@ lvconvert --repair $vg/$lv1
lvs -a $vg
check lv_exists $vg ${lv1}_meta0
-eval $(lvs -S 'name=~_pmspare' -a --config 'report/mark_hidden_devices=0' -o name --noheading --nameprefixes $vg)
+eval "$(lvs -S 'name=~_pmspare' -a --config 'report/mark_hidden_devices=0' -o name --noheading --nameprefixes $vg)"
lvremove -f --yes "$vg/$LVM2_LV_NAME"
# check --repair without creation of _pmspare device
@@ -77,7 +77,7 @@ lvconvert --repair --poolmetadataspare n $vg/$lv1
check lv_exists $vg ${lv1}_meta1
# check no _pmspare has been created in previous --repair
-test "0" = $(lvs -S 'name=~_pmspare' -a -o name --noheading --nameprefixes $vg | wc -l)
+test "0" = "$(lvs -S 'name=~_pmspare' -a -o name --noheading --nameprefixes $vg | wc -l)"
aux disable_dev "$dev2"
diff --git a/test/shell/lvconvert-snapshot-thin.sh b/test/shell/lvconvert-snapshot-thin.sh
index f5da459b3..cc4dade42 100644
--- a/test/shell/lvconvert-snapshot-thin.sh
+++ b/test/shell/lvconvert-snapshot-thin.sh
@@ -29,7 +29,7 @@ lvcreate -L1 -n cow $vg
# Thin and snapshot conversion
lvcreate -T -L1 -V10 -n th $vg/pool
-eval $(lvs -S 'name=~_pmspare' -a -o name --config 'report/mark_hidden_devices=0' --noheading --nameprefixes $vg)
+eval "$(lvs -S 'name=~_pmspare' -a -o name --config 'report/mark_hidden_devices=0' --noheading --nameprefixes $vg)"
# Cannot create snapshot of pool's meta
not lvcreate -s -L1 $vg/pool_tmeta 2>&1 | tee err
diff --git a/test/shell/lvextend-raid.sh b/test/shell/lvextend-raid.sh
index 87ad802c3..5a341c807 100644
--- a/test/shell/lvextend-raid.sh
+++ b/test/shell/lvextend-raid.sh
@@ -21,16 +21,16 @@ aux have_raid 1 15 0 && PROGRESS=1
# Use smallest regionsize to save VG space
regionsize=$(getconf PAGESIZE) # in bytes
-let pageregions=regionsize*8 # number of regions per MD bitmap page
+pageregions=$(( regionsize * 8 )) # number of regions per MD bitmap page
# in KiB
-let regionsize=regionsize/1024
+regionsize=$(( regionsize / 1024 ))
# in MiB
-let lvsz=pageregions*regionsize/1024
-let lvext=lvsz/8
+lvsz=$(( pageregions * regionsize / 1024 ))
+lvext=$(( lvsz / 8 ))
-aux prepare_pvs 2 $(($lvsz + 3 * $lvext))
+aux prepare_pvs 2 $(( lvsz + 3 * lvext ))
get_devs
vgcreate -s 4k $vg ${DEVICES[@]}
@@ -45,12 +45,12 @@ aux zero_dev "$dev1" "${sector}:"
aux delayzero_dev "$dev2" 0 10 "${sector}:"
# Create raid1 LV consuming 1 MD bitmap page
-lvcreate --yes --type raid1 --regionsize ${regionsize}K -L$(($lvsz-$lvext))M -n $lv1 $vg
+lvcreate --yes --type raid1 --regionsize ${regionsize}K -L$(( lvsz - lvext ))M -n $lv1 $vg
lvs -a $vg
not check lv_field $vg/$lv1 sync_percent "100.00"
-check lv_field $vg/$lv1 size "$(($lvsz-$lvext)).00m" $vg/$lv1
+check lv_field $vg/$lv1 size "$(( lvsz - lvext )).00m" $vg/$lv1
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
check lv_field $vg/$lv1 region_size "4.00k"
@@ -65,7 +65,7 @@ if [ $PROGRESS -eq 1 ]
then
# Even with delayed devices wre are catching races here.
should not check lv_field $vg/$lv1 sync_percent "100.00"
-check lv_field $vg/$lv1 size "$(($lvsz)).00m" $vg/$lv1
+check lv_field $vg/$lv1 size "$lvsz.00m" $vg/$lv1
fi
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
@@ -85,6 +85,6 @@ aux enable_dev "$dev2"
aux wait_for_sync $vg $lv1
check lv_field $vg/$lv1 sync_percent "100.00"
-check lv_field $vg/$lv1 size "$(($lvsz+$lvext)).00m" $vg/$lv1
+check lv_field $vg/$lv1 size "$(( lvsz + lvext )).00m" $vg/$lv1
vgremove -ff $vg
diff --git a/test/shell/lvmlockd-lv-types.sh b/test/shell/lvmlockd-lv-types.sh
index ee350b1c6..398c96420 100644
--- a/test/shell/lvmlockd-lv-types.sh
+++ b/test/shell/lvmlockd-lv-types.sh
@@ -52,7 +52,7 @@ vgcreate --shared $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run"
-PVID1=`pvs $dev1 --noheading -o uuid | tr -d - | awk '{print $1}'`
+PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
pvscan --cache -aay "$dev1"
not ls "$RUNDIR/lvm/pvs_online/$PVID1"
pvscan --cache -aay
diff --git a/test/shell/metadata-bad-text.sh b/test/shell/metadata-bad-text.sh
index 038a88485..17f79eb59 100644
--- a/test/shell/metadata-bad-text.sh
+++ b/test/shell/metadata-bad-text.sh
@@ -264,11 +264,11 @@ dd if=/dev/zero of="$dev3" || true
vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3"
-PVID1=`pvs $dev1 --noheading -o uuid | tr -d - | awk '{print $1}'`
+PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
echo $PVID1
-PVID2=`pvs $dev2 --noheading -o uuid | tr -d - | awk '{print $1}'`
+PVID2=$(pvs "$dev2" --noheading -o uuid | tr -d - | awk '{print $1}')
echo $PVID2
-PVID3=`pvs $dev3 --noheading -o uuid | tr -d - | awk '{print $1}'`
+PVID3=$(pvs "$dev3" --noheading -o uuid | tr -d - | awk '{print $1}')
echo $PVID3
pvs
diff --git a/test/shell/metadata-zero-space.sh b/test/shell/metadata-zero-space.sh
index a7efdead0..54fbd8f98 100644
--- a/test/shell/metadata-zero-space.sh
+++ b/test/shell/metadata-zero-space.sh
@@ -28,7 +28,7 @@ pvcreate --pvmetadatacopies 2 "$dev1"
vgcreate $SHARED "$vg" "$dev1"
-for i in `seq 1 50`; do lvcreate -l1 -an $vg; done
+for i in $(seq 1 50); do lvcreate -l1 -an $vg; done
# Check metadata copies are separated by zeroes in the first mda
@@ -53,8 +53,6 @@ cat meta.zeros
grep '0000 0000 0000 0000 0000 0000 0000 0000' meta.zeros > meta.count
-cat meta.count | wc -l
-
# wc will often equal 51, but some natural variability in
# metadata locations/content mean that some lines do not
# require a full line of zero padding, and will not match
@@ -63,7 +61,7 @@ cat meta.count | wc -l
# random choice, and this isn't a perfect way to test for
# zero padding.)
-test "$(cat meta.count | wc -l)" -gt 20
+test "$(wc -l < meta.count)" -gt 20
rm meta.raw meta.txt meta.vg meta.zeros meta.count
@@ -85,8 +83,6 @@ cat meta.zeros
grep '0000 0000 0000 0000 0000 0000 0000 0000' meta.zeros > meta.count
-cat meta.count | wc -l
-
-test "$(cat meta.count | wc -l)" -gt 20
+test "$(wc -l < meta.count)" -gt 20
vgremove -ff $vg
diff --git a/test/shell/mirror-names.sh b/test/shell/mirror-names.sh
index 1019bd3f3..8d525ca51 100644
--- a/test/shell/mirror-names.sh
+++ b/test/shell/mirror-names.sh
@@ -44,11 +44,11 @@ lv_devices_() {
}
lv_mirror_log_() {
- get lv_field "$1" mirror_log | tr -d []
+ get lv_field "$1" mirror_log | tr -d '[]'
}
lv_convert_lv_() {
- get lv_field "$1" convert_lv | tr -d []
+ get lv_field "$1" convert_lv | tr -d '[]'
}
# ---------------------------------------------------------------------
diff --git a/test/shell/multi_hosts_lv_ex_timeout_hosta.sh b/test/shell/multi_hosts_lv_ex_timeout_hosta.sh
index c8be91ee3..d78b6d9c1 100644
--- a/test/shell/multi_hosts_lv_ex_timeout_hosta.sh
+++ b/test/shell/multi_hosts_lv_ex_timeout_hosta.sh
@@ -39,14 +39,14 @@ for d in "${BLKDEVS[@]}"; do
dd if=/dev/zero of="$d" bs=32k count=1
wipefs -a "$d" 2>/dev/null || true
- sg_dev=`sg_map26 ${d}`
+ sg_dev=$(sg_map26 "$d")
if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
echo "Cleanup IDM context for drive ${d} ($sg_dev)"
- sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -r 512 -o idm_tmp_data.bin "$sg_dev" \
88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
- sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -s 512 -i idm_tmp_data.bin "$sg_dev" \
8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
- rm /tmp/idm_tmp_data.bin
+ rm idm_tmp_data.bin
fi
done
@@ -57,14 +57,14 @@ for i in $(seq 1 ${#BLKDEVS[@]}); do
done
for d in "${BLKDEVS[@]}"; do
- drive_wwn=`udevadm info $d | awk -F= '/E: ID_WWN=/ {print $2}'`
+ drive_wwn=$(udevadm info "$d" | awk -F= '/E: ID_WWN=/ {print $2}')
for dev in /dev/*; do
if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
- wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ wwn=$(udevadm info "$dev" | awk -F= '/E: ID_WWN=/ {print $2}')
if [ "$wwn" = "$drive_wwn" ]; then
base_name="$(basename -- ${dev})"
drive_list+=("$base_name")
- host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ host_list+=( $(readlink "/sys/block/$base_name" | awk -F'/' '{print $6}') )
fi
fi
done
diff --git a/test/shell/multi_hosts_lv_hosta.sh b/test/shell/multi_hosts_lv_hosta.sh
index 68404d251..2ae2989d0 100644
--- a/test/shell/multi_hosts_lv_hosta.sh
+++ b/test/shell/multi_hosts_lv_hosta.sh
@@ -42,14 +42,14 @@ for d in "${BLKDEVS[@]}"; do
dd if=/dev/zero of="$d" bs=32k count=1
wipefs -a "$d" 2>/dev/null || true
- sg_dev=`sg_map26 ${d}`
+ sg_dev=$(sg_map26 "$d")
if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
echo "Cleanup IDM context for drive ${d} ($sg_dev)"
- sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -r 512 -o idm_tmp_data.bin "$sg_dev" \
88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
- sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -s 512 -i idm_tmp_data.bin "$sg_dev" \
8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
- rm /tmp/idm_tmp_data.bin
+ rm idm_tmp_data.bin
fi
done
diff --git a/test/shell/multi_hosts_lv_sh_timeout_hosta.sh b/test/shell/multi_hosts_lv_sh_timeout_hosta.sh
index 6b24f9290..798f051e3 100644
--- a/test/shell/multi_hosts_lv_sh_timeout_hosta.sh
+++ b/test/shell/multi_hosts_lv_sh_timeout_hosta.sh
@@ -39,14 +39,14 @@ for d in "${BLKDEVS[@]}"; do
dd if=/dev/zero of="$d" bs=32k count=1
wipefs -a "$d" 2>/dev/null || true
- sg_dev=`sg_map26 ${d}`
+ sg_dev=$(sg_map26 "$d")
if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
echo "Cleanup IDM context for drive ${d} ($sg_dev)"
- sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -r 512 -o idm_tmp_data.bin "$sg_dev" \
88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
- sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -s 512 -i idm_tmp_data.bin "$sg_dev" \
8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
- rm /tmp/idm_tmp_data.bin
+ rm idm_tmp_data.bin
fi
done
@@ -57,21 +57,21 @@ for i in $(seq 1 ${#BLKDEVS[@]}); do
done
for d in "${BLKDEVS[@]}"; do
- drive_wwn=`udevadm info $d | awk -F= '/E: ID_WWN=/ {print $2}'`
+ drive_wwn=$(udevadm info "$d" | awk -F= '/E: ID_WWN=/ {print $2}')
for dev in /dev/*; do
if [ -b "$dev" ] && [[ ! "$dev" =~ [0-9] ]]; then
- wwn=`udevadm info "${dev}" | awk -F= '/E: ID_WWN=/ {print $2}'`
+ wwn=$(udevadm info "$dev" | awk -F= '/E: ID_WWN=/ {print $2}')
if [ "$wwn" = "$drive_wwn" ]; then
base_name="$(basename -- ${dev})"
drive_list+=("$base_name")
- host_list+=(`readlink /sys/block/$base_name | awk -F'/' '{print $6}'`)
+ host_list+=( $(readlink "/sys/block/$base_name" | awk -F'/' '{print $6}') )
fi
fi
done
done
for d in "${drive_list[@]}"; do
- [ -f /sys/block/$d/device/delete ] && echo 1 > /sys/block/$d/device/delete
+ [ -f "/sys/block/$d/device/delete" ] && echo 1 > "/sys/block/$d/device/delete"
done
sleep 100
@@ -83,5 +83,5 @@ done
# Rescan drives so can probe the deleted drives and join back them
for h in "${host_list[@]}"; do
- [ -f /sys/class/scsi_host/${h}/scan ] && echo "- - -" > /sys/class/scsi_host/${h}/scan
+ [ -f "/sys/class/scsi_host/$h/scan" ] && echo "- - -" > "/sys/class/scsi_host/$h/scan"
done
diff --git a/test/shell/open-file-limit.sh b/test/shell/open-file-limit.sh
index 6bd632de2..8e047057e 100644
--- a/test/shell/open-file-limit.sh
+++ b/test/shell/open-file-limit.sh
@@ -27,7 +27,7 @@ for i in $(seq 1 200); do
done
pvs > out
-test "$(grep pv out | wc -l)" -eq 200
+test "$(grep -c pv out)" -eq 200
# Set the soft limit to 100 fd's when 200 PVs need to be open.
# This requires lvm to increase its soft limit in order to
@@ -38,11 +38,11 @@ aux lvmconf 'devices/obtain_device_list_from_udev = 0'
prlimit --nofile=100: pvs > out
-test "$(grep pv out | wc -l)" -eq 200
+test "$(grep -c pv out)" -eq 200
aux lvmconf 'devices/obtain_device_list_from_udev = 1'
prlimit --nofile=100: pvs > out
-test "$(grep pv out | wc -l)" -eq 200
+test "$(grep -c pv out)" -eq 200
diff --git a/test/shell/pvck-repair.sh b/test/shell/pvck-repair.sh
index 0a794da68..ac26285e2 100644
--- a/test/shell/pvck-repair.sh
+++ b/test/shell/pvck-repair.sh
@@ -404,8 +404,8 @@ lvcreate -l1 -an $vg
_clear_devs "$dev1" "$dev2"
vgcreate $vg "$dev1"
pvck --dump headers "$dev1" || true
-UUID1=`pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}'`
-echo $UUID1
+UUID1=$(pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}')
+echo "$UUID1"
dd if=/dev/zero of="$dev1" bs=512 count=2
pvck --dump headers "$dev1" || true
pvck --dump metadata_search --settings seqno=1 -f meta "$dev1" || true
diff --git a/test/shell/report-format.sh b/test/shell/report-format.sh
index 399ed0337..14b53edfb 100644
--- a/test/shell/report-format.sh
+++ b/test/shell/report-format.sh
@@ -34,9 +34,9 @@ lvs -o name,kernel_major,data_percent,tags | tee "$OUT_LOG_FILE"
# lvol2 -1 lv_tag1
# lvol3 253 lv_tag1,lv_tag2,lv_tag3
#
-grep -E "^[[:space:]]*$lv1[[:space:]]*[[:digit:]]+[[:space:]]*[[:digit:]]+.[[:digit:]]+[[:space:]]*\$" out
-grep -E "^[[:space:]]*$lv2[[:space:]]*-1[[:space:]]*lv_tag1[[:space:]]*\$" out
-grep -E "^[[:space:]]*$lv3[[:space:]]*[[:digit:]]+[[:space:]]*lv_tag1,lv_tag2,lv_tag3\$" out
+grep -E "^[[:space:]]*${lv1}[[:space:]]*[[:digit:]]+[[:space:]]*[[:digit:]]+.[[:digit:]]+[[:space:]]*\$" out
+grep -E "^[[:space:]]*${lv2}[[:space:]]*-1[[:space:]]*lv_tag1[[:space:]]*\$" out
+grep -E "^[[:space:]]*${lv3}[[:space:]]*[[:digit:]]+[[:space:]]*lv_tag1,lv_tag2,lv_tag3\$" out
aux lvmconf "report/output_format = json"
diff --git a/test/shell/udev-pvscan-vgchange.sh b/test/shell/udev-pvscan-vgchange.sh
index eb6984078..e9fda5797 100644
--- a/test/shell/udev-pvscan-vgchange.sh
+++ b/test/shell/udev-pvscan-vgchange.sh
@@ -336,7 +336,7 @@ ls "$RUNDIR/lvm/vgs_online/$vg8"
journalctl -u lvm-activate-$vg8 | tee out || true
grep "now active" out
-num_active=$(lvs $vg8 --noheading -o active | grep active | wc -l)
+num_active=$(lvs $vg8 --noheading -o active | grep -c active)
test $num_active -eq $TEST_DEVS
@@ -375,7 +375,7 @@ wait_md_create "$mddev"
vgcreate $vg9 "$mddev"
lvmdevices --adddev "$mddev" || true
-PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
+PVIDMD=$(pvs "$mddev" --noheading -o uuid | tr -d - | awk '{print $1}')
BDEVMD=$(basename "$mddev")
lvcreate -l1 -an -n $lv1 $vg9
@@ -419,7 +419,7 @@ lvcreate -l1 -an -n $lv1 $vg10 "$dev1"
PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
# PVID with dashes
-OPVID1=`pvs "$dev1" --noheading -o uuid | awk '{print $1}'`
+OPVID1=$(pvs "$dev1" --noheading -o uuid | awk '{print $1}')
udevadm trigger --settle -c add /sys/block/$BDEV1
diff --git a/test/shell/vgchange-pvs-online.sh b/test/shell/vgchange-pvs-online.sh
index a1fc3a427..dab7f5ad7 100644
--- a/test/shell/vgchange-pvs-online.sh
+++ b/test/shell/vgchange-pvs-online.sh
@@ -86,15 +86,15 @@ _clear_online_files
pvscan --cache "$bd1"
pvscan --cache "$bd2"
strace -e io_submit vgchange -aay --autoactivation event $vg1 2>&1|tee trace.out
-test "$(grep io_submit trace.out | wc -l)" -eq 3
+test "$(grep -c io_submit trace.out)" -eq 3
rm trace.out
strace -e io_submit pvscan --cache "$bd3" 2>&1|tee trace.out
-test "$(grep io_submit trace.out | wc -l)" -eq 1
+test "$(grep -c io_submit trace.out)" -eq 1
rm trace.out
strace -e io_submit vgchange -aay --autoactivation event $vg2 2>&1|tee trace.out
-test "$(grep io_submit trace.out | wc -l)" -eq 2
+test "$(grep -c io_submit trace.out)" -eq 2
rm trace.out
fi
3 months, 3 weeks
main - tests: cleanup some shellcheck warns
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=773bc013778df631f9e...
Commit: 773bc013778df631f9ee14e7a79d5f02211b1e67
Parent: cc2293f18ed14f4b306c7e5b92e508a6981b4826
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 16:04:54 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
tests: cleanup some shellcheck warns
Reduce shellcheck warnings about missing {} for possible array
dereference.
Make sure we are not loosing error code when assigning local vars
and explicitely ignore 'errors' from standalone lines when needed.
Add some missing quotes.
Use $() instead of ancient ``
Avoid writing some temporary data into /tmp - test need to store
files within its own 'testdir' - so it can be properly discarded.
---
scripts/lvm_import_vdo.sh | 4 ++--
test/lib/aux.sh | 48 ++++++++++++++++++++++++---------------------
test/lib/get.sh | 6 +++---
test/lib/lvm_vdo_wrapper.sh | 4 +++-
4 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index c4c1d152e..134c96513 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -255,11 +255,11 @@ convert2lvm_() {
# Find largest matching VG name to our 'default' vgname
LASTVGNAME=$(LC_ALL=C "$LVM" vgs -oname -O-name --noheadings -S name=~${VGNAME} | grep -E "${VGNAME}[0-9]? ?" | head -1 || true)
if test -n "$LASTVGNAME" ; then
- LASTVGNAME=${LASTVGNAME#*${VGNAME}}
+ LASTVGNAME=${LASTVGNAME#*"${VGNAME}"}
# If the number is becoming too high, try some random number
test "$LASTVGNAME" -gt 99999999 2>/dev/null && LASTVGNAME=$RANDOM
# Generate new unused VG name
- VGNAME="${VGNAME}$(( ${LASTVGNAME} + 1 ))"
+ VGNAME="${VGNAME}$(( LASTVGNAME + 1 ))"
verbose "Selected unused volume group name $VGNAME."
fi
fi
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 58439d62d..ccc787eca 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -387,7 +387,8 @@ teardown_devs_prefixed() {
wait
- local mounts=( $(grep "$prefix" /proc/mounts | cut -d' ' -f1) )
+ local mounts
+ mounts=( $(grep "$prefix" /proc/mounts | cut -d' ' -f1) ) || true
if test ${#mounts[@]} -gt 0; then
test "$stray" -eq 0 || echo "## removing stray mounted devices containing $prefix:" "${mounts[@]}"
if umount -fl "${mounts[@]}"; then
@@ -464,7 +465,8 @@ teardown_devs() {
# Attempt to remove any loop devices that failed to get torn down if earlier tests aborted
test "${LVM_TEST_PARALLEL:-0}" -eq 1 || test -z "$COMMON_PREFIX" || {
- local stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) )
+ local stray_loops
+ stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) ) || true
test ${#stray_loops[@]} -eq 0 || {
teardown_devs_prefixed "$COMMON_PREFIX" 1
echo "## removing stray loop devices containing $COMMON_PREFIX:" "${stray_loops[@]}"
@@ -626,7 +628,7 @@ prepare_loop() {
echo -n "## preparing loop device..."
# skip if prepare_scsi_debug_dev() was used
- if test -f SCSI_DEBUG_DEV -a -f LOOP ; then
+ if test -f SCSI_DEBUG_DEV && test -f LOOP ; then
echo "(skipped)"
return 0
fi
@@ -689,7 +691,7 @@ prepare_real_devs() {
if test -n "$LVM_TEST_DEVICE_LIST"; then
local count=0
while read path; do
- REAL_DEVICES[$count]=$path
+ REAL_DEVICES[count]=$path
count=$(( count + 1 ))
aux extend_filter "a|$path|"
dd if=/dev/zero of="$path" bs=32k count=1
@@ -901,13 +903,13 @@ cleanup_idm_context() {
local dev=$1
if [ -n "$LVM_TEST_LOCK_TYPE_IDM" ]; then
- sg_dev=`sg_map26 ${dev}`
+ sg_dev=$(sg_map26 "${dev}")
echo "Cleanup IDM context for drive ${dev} ($sg_dev)"
- sg_raw -v -r 512 -o /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -r 512 -o idm_tmp_data.bin "$sg_dev" \
88 00 01 00 00 00 00 20 FF 01 00 00 00 01 00 00
- sg_raw -v -s 512 -i /tmp/idm_tmp_data.bin $sg_dev \
+ sg_raw -v -s 512 -i idm_tmp_data.bin "$sg_dev" \
8E 00 FF 00 00 00 00 00 00 00 00 00 00 01 00 00
- rm /tmp/idm_tmp_data.bin
+ rm idm_tmp_data.bin
fi
}
@@ -976,12 +978,12 @@ prepare_devs() {
for i in $(seq 1 "$n"); do
local name="${PREFIX}$pvname$i"
local dev="$DM_DEV_DIR/mapper/$name"
- DEVICES[$count]=$dev
+ DEVICES[count]=$dev
count=$(( count + 1 ))
# If the backing device number can meet the requirement for PV devices,
# then allocate a dedicated backing device for PV; otherwise, rollback
# to use single backing device for device-mapper.
- if [ -n "$LVM_TEST_BACKING_DEVICE" ] && [ $n -le ${#BACKING_DEVICE_ARRAY[@]} ]; then
+ if [ -n "$LVM_TEST_BACKING_DEVICE" ] && [ "$n" -le ${#BACKING_DEVICE_ARRAY[@]} ]; then
echo 0 $size linear "${BACKING_DEVICE_ARRAY[$(( count - 1 ))]}" $(( header_shift * 2048 )) > "$name.table"
else
echo 0 $size linear "$BACKING_DEV" $(( ( i - 1 ) * size + ( header_shift * 2048 ) )) > "$name.table"
@@ -1005,7 +1007,7 @@ prepare_devs() {
if [ -n "$LVM_TEST_BACKING_DEVICE" ]; then
for d in "${BACKING_DEVICE_ARRAY[@]}"; do
- cnt=$((`blockdev --getsize64 $d` / 1024 / 1024))
+ cnt=$(( $(blockdev --getsize64 "$d") / 1024 / 1024 ))
cnt=$(( cnt < 1000 ? cnt : 1000 ))
dd if=/dev/zero of="$d" bs=1MB count=$cnt
wipefs -a "$d" 2>/dev/null || true
@@ -1209,7 +1211,9 @@ throttle_dm_mirror() {
# if the kernel config file is present, validate whether the kernel uses HZ_1000
# and return failure for this 'throttling' when it does NOT as without this setting
# whole throttling is pointless on modern hardware
- local kconfig="/boot/config-$(uname -r)"
+ local kconfig
+
+ kconfig="/boot/config-$(uname -r)"
if test -e "$kconfig" ; then
grep -q "CONFIG_HZ_1000=y" "$kconfig" 2>/dev/null || {
echo "WARNING: CONFIG_HZ_1000=y is NOT set in $kconfig -> throttling is unusable"
@@ -1218,7 +1222,7 @@ throttle_dm_mirror() {
fi
test -e "$throttle_sys" || return
test -f THROTTLE || cat "$throttle_sys" > THROTTLE
- echo ${1-1} > "$throttle_sys"
+ echo "${1-1}" > "$throttle_sys"
}
# Restore original kcopyd throttle value and have mirroring fast again
@@ -1247,10 +1251,10 @@ restore_from_devtable() {
local name=${dev##*/}
dmsetup load "$name" "$name.devtable"
if not dmsetup resume "$name" ; then
- dmsetup clear $name
- dmsetup resume $name
+ dmsetup clear "$name"
+ dmsetup resume "$name"
finish_udev_transaction
- echo "Device $name has unusable table \"$(cat $name.devtable)\""
+ echo "Device $name has unusable table \"$(cat "$name.devtable")\""
return 1
fi
done
@@ -1357,7 +1361,7 @@ extend_devices() {
test -z "$LVM_TEST_DEVICES_FILE" && return
for dev in "$@"; do
- lvmdevices --adddev $dev
+ lvmdevices --adddev "$dev"
done
}
@@ -1395,7 +1399,7 @@ hide_dev() {
if test -n "$LVM_TEST_DEVICES_FILE"; then
for dev in "$@"; do
- lvmdevices --deldev $dev
+ lvmdevices --deldev "$dev"
done
else
filter=$(grep ^devices/global_filter CONFIG_VALUES | tail -n 1)
@@ -1411,7 +1415,7 @@ unhide_dev() {
if test -n "$LVM_TEST_DEVICES_FILE"; then
for dev in "$@"; do
- lvmdevices -y --adddev $dev
+ lvmdevices -y --adddev "$dev"
done
else
filter=$(grep ^devices/global_filter CONFIG_VALUES | tail -n 1)
@@ -1844,13 +1848,13 @@ have_cache() {
declare -a CONF=()
# disable cache_check if not present in system
- if test -n "$LVM_TEST_CACHE_CHECK_CMD" -a ! -x "$LVM_TEST_CACHE_CHECK_CMD" ; then
+ if test -n "$LVM_TEST_CACHE_CHECK_CMD" && test ! -x "$LVM_TEST_CACHE_CHECK_CMD" ; then
CONF[0]="global/cache_check_executable = \"\""
fi
- if test -n "$LVM_TEST_CACHE_DUMP_CMD" -a ! -x "$LVM_TEST_CACHE_DUMP_CMD" ; then
+ if test -n "$LVM_TEST_CACHE_DUMP_CMD" && test ! -x "$LVM_TEST_CACHE_DUMP_CMD" ; then
CONF[1]="global/cache_dump_executable = \"\""
fi
- if test -n "$LVM_TEST_CACHE_REPAIR_CMD" -a ! -x "$LVM_TEST_CACHE_REPAIR_CMD" ; then
+ if test -n "$LVM_TEST_CACHE_REPAIR_CMD" && test ! -x "$LVM_TEST_CACHE_REPAIR_CMD" ; then
CONF[2]="global/cache_repair_executable = \"\""
fi
if test ${#CONF[@]} -ne 0 ; then
diff --git a/test/lib/get.sh b/test/lib/get.sh
index afc10bce5..3b0d1f21a 100644
--- a/test/lib/get.sh
+++ b/test/lib/get.sh
@@ -23,8 +23,8 @@ test -z "$BASH" || set -e -o pipefail
# trims only leading prefix and suffix
trim_() {
rm -f debug.log # drop log, command was ok
- local var=${1%${1##*[! ]}} # remove trailing space characters
- echo "${var#${var%%[! ]*}}" # remove leading space characters
+ local var=${1%"${1##*[! ]}"} # remove trailing space characters
+ echo "${var#"${var%%[! ]*}"}" # remove leading space characters
}
pv_field() {
@@ -68,7 +68,7 @@ lv_devices() {
}
lv_field_lv_() {
- lv_field "$1" "$2" -a --unbuffered | tr -d []
+ lv_field "$1" "$2" -a --unbuffered | tr -d '[]'
}
lv_tree_devices_() {
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
index d90ba8d42..bcc3781f7 100755
--- a/test/lib/lvm_vdo_wrapper.sh
+++ b/test/lib/lvm_vdo_wrapper.sh
@@ -87,8 +87,10 @@ local vdo_maxDiscardSize=${vdo_maxDiscardSize-4K}
local vdo_name=${vdo_name-VDONAME}
local vdo_physicalThreads=${vdo_physicalThreads-1}
local vdo_slabSize=${vdo_slabSize-2G}
-local vdo_uuid="VDO-$(uuidgen || echo \"f7a3ecdc-40a0-4e43-814c-4a7039a75de4\")"
local vdo_writePolicy=${vdo_writePolicy-auto}
+local vdo_uuid
+
+vdo_uuid="VDO-$(uuidgen || echo \"f7a3ecdc-40a0-4e43-814c-4a7039a75de4\")"
while [ "$#" -ne 0 ]
do
3 months, 3 weeks
main - tests: avoid using length
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cc2293f18ed14f4b306...
Commit: cc2293f18ed14f4b306c7e5b92e508a6981b4826
Parent: 30b9d4d4aa7da8dda586fb041b88830bcc2e60de
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 14:02:17 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
tests: avoid using length
Use ${# for length instead.
---
test/lib/utils.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 1d1ed48bf..ca9f5ec61 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -87,7 +87,7 @@ mkdtemp() {
base_template=$(echo "$template" | sed 's/XX*$//')
# Calculate how many X's we've just removed.
- nx=$(expr length "$template" - length "$base_template")
+ nx=$(( ${#template} - ${#base_template} ))
err=
i=1
3 months, 3 weeks
main - tests: remove blank line
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=30b9d4d4aa7da8dda58...
Commit: 30b9d4d4aa7da8dda586fb041b88830bcc2e60de
Parent: b29b8e0bb293762dafd98bfbca0e225b23f0343b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 13:35:11 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
tests: remove blank line
---
test/shell/vgimportdevices.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/test/shell/vgimportdevices.sh b/test/shell/vgimportdevices.sh
index 47363cec3..b6917c110 100644
--- a/test/shell/vgimportdevices.sh
+++ b/test/shell/vgimportdevices.sh
@@ -1,4 +1,3 @@
-
#!/usr/bin/env bash
# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
3 months, 3 weeks
main - tests: fix cutandpaste bug in wrapper
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b29b8e0bb293762dafd...
Commit: b29b8e0bb293762dafd98bfbca0e225b23f0343b
Parent: a0437225aa799ed4685e60534fcbdc867fd26947
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 13:42:11 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
tests: fix cutandpaste bug in wrapper
Use correct variable name for assign.
---
test/lib/lvm_vdo_wrapper.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
index 25a6ce0fe..d90ba8d42 100755
--- a/test/lib/lvm_vdo_wrapper.sh
+++ b/test/lib/lvm_vdo_wrapper.sh
@@ -113,7 +113,7 @@ do
"--vdoLogicalSize") shift; vdo_logicalSize=$1 ;;
"--vdoLogicalThreads") shift; vdo_logicalThreads=$1 ;;
"--vdoLogLevel") shift ;; # ignored
- "--vdoPhysicalThreads") shift; vdo_physicalSize=$1 ;;
+ "--vdoPhysicalThreads") shift; vdo_physicalThreads=$1 ;;
"--vdoSlabSize") shift; vdo_slabSize=$1 ;;
"--verbose"|"-d"|"--debug") vdo_verbose="-v" ;;
"--writePolicy") shift; vdo_writePolicy=$1 ;;
3 months, 3 weeks
main - makefiles: avoid piping
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0437225aa799ed4685...
Commit: a0437225aa799ed4685e60534fcbdc867fd26947
Parent: a032e07578ecdb459470cced8e118ce57088d033
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 22:33:31 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
makefiles: avoid piping
Addressing problem for user of system without default bash shell.
As reported "set -o pipefail" is a bashism that causes the build to
fail when /bin/sh does not point to bash.
For example, this has been observed causing build failures
on Gentoo when /bin/sh is symlinked to /bin/dash.
Rule has been reworked and we started to use .DELETE_ON_ERROR to
ensure that with any errors during file generation, such invalid
file is automatically removed.
Rules were reworked to avoid using pipe and instead use temporary
files when necessary.
Printing lines with echo was replaced with POSIX recomended 'printf'
as proposed by reporter since handling of escape characters and
the "-n" flag for "echo" aren't portable across shells.
Also some build deps has been added.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1822280
Gentoo-bug: https://bugs.gentoo.org/682404
Gentoo-bug: https://bugs.gentoo.org/716496
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1822280
Reported-by: Michael Orlitzky <michael(a)orlitzky.com>
TODO: investage if the temporary files could be handled via some
intermediate target solution - ATM I couldn't make it work equally
well as current solution use shell 'trap' to remove temp file.
---
include/Makefile.in | 16 ++++++++--------
tools/Makefile.in | 24 +++++++++++++-----------
tools/license.inc | 2 +-
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/include/Makefile.in b/include/Makefile.in
index fc184ed09..60b93f495 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2023 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -18,23 +18,23 @@ top_builddir = @top_builddir@
include $(top_builddir)/make.tmpl
-cmds.h:
+.DELETE_ON_ERROR:
+cmds.h: $(top_srcdir)/tools/command-lines.in $(top_srcdir)/tools/license.inc Makefile
@echo " [GEN] $@"
- $(Q) set -o pipefail && \
+ $(Q) \
( cat $(top_srcdir)/tools/license.inc && \
echo "/* Do not edit. This file is generated by the Makefile. */" && \
echo "cmd(CMD_NONE, none)" && \
- $(GREP) '^ID:' $(top_srcdir)/tools/command-lines.in | LC_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
+ trap "$(RM) $@-t" EXIT INT QUIT TERM && \
+ $(AWK) '/^ID:/ {print "cmd(" $$2 "_CMD, " $$2 ")"}' $< >$@-t && \
+ LC_ALL=C $(SORT) -u $@-t && \
echo "cmd(CMD_COUNT, count)" \
) > $@
all: cmds.h
-clean:
- rm -f cmds.h
-
DISTCLEAN_TARGETS += configure.h lvm-version.h
-CLEAN_TARGETS += \
+CLEAN_TARGETS += cmds.h cmds.h-t \
.symlinks \
.symlinks_created \
activate.h \
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 4e196ab1e..2a663a5b6 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2023 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -166,23 +166,25 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
$(Q) $(CC) -E -P $< 2> /dev/null | \
$(EGREP) -v '^ *(|#.*|config|devtypes|dumpconfig|formats|fullreport|help|lastlog|lvmchange|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands
-command-count.h: $(srcdir)/command-lines.in Makefile
+.DELETE_ON_ERROR:
+command-count.h: $(srcdir)/command-lines.in $(srcdir)/license.inc Makefile
@echo " [GEN] $@"
- $(Q) set -o pipefail && \
- ( cat $(top_srcdir)/tools/license.inc && \
+ $(Q) \
+ ( cat $(srcdir)/license.inc && \
echo "/* Do not edit. This file is generated by the Makefile. */" && \
- echo -n "#define COMMAND_COUNT " && \
- $(GREP) '^ID:' $< | $(WC) -l \
+ printf "#define COMMAND_COUNT " && \
+ $(GREP) -c '^ID:' $< \
) > $@
-command-lines-input.h: $(srcdir)/command-lines.in Makefile
+.DELETE_ON_ERROR:
+command-lines-input.h: $(srcdir)/command-lines.in $(srcdir)/license.inc Makefile
@echo " [GEN] $@"
- $(Q) set -o pipefail && \
+ $(Q) \
( cat $(srcdir)/license.inc && \
echo "/* Do not edit. This file is generated by the Makefile. */" && \
- echo -en "static const char _command_input[] =\n\n\"" && \
- $(EGREP) -v '^#|\-\-\-|^$$' $(srcdir)/command-lines.in | $(AWK) 'BEGIN {ORS = "\\n\"\n\""} //' && \
- echo "\\n\\n\";" \
+ printf "static const char _command_input[] =\n\n\"" && \
+ $(AWK) 'BEGIN {ORS = "\\n\"\n\""} !/^#/ && !/---/ && !/^$$/' $(srcdir)/command-lines.in && \
+ printf '\\n\\n";\n' \
) > $@
$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h
diff --git a/tools/license.inc b/tools/license.inc
index 5ba3e66d4..58e2441d8 100644
--- a/tools/license.inc
+++ b/tools/license.inc
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2023 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
3 months, 3 weeks
main - makefiles: keep removing anchient files
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a032e07578ecdb45947...
Commit: a032e07578ecdb459470cced8e118ce57088d033
Parent: 35e1f15e0386341617c5810c481a2c8d227026d1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 9 22:50:59 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100
makefiles: keep removing anchient files
Commit dropping lvmetad support 117160b27e510dceb1ed6acf995115c040acd88d
also removed cleaning of its generated files. However we need to keep
this functionality, otherwise we can leak them during various bisect.
Easier is to keep such rules forever.
Also commit c1ab9fb37faee56cee278ccd94cb958d30d61b94 moved cmds.h to
include, so again keep it removed so it's not left there and in any
case could not misslead anyone.
---
include/Makefile.in | 2 ++
tools/Makefile.in | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/Makefile.in b/include/Makefile.in
index 88a06a934..fc184ed09 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -86,6 +86,8 @@ CLEAN_TARGETS += \
lvm2app.h \
lvm2cmd.h \
lvmcache.h \
+ lvmetad-client.h \
+ lvmetad.h \
lvmlockd-client.h \
lvmlockd.h \
lvmnotify.h \
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 49d9b89c7..4e196ab1e 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -97,7 +97,7 @@ INCLUDES = -I$(top_builddir)/tools
CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
liblvm2cmd-static.a lvm.static \
- $(LDDEPS) .exported_symbols_generated \
+ $(LDDEPS) .exported_symbols_generated cmds.h \
command-lines-input.h command-count.h man-generator.c
ifeq ("@CMDLIB@", "yes")
3 months, 3 weeks