main - cov: ignore close result
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7b5f490c53368b9591...
Commit: e7b5f490c53368b9591fe8c5561de4371207f882
Parent: 6668d6409aa841839b8eefc2a49d004b0c29397a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 14:42:34 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 23:40:29 2021 +0200
cov: ignore close result
---
test/unit/bcache_utils_t.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/unit/bcache_utils_t.c b/test/unit/bcache_utils_t.c
index daed0ce39..f05292474 100644
--- a/test/unit/bcache_utils_t.c
+++ b/test/unit/bcache_utils_t.c
@@ -86,7 +86,7 @@ static void *_fix_init(struct io_engine *engine)
}
if (!_runs_is_tmpfs) {
- close(f->fd);
+ (void) close(f->fd);
// reopen with O_DIRECT
f->fd = open(f->fname, O_RDWR | O_DIRECT);
T_ASSERT(f->fd >= 0);
2 years, 6 months
main - cov: validate subcommand existance
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6668d6409aa841839b8...
Commit: 6668d6409aa841839b8eefc2a49d004b0c29397a
Parent: 2779830a060730801ae6b055c2332301bf913c0f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 14:42:20 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 23:39:25 2021 +0200
cov: validate subcommand existance
Before dereference of subcommand pointer, check it's not NULL
as coverity believes there exists theoretical path for this...
---
libdm/dm-tools/dmsetup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index 07b6cca8a..8502d9adc 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -5846,12 +5846,12 @@ static int _stats_report(CMD_ARGS)
if (_switches[ALL_PROGRAMS_ARG])
_program_id = "";
- if (_switches[VERBOSE_ARG] && !strcmp(subcommand, "list"))
+ if (_switches[VERBOSE_ARG] && subcommand && !strcmp(subcommand, "list"))
_statstype |= (DM_STATS_WALK_ALL
| DM_STATS_WALK_SKIP_SINGLE_AREA);
/* suppress duplicates unless the user has requested all regions */
- if (!strcmp(subcommand, "report") && !objtype_args)
+ if (subcommand && !objtype_args && !strcmp(subcommand, "report"))
/* suppress duplicate rows of output */
_statstype |= (DM_STATS_WALK_ALL
| DM_STATS_WALK_SKIP_SINGLE_AREA);
2 years, 6 months
main - cov: avoid using NULL info
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2779830a060730801ae...
Commit: 2779830a060730801ae6b055c2332301bf913c0f
Parent: 8aefd97252ab5cde9811d93138239f3defeee73b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 14:42:10 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 23:36:22 2021 +0200
cov: avoid using NULL info
Check lvmcache info exists before calling lvmcache_del_save_bad_mda().
---
lib/format_text/format-text.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 941a34944..00443faa1 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -465,7 +465,7 @@ static struct volume_group *_vg_read_raw(struct cmd_context *cmd,
vg = _vg_read_raw_area(cmd, fid, vgname, &mdac->area, vg_fmtdata, use_previous_vg, 0, mda_is_primary(mda));
- if (!vg && !*use_previous_vg) {
+ if (!vg && use_previous_vg && !*use_previous_vg) {
/*
* This condition (corrupt metadata text) is often seen in the
* label_scan()/_text_read() phase, where this code corresponds to
@@ -477,8 +477,12 @@ static struct volume_group *_vg_read_raw(struct cmd_context *cmd,
struct lvmcache_info *info = lvmcache_info_from_pvid(dev->pvid, dev, 0);
log_warn("WARNING: reading %s mda%d failed to read metadata.", dev_name(dev), mda_is_primary(mda)?1:2);
log_warn("WARNING: repair VG metadata on %s with vgck --updatemetadata.", dev_name(dev));
- /* remove mda from lvmcache, saving it in info->bad_mdas for possible repair with updatemetadata */
- lvmcache_del_save_bad_mda(info, mda->mda_num, BAD_MDA_TEXT);
+ if (info)
+ /* remove mda from lvmcache, saving it in info->bad_mdas for possible repair with updatemetadata */
+ lvmcache_del_save_bad_mda(info, mda->mda_num, BAD_MDA_TEXT);
+ else
+ log_warn("WARNING: No cache info for %s", dev_name(dev));
+
/* remove mda from fid */
fid_remove_mda(fid, mda, NULL, 0, 0);
}
2 years, 6 months
main - configure: fix use of withval
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8aefd97252ab5cde981...
Commit: 8aefd97252ab5cde9811d93138239f3defeee73b
Parent: bf87b8354d07dbddc520e8b61543128e2b2f1924
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 23:33:59 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 23:35:05 2021 +0200
configure: fix use of withval
Newly added option --with-default-use-devices-file needs to use withval.
---
configure | 3 +--
configure.ac | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 642cb4f6b..5719be836 100755
--- a/configure
+++ b/configure
@@ -8467,11 +8467,10 @@ $as_echo_n "checking default for use_devicesfile... " >&6; }
# Check whether --with-default-use-devices-file was given.
if test "${with_default_use_devices_file+set}" = set; then :
- withval=$with_default_use_devices_file; DEFAULT_USE_DEVICES_FILE=$enableval
+ withval=$with_default_use_devices_file; DEFAULT_USE_DEVICES_FILE=$withval
else
DEFAULT_USE_DEVICES_FILE=0
fi
-
case "$DEFAULT_USE_DEVICES_FILE" in
0|1);;
*) as_fn_error $? "--with-default-use-devices-file parameter invalid" "$LINENO" 5;;
diff --git a/configure.ac b/configure.ac
index 0069e5d36..2f821edae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,7 +290,7 @@ dnl -- Default settings for lvm.conf { devices/use_devicesfile }
AC_MSG_CHECKING(default for use_devicesfile)
AC_ARG_WITH(default-use-devices-file,
AS_HELP_STRING([--with-default-use-devices-file], [default for lvm.conf devices/use_devicesfile = [0]]),
- DEFAULT_USE_DEVICES_FILE=$enableval, DEFAULT_USE_DEVICES_FILE=0)
+ DEFAULT_USE_DEVICES_FILE=$withval, DEFAULT_USE_DEVICES_FILE=0)
case "$DEFAULT_USE_DEVICES_FILE" in
0|1);;
*) AC_MSG_ERROR([--with-default-use-devices-file parameter invalid]);;
2 years, 6 months
main - configure: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bf87b8354d07dbddc52...
Commit: bf87b8354d07dbddc520e8b61543128e2b2f1924
Parent: 9d87549f8096759a70ce91119ebc71e8fdde0294
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 10:08:26 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 10:11:34 2021 +0200
configure: update
---
configure | 161 ++++++++++++++++++++++++--------------------------------------
1 file changed, 63 insertions(+), 98 deletions(-)
diff --git a/configure b/configure
index 808029a79..642cb4f6b 100755
--- a/configure
+++ b/configure
@@ -8780,7 +8780,7 @@ $as_echo "$as_me: WARNING: thin_check not found in path $PATH" >&2;}
THIN_CONFIGURE_WARN=y
fi
fi
- if test "$THIN_CHECK_NEEDS_CHECK" = yes; then
+ if test "$THIN_CHECK_NEEDS_CHECK" = yes && test "$THIN_CONFIGURE_WARN" != y ; then
THIN_CHECK_VSN=`"$THIN_CHECK_CMD" -V 2>/dev/null`
THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
@@ -9328,7 +9328,7 @@ $as_echo "$as_me: WARNING: cache_check not found in path $PATH" >&2;}
CACHE_CONFIGURE_WARN=y
fi
fi
- if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
+ if test "$CACHE_CHECK_NEEDS_CHECK" = yes && test "$CACHE_CONFIGURE_WARN" != y ; then
$CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
read -r CACHE_CHECK_VSN < conftest.tmp
IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
@@ -11567,13 +11567,34 @@ fi
fi
-SYSTEMD_MIN_VERSION=
+SYSTEMD_MIN_VERSION=0
+pkg_config_init
+if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ SYSTEMD_MIN_VERSION=205
+fi
+
################################################################################
+if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 221\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "systemd >= 221") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ SYSTEMD_MIN_VERSION=221
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build notifydbus" >&5
$as_echo_n "checking whether to build notifydbus... " >&6; }
# Check whether --enable-notify-dbus was given.
if test "${enable_notify_dbus+set}" = set; then :
- enableval=$enable_notify_dbus; NOTIFYDBUS_SUPPORT=$enableval
+ enableval=$enable_notify_dbus; if test "$enableval" = yes && test "$SYSTEMD_MIN_VERSION" -lt 221; then :
+ as_fn_error $? "Enabling notify-dbus requires systemd >= 221" "$LINENO" 5
+fi
+ NOTIFYDBUS_SUPPORT=$enableval
else
NOTIFYDBUS_SUPPORT=no
fi
@@ -11585,13 +11606,19 @@ if test "$NOTIFYDBUS_SUPPORT" = yes; then :
$as_echo "#define NOTIFYDBUS_SUPPORT 1" >>confdefs.h
- SYSTEMD_MIN_VERSION=221
fi
################################################################################
+if test "$SYSTEMD_MIN_VERSION" -ge 221; then :
+ SYSTEMD_JOURNAL_SUPPORT=maybe
+else
+ SYSTEMD_JOURNAL_SUPPORT=no
+fi
ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-journal.h" "ac_cv_header_systemd_sd_journal_h" "$ac_includes_default"
if test "x$ac_cv_header_systemd_sd_journal_h" = xyes; then :
+ if test "$SYSTEMD_JOURNAL_SUPPORT" != no; then :
SYSTEMD_JOURNAL_SUPPORT=yes
+fi
else
SYSTEMD_JOURNAL_SUPPORT=no
fi
@@ -11602,7 +11629,7 @@ $as_echo_n "checking whether to log to systemd journal... " >&6; }
# Check whether --enable-systemd-journal was given.
if test "${enable_systemd_journal+set}" = set; then :
enableval=$enable_systemd_journal; if test "$enableval" = yes && test "$SYSTEMD_JOURNAL_SUPPORT" = no; then :
- as_fn_error $? "Enabling systemd journaling requires systemd/sd-journal.h." "$LINENO" 5
+ as_fn_error $? "Enabling systemd journal requires systemd/sd-journal.h and systemd >= 221." "$LINENO" 5
fi
SYSTEMD_JOURNAL_SUPPORT=$enableval
fi
@@ -11614,24 +11641,35 @@ if test "$SYSTEMD_JOURNAL_SUPPORT" = yes; then :
$as_echo "#define SYSTEMD_JOURNAL_SUPPORT 1" >>confdefs.h
- SYSTEMD_MIN_VERSION=221
fi
################################################################################
+if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 234\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "systemd >= 234") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ SYSTEMD_MIN_VERSION=234 APP_MACHINEID_SUPPORT=maybe
+else
+ APP_MACHINEID_SUPPORT=no
+fi
ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-id128.h" "ac_cv_header_systemd_sd_id128_h" "$ac_includes_default"
if test "x$ac_cv_header_systemd_sd_id128_h" = xyes; then :
+ if test "$APP_MACHINEID_SUPPORT" != no; then :
APP_MACHINEID_SUPPORT=yes
+fi
else
APP_MACHINEID_SUPPORT=no
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build appmachineid" >&5
-$as_echo_n "checking whether to build appmachineid... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support systemd appmachineid" >&5
+$as_echo_n "checking whether to support systemd appmachineid... " >&6; }
# Check whether --enable-app-machineid was given.
if test "${enable_app_machineid+set}" = set; then :
enableval=$enable_app_machineid; if test "$enableval" = yes && test "$APP_MACHINEID_SUPPORT" = no; then :
- as_fn_error $? "Enabling app machineid requires systemd/sd-id128.h." "$LINENO" 5
+ as_fn_error $? "Enabling app machineid requires systemd/sd-id128.h and systemd >= 234." "$LINENO" 5
fi
APP_MACHINEID_SUPPORT=$enableval
fi
@@ -11643,10 +11681,9 @@ if test "$APP_MACHINEID_SUPPORT" = yes; then :
$as_echo "#define APP_MACHINEID_SUPPORT 1" >>confdefs.h
- SYSTEMD_MIN_VERSION=234
fi
-if test -n "$SYSTEMD_MIN_VERSION"; then :
+if test "$NOTIFYDBUS_SUPPORT" = yes || test "$SYSTEMD_JOURNAL_SUPPORT" = yes || test "$APP_MACHINEID_SUPPORT" = yes ; then :
pkg_config_init
@@ -11658,12 +11695,12 @@ if test -n "$SYSTEMD_CFLAGS"; then
pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= \"\$SYSTEMD_MIN_VERSION\"\""; } >&5
- ($PKG_CONFIG --exists --print-errors "systemd >= "$SYSTEMD_MIN_VERSION"") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "systemd") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd >= "$SYSTEMD_MIN_VERSION"" 2>/dev/null`
+ pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -11675,12 +11712,12 @@ if test -n "$SYSTEMD_LIBS"; then
pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= \"\$SYSTEMD_MIN_VERSION\"\""; } >&5
- ($PKG_CONFIG --exists --print-errors "systemd >= "$SYSTEMD_MIN_VERSION"") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "systemd") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd >= "$SYSTEMD_MIN_VERSION"" 2>/dev/null`
+ pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -11701,9 +11738,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= "$SYSTEMD_MIN_VERSION"" 2>&1`
+ SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd" 2>&1`
else
- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= "$SYSTEMD_MIN_VERSION"" 2>&1`
+ SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$SYSTEMD_PKG_ERRORS" >&5
@@ -11718,9 +11755,8 @@ else
SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
-
+ SYSTEMD_LIBS="-lsystemd"
fi
- SYSTEMD_LIBS="-lsystemd"
fi
################################################################################
@@ -11842,85 +11878,14 @@ fi
if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" != no; then
- pkg_config_init
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5
-$as_echo_n "checking for SYSTEMD... " >&6; }
-
-if test -n "$SYSTEMD_CFLAGS"; then
- pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
- ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd >= 205" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$SYSTEMD_LIBS"; then
- pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
- ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd >= 205" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
+ if test "$SYSTEMD_MIN_VERSION" -ge 205; then :
+ UDEV_SYSTEMD_BACKGROUND_JOBS=yes
else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
+ if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then :
+ UDEV_SYSTEMD_BACKGROUND_JOBS=no
else
- _pkg_short_errors_supported=no
+ as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
fi
- if test $_pkg_short_errors_supported = yes; then
- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= 205" 2>&1`
- else
- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= 205" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$SYSTEMD_PKG_ERRORS" >&5
-
- if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
- UDEV_SYSTEMD_BACKGROUND_JOBS=no
- else
- as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
- fi
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
- UDEV_SYSTEMD_BACKGROUND_JOBS=no
- else
- as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
- fi
-else
- SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS
- SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- UDEV_SYSTEMD_BACKGROUND_JOBS=yes
fi
fi
2 years, 6 months
main - configure.ac: enhance systemd testing
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9d87549f8096759a70c...
Commit: 9d87549f8096759a70ce91119ebc71e8fdde0294
Parent: 2e2d67378007ee850792396f933900e71f0ea80d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 09:55:08 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 10:09:21 2021 +0200
configure.ac: enhance systemd testing
Enhance logic for checking supported systemd version,
while doing only a single check for systemd package.
For version checking use PKG_CHECK_EXISTS() macro.
Also use one pkg check for blkid.
Avoid checking version for thin/cache_check when tools are not present
on system.
---
configure.ac | 57 +++++++++++++++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/configure.ac b/configure.ac
index ea56aa838..0069e5d36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,7 +430,7 @@ case "$THIN" in
THIN_CONFIGURE_WARN=y
fi
fi
- if test "$THIN_CHECK_NEEDS_CHECK" = yes; then
+ if test "$THIN_CHECK_NEEDS_CHECK" = yes && test "$THIN_CONFIGURE_WARN" != y ; then
THIN_CHECK_VSN=`"$THIN_CHECK_CMD" -V 2>/dev/null`
THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
@@ -543,7 +543,7 @@ case "$CACHE" in
CACHE_CONFIGURE_WARN=y
fi
fi
- if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
+ if test "$CACHE_CHECK_NEEDS_CHECK" = yes && test "$CACHE_CONFIGURE_WARN" != y ; then
$CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
read -r CACHE_CHECK_VSN < conftest.tmp
IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
@@ -1098,57 +1098,65 @@ if test "$BUILD_DMFILEMAPD" = yes; then
AC_CHECK_HEADER([linux/fiemap.h], , [AC_MSG_ERROR(--enable-dmfilemapd requires fiemap.h)])
fi
-SYSTEMD_MIN_VERSION=
+SYSTEMD_MIN_VERSION=0
+pkg_config_init
+PKG_CHECK_EXISTS(systemd >= 205, [SYSTEMD_MIN_VERSION=205], [])
+
################################################################################
dnl -- Build notifydbus
+PKG_CHECK_EXISTS(systemd >= 221, [SYSTEMD_MIN_VERSION=221], [])
AC_MSG_CHECKING(whether to build notifydbus)
AC_ARG_ENABLE(notify-dbus,
AS_HELP_STRING([--enable-notify-dbus],
[enable LVM notification using dbus]),
+ AS_IF([test "$enableval" = yes && test "$SYSTEMD_MIN_VERSION" -lt 221],
+ AC_MSG_ERROR([Enabling notify-dbus requires systemd >= 221]))
NOTIFYDBUS_SUPPORT=$enableval, NOTIFYDBUS_SUPPORT=no)
AC_MSG_RESULT($NOTIFYDBUS_SUPPORT)
AS_IF([test "$NOTIFYDBUS_SUPPORT" = yes],
- AC_DEFINE([NOTIFYDBUS_SUPPORT], 1, [Define to 1 to include code that uses dbus notification.])
- SYSTEMD_MIN_VERSION=221)
+ AC_DEFINE([NOTIFYDBUS_SUPPORT], 1, [Define to 1 to include code that uses dbus notification.]))
################################################################################
dnl -- Build with systemd journaling when the header file is present
-AC_CHECK_HEADER([systemd/sd-journal.h], [SYSTEMD_JOURNAL_SUPPORT=yes], [SYSTEMD_JOURNAL_SUPPORT=no])
+AS_IF([test "$SYSTEMD_MIN_VERSION" -ge 221], [SYSTEMD_JOURNAL_SUPPORT=maybe], [SYSTEMD_JOURNAL_SUPPORT=no])
+AC_CHECK_HEADER([systemd/sd-journal.h],
+ [AS_IF([test "$SYSTEMD_JOURNAL_SUPPORT" != no], [SYSTEMD_JOURNAL_SUPPORT=yes])],
+ [SYSTEMD_JOURNAL_SUPPORT=no])
AC_MSG_CHECKING(whether to log to systemd journal)
AC_ARG_ENABLE(systemd-journal,
AS_HELP_STRING([--disable-systemd-journal],
[disable LVM systemd journaling]),
AS_IF([test "$enableval" = yes && test "$SYSTEMD_JOURNAL_SUPPORT" = no],
- [AC_MSG_ERROR([Enabling systemd journaling requires systemd/sd-journal.h.])])
+ AC_MSG_ERROR([Enabling systemd journal requires systemd/sd-journal.h and systemd >= 221.]))
SYSTEMD_JOURNAL_SUPPORT=$enableval, [])
AC_MSG_RESULT($SYSTEMD_JOURNAL_SUPPORT)
AS_IF([test "$SYSTEMD_JOURNAL_SUPPORT" = yes],
- AC_DEFINE([SYSTEMD_JOURNAL_SUPPORT], 1, [Define to 1 to include code that uses systemd journal.])
- SYSTEMD_MIN_VERSION=221)
+ AC_DEFINE([SYSTEMD_JOURNAL_SUPPORT], 1, [Define to 1 to include code that uses systemd journal.]))
################################################################################
dnl -- Build appmachineid when header file sd-id128.h is present
-AC_CHECK_HEADER([systemd/sd-id128.h], [APP_MACHINEID_SUPPORT=yes], [APP_MACHINEID_SUPPORT=no])
-AC_MSG_CHECKING(whether to build appmachineid)
+PKG_CHECK_EXISTS(systemd >= 234, [SYSTEMD_MIN_VERSION=234 APP_MACHINEID_SUPPORT=maybe], [APP_MACHINEID_SUPPORT=no])
+AC_CHECK_HEADER([systemd/sd-id128.h],
+ [AS_IF([test "$APP_MACHINEID_SUPPORT" != no], [APP_MACHINEID_SUPPORT=yes])],
+ [APP_MACHINEID_SUPPORT=no])
+AC_MSG_CHECKING(whether to support systemd appmachineid)
AC_ARG_ENABLE(app-machineid,
AC_HELP_STRING([--disable-app-machineid],
[disable LVM system ID using app-specific machine-id]),
AS_IF([test "$enableval" = yes && test "$APP_MACHINEID_SUPPORT" = no],
- [AC_MSG_ERROR([Enabling app machineid requires systemd/sd-id128.h.])])
+ AC_MSG_ERROR([Enabling app machineid requires systemd/sd-id128.h and systemd >= 234.]))
APP_MACHINEID_SUPPORT=$enableval, [])
AC_MSG_RESULT($APP_MACHINEID_SUPPORT)
AS_IF([test "$APP_MACHINEID_SUPPORT" = yes],
- AC_DEFINE([APP_MACHINEID_SUPPORT], 1, [Define to 1 to include code that uses libsystemd machine-id apis.])
- SYSTEMD_MIN_VERSION=234)
+ AC_DEFINE([APP_MACHINEID_SUPPORT], 1, [Define to 1 to include code that uses libsystemd machine-id apis.]))
-dnl -- Look for libsystemd libraries
-AS_IF([test -n "$SYSTEMD_MIN_VERSION"],[
+dnl -- Look for libsystemd libraries if needed
+AS_IF([test "$NOTIFYDBUS_SUPPORT" = yes || test "$SYSTEMD_JOURNAL_SUPPORT" = yes || test "$APP_MACHINEID_SUPPORT" = yes ] ,[
pkg_config_init
- PKG_CHECK_MODULES(SYSTEMD, systemd >= "$SYSTEMD_MIN_VERSION", [], $bailout)
- SYSTEMD_LIBS="-lsystemd"])
+ PKG_CHECK_MODULES(SYSTEMD, [systemd], [SYSTEMD_LIBS="-lsystemd"], $bailout) ])
################################################################################
@@ -1187,14 +1195,11 @@ AC_ARG_ENABLE(udev-systemd-background-jobs,
UDEV_SYSTEMD_BACKGROUND_JOBS=maybe)
if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" != no; then
- pkg_config_init
- PKG_CHECK_MODULES(SYSTEMD, systemd >= 205,
- [UDEV_SYSTEMD_BACKGROUND_JOBS=yes],
- [if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
- UDEV_SYSTEMD_BACKGROUND_JOBS=no
- else
- AC_MSG_ERROR([bailing out... systemd >= 205 is required])
- fi])
+ AS_IF([test "$SYSTEMD_MIN_VERSION" -ge 205],
+ UDEV_SYSTEMD_BACKGROUND_JOBS=yes,
+ AS_IF([test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe],
+ [UDEV_SYSTEMD_BACKGROUND_JOBS=no],
+ [AC_MSG_ERROR([bailing out... systemd >= 205 is required])]))
fi
AC_MSG_CHECKING(whether to use udev-systemd protocol for jobs in background)
2 years, 6 months
main - makefile: enhance run-unit-test target
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2e2d67378007ee85079...
Commit: 2e2d67378007ee850792396f933900e71f0ea80d
Parent: 037165300ea1f6d9c9f8587360792505b2f3988d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 09:45:26 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 09:55:54 2021 +0200
makefile: enhance run-unit-test target
Use TMPDIR for executing test and also ensure
all libraries linked to the test are from builddir.
---
test/unit/Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/test/unit/Makefile b/test/unit/Makefile
index 455c18d2a..5826f41c2 100644
--- a/test/unit/Makefile
+++ b/test/unit/Makefile
@@ -54,7 +54,12 @@ $(UNIT_TARGET): $(UNIT_OBJECTS) $(LVMINTERNAL_LIBS)
unit-test: $(UNIT_TARGET)
run-unit-test: $(UNIT_TARGET)
@echo "Running unit tests"
- LD_LIBRARY_PATH=$(top_builddir)/libdm $(UNIT_TARGET) run
+ test -n "$$LVM_TEST_DIR" || LVM_TEST_DIR=$${TMPDIR:-/tmp} ;\
+ TESTDIR=$$(mktemp -d -t -p "$$LVM_TEST_DIR" "LVMTEST.XXXXXXXXXX") ;\
+ cd "$$TESTDIR" ;\
+ LD_LIBRARY_PATH=$(abs_top_builddir)/libdm:$(abs_top_builddir)/daemons/dmeventd $(abs_top_builddir)/$(UNIT_TARGET) run ;\
+ cd $$OLDPWD ;\
+ $(RM) -r "$${TESTDIR:?}"
ifeq ("$(DEPENDS)","yes")
-include $(UNIT_SOURCE:%.c=%.d)
2 years, 6 months
main - unit-test: better check for O_DIRECT
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=037165300ea1f6d9c9f...
Commit: 037165300ea1f6d9c9f8587360792505b2f3988d
Parent: 52a52d556773cf57007932ed483d20d21bd53823
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 09:44:15 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 09:55:54 2021 +0200
unit-test: better check for O_DIRECT
Instead of guessing tmpfs usage, just directly try if we could
reopen file with O_DIRECT on the used filesystem.
---
test/unit/bcache_utils_t.c | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/test/unit/bcache_utils_t.c b/test/unit/bcache_utils_t.c
index 73b8902fb..daed0ce39 100644
--- a/test/unit/bcache_utils_t.c
+++ b/test/unit/bcache_utils_t.c
@@ -49,31 +49,39 @@ static uint64_t byte(block_address b, uint64_t offset)
static void *_fix_init(struct io_engine *engine)
{
- uint8_t buffer[T_BLOCK_SIZE];
- struct fixture *f = malloc(sizeof(*f));
- unsigned b, i;
- struct statvfs fsdata = { 0 };
+ uint8_t buffer[T_BLOCK_SIZE];
+ struct fixture *f = malloc(sizeof(*f));
+ unsigned b, i;
static int _runs_is_tmpfs = -1;
memset(buffer, 0, sizeof(buffer));
+ T_ASSERT(f);
+
if (_runs_is_tmpfs == -1) {
- // With testing in tmpfs directory O_DIRECT cannot be used
- // tmpfs has f_fsid == 0 (unsure if this is best guess)
- _runs_is_tmpfs = (statvfs(".", &fsdata) == 0 && !fsdata.f_fsid) ? 1 : 0;
- if (_runs_is_tmpfs)
+ snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
+ /* coverity[secure_temp] don't care */
+ f->fd = mkstemp(f->fname);
+ T_ASSERT(f->fd >= 0);
+ (void) close(f->fd);
+ // test if we can reopen with O_DIRECT
+ if ((f->fd = open(f->fname, O_RDWR | O_DIRECT)) >= 0) {
+ _runs_is_tmpfs = 0;
+ (void) close(f->fd);
+ } else {
+ _runs_is_tmpfs = 1; // likely running on tmpfs
printf(" Running test in tmpfs, *NOT* using O_DIRECT\n");
+ }
+ (void) unlink(f->fname);
}
- T_ASSERT(f);
-
- snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
+ snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
/* coverity[secure_temp] don't care */
f->fd = mkstemp(f->fname);
T_ASSERT(f->fd >= 0);
for (b = 0; b < NR_BLOCKS; b++) {
- for (i = 0; i < sizeof(buffer); i++)
- buffer[i] = _pattern_at(INIT_PATTERN, byte(b, i));
+ for (i = 0; i < sizeof(buffer); i++)
+ buffer[i] = _pattern_at(INIT_PATTERN, byte(b, i));
T_ASSERT(write(f->fd, buffer, T_BLOCK_SIZE) > 0);
}
@@ -89,7 +97,7 @@ static void *_fix_init(struct io_engine *engine)
f->di = bcache_set_fd(f->fd);
- return f;
+ return f;
}
static void *_async_init(void)
2 years, 6 months
main - configure: bash var typo
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=52a52d556773cf57007...
Commit: 52a52d556773cf57007932ed483d20d21bd53823
Parent: 04725763a1eb20565cc66e1fd009d9ee93220524
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 15 00:32:36 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 00:32:36 2021 +0200
configure: bash var typo
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 7f55569b0..808029a79 100755
--- a/configure
+++ b/configure
@@ -11646,7 +11646,7 @@ $as_echo "#define APP_MACHINEID_SUPPORT 1" >>confdefs.h
SYSTEMD_MIN_VERSION=234
fi
-if test -n "SYSTEMD_MIN_VERSION"; then :
+if test -n "$SYSTEMD_MIN_VERSION"; then :
pkg_config_init
diff --git a/configure.ac b/configure.ac
index 0ec8d6b7d..ea56aa838 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1145,7 +1145,7 @@ AS_IF([test "$APP_MACHINEID_SUPPORT" = yes],
SYSTEMD_MIN_VERSION=234)
dnl -- Look for libsystemd libraries
-AS_IF([test -n "SYSTEMD_MIN_VERSION"],[
+AS_IF([test -n "$SYSTEMD_MIN_VERSION"],[
pkg_config_init
PKG_CHECK_MODULES(SYSTEMD, systemd >= "$SYSTEMD_MIN_VERSION", [], $bailout)
SYSTEMD_LIBS="-lsystemd"])
2 years, 6 months
main - gcc: always initialize vg_complete
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=04725763a1eb20565cc...
Commit: 04725763a1eb20565cc66e1fd009d9ee93220524
Parent: 14cf579263cb9121a8f06396c6257453492e043b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 14 23:43:12 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 15 00:09:07 2021 +0200
gcc: always initialize vg_complete
---
tools/pvscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 6ea7a77e5..8e2611361 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1295,7 +1295,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
int pvs_online;
int pvs_offline;
int pvs_unknown;
- int vg_complete;
+ int vg_complete = 0;
int do_full_check;
int ret = 1;
2 years, 6 months