main - cov: set error_vg only when pointer is non null
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7e77e250a9249f6b7c9...
Commit: 7e77e250a9249f6b7c9bc63b88de393c02ef6a61
Parent: d1f9845c96284ee72692b7701a2dd1b86006524e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 12:41:25 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:58:45 2021 +0200
cov: set error_vg only when pointer is non null
---
lib/metadata/metadata.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 4471f7c86..002d80c01 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4954,7 +4954,8 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
log_very_verbose("Reading orphan VG %s.", vg_name);
vg = vg_read_orphans(cmd, vg_name);
*error_flags = 0;
- *error_vg = NULL;
+ if (error_vg)
+ *error_vg = NULL;
return vg;
}
3 years
main - cov: ensure there is space for 0 at eol
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1f9845c96284ee7269...
Commit: d1f9845c96284ee72692b7701a2dd1b86006524e
Parent: cfe26470e350580249f03025ae6bafbf2ab8e60b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 15:08:34 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:58:45 2021 +0200
cov: ensure there is space for 0 at eol
Reserve 1 char for \0.
---
tools/command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/command.c b/tools/command.c
index 6431e2a50..1de739aaa 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -2522,7 +2522,7 @@ static const char *_man_long_opt_name(const char *cmdname, int opt_enum)
}
if (strchr(long_opt, '[')) {
- for (i = 0; i < sizeof(long_opt_name); ++long_opt, ++i) {
+ for (i = 0; i < sizeof(long_opt_name) - 1; ++long_opt, ++i) {
if (i < (sizeof(long_opt_name) - 8))
switch(*long_opt) {
case '[':
3 years
main - dev-cache: change message level to debug
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cfe26470e350580249f...
Commit: cfe26470e350580249f03025ae6bafbf2ab8e60b
Parent: 2b90466f78892c1e578c830a72566662d137dace
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 21:58:06 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:58:45 2021 +0200
dev-cache: change message level to debug
This case happens when i.e. we convert LV to another type,
when we change existing LV into a different type - so change
to debug level and avoid confusing users with message about
Device path not match.
We may eventually enhnace caching code to drop cached info
after taking lock and reading VG.
---
lib/device/dev-cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 112296a81..aa93b5758 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1490,7 +1490,7 @@ struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct d
* Remove incorrect info and then add new dev-cache entry.
*/
if (dev && (st.st_rdev != dev->dev)) {
- log_print("Device path %s does not match %d:%d %s.",
+ log_debug("Device path %s does not match %d:%d %s.",
name, (int)MAJOR(dev->dev), (int)MINOR(dev->dev), dev_name(dev));
dm_hash_remove(_cache.names, name);
3 years
main - devicesfile: use pool memory
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2b90466f78892c1e578...
Commit: 2b90466f78892c1e578c830a72566662d137dace
Parent: 80ef9138726c85e837dbb5a7572178f8b972e300
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 15:03:11 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:58:45 2021 +0200
devicesfile: use pool memory
Switch to use command mempool instead of zalloc() as relase
part would be required otherwise.
---
lib/device/dev-cache.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 05b2b9bff..112296a81 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1710,13 +1710,11 @@ static int _setup_devices_list(struct cmd_context *cmd)
*/
dm_list_iterate_items(strl, &cmd->deviceslist) {
- if (!(du = zalloc(sizeof(struct dev_use))))
+ if (!(du = dm_pool_zalloc(cmd->mem, sizeof(struct dev_use))))
return_0;
- if (!(du->devname = strdup(strl->str))) {
- free(du);
+ if (!(du->devname = dm_pool_strdup(cmd->mem, strl->str)))
return_0;
- }
dm_list_add(&cmd->use_devices, &du->list);
}
3 years
main - device_id: fix memleak and free idname
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=80ef9138726c85e837d...
Commit: 80ef9138726c85e837dbb5a7572178f8b972e300
Parent: 65c4f81dc2eebe4096c48159f2fbd1107e284aea
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 00:25:14 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:57:08 2021 +0200
device_id: fix memleak and free idname
Remove extra code path used only for 'free()'
and free(idname) on all paths that do not add it to list
and avoid memleak in few cases.
---
lib/device/device_id.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index cf5867dab..1a9705f04 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1008,21 +1008,24 @@ id_done:
break;
}
}
- if (found_id && !strcmp(id->idname, idname)) {
- free((char *)idname);
- } else if (found_id && strcmp(id->idname, idname)) {
+
+ if (found_id && idname && strcmp(id->idname, idname)) {
dm_list_del(&id->list);
free_did(id);
found_id = 0;
}
if (!found_id) {
- if (!(id = zalloc(sizeof(struct dev_id))))
+ if (!(id = zalloc(sizeof(struct dev_id)))) {
+ free((char *)idname);
return_0;
+ }
id->idtype = idtype;
id->idname = (char *)idname;
id->dev = dev;
dm_list_add(&dev->ids, &id->list);
- }
+ } else
+ free((char*)idname);
+
dev->id = id;
dev->flags |= DEV_MATCHED_USE_ID;
3 years
main - pvscan: fix memleak
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=65c4f81dc2eebe4096c...
Commit: 65c4f81dc2eebe4096c48159f2fbd1107e284aea
Parent: 5e8307f4bfc6e04cd601fea78129302ce02ffef8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 15:11:36 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:55:39 2021 +0200
pvscan: fix memleak
Commit 25b58310e3d606a85abc9bd50991ccb7ddcbfe25 add zalloc()
without correspoding free(), switch to use cmd mempool.
---
tools/pvscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 22cb7bc18..83f3f3983 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -848,7 +848,7 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
goto bad;
}
- if (!(devl = zalloc(sizeof(*devl))))
+ if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
goto_bad;
devl->dev = dev;
3 years
main - lvmcache: fix memory leak
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5e8307f4bfc6e04cd60...
Commit: 5e8307f4bfc6e04cd601fea78129302ce02ffef8
Parent: 66dd481f46099dd118136dacfad0e815e781605a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 14:44:57 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 22:54:41 2021 +0200
lvmcache: fix memory leak
With commit 0b18c25d934564015402de33e15a267045ed1b8c there
was introduced 'zalloc()' for allocation of outdates pvs,
but no matching 'free()' is present.
Switch to use cmd mempool instead of adding free() code into
several places.
---
WHATS_NEW | 1 +
lib/cache/lvmcache.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a51e4a05f..7917c2690 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.12 -
===================================
+ Fix memleak when generating list of outdated pvs.
Better hyphenation usage in man pages.
Replace use of deprecated security_context_t with char*.
Configure supports AIO_LIBS and AIO_CFLAGS.
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index d4acec509..017134d7d 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2818,7 +2818,7 @@ void lvmcache_get_outdated_devs(struct cmd_context *cmd,
}
dm_list_iterate_items(info, &vginfo->outdated_infos) {
- if (!(devl = zalloc(sizeof(*devl))))
+ if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
return;
devl->dev = info->dev;
dm_list_add(devs, &devl->list);
3 years
main - man/help: move implied annotation
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=66dd481f46099dd1181...
Commit: 66dd481f46099dd118136dacfad0e815e781605a
Parent: d651b340e68d97ada25e558eb50aa40062bba936
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Apr 21 12:05:10 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 21 12:05:10 2021 -0500
man/help: move implied annotation
from
[ --type foo (implied) ]
to
[ --type foo] (implied)
---
tools/command.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index 99661a517..6431e2a50 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1979,9 +1979,9 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
if (cmd->autotype) {
printf("\n\t");
if (!cmd->autotype2)
- printf("[ --type %s (implied) ]", cmd->autotype);
+ printf("[ --type %s ] (implied)", cmd->autotype);
else
- printf("[ --type %s|%s (implied) ]", cmd->autotype, cmd->autotype2);
+ printf("[ --type %s|%s ] (implied)", cmd->autotype, cmd->autotype2);
}
if (include_extents) {
@@ -2762,9 +2762,9 @@ static void _print_man_usage(char *lvmname, struct command *cmd)
if (cmd->autotype) {
if (!cmd->autotype2)
- printf("[ \\fB--type %s\\fP (implied) ]\n", cmd->autotype);
+ printf("[ \\fB--type %s\\fP ] (implied)\n", cmd->autotype);
else
- printf("[ \\fB--type %s\\fP|\\fB%s\\fP (implied) ]\n", cmd->autotype, cmd->autotype2);
+ printf("[ \\fB--type %s\\fP|\\fB%s\\fP ] (implied)\n", cmd->autotype, cmd->autotype2);
printf(".br\n");
sep = 1;
}
3 years
main - commands: use AUTOTYPE in definitions
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d651b340e68d97ada25...
Commit: d651b340e68d97ada25e558eb50aa40062bba936
Parent: 7b77226df2ee7f4d1baa11d42752f600e408bf65
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 20 17:03:09 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 21 08:41:37 2021 -0500
commands: use AUTOTYPE in definitions
If a cmd def implies an LV type without --type
in the required options, then include the implied
type in the cmd def as AUTOTYPE: <type>
instead of including the redundant --type foo
in the OO list of options.
Including an implied --type in the OO list would
often cause multiple cmd defs to potentially be
identical when options were used, and a user
command could match more than one cmd def.
The AUTOTYPE values are listed in man page and
help output as
[ --type foo (implied) ]
If a user command includes --type, it will usually
match a cmd def with --type in the required options.
But, if the user command matches a cmd def with
AUTOTYPE, then the specifed --type and AUTOTYPE must
match.
The man-generator program has a new --check
option that compares cmd defs to find any cmd defs
that are equivalent with the use of options,
and should have their options adjusted.
---
tools/command-lines.in | 147 ++++++++++++++++++++++++++++++++-----------------
tools/command.c | 42 ++++++++++++++
tools/command.h | 4 ++
tools/lvmcmdline.c | 9 +++
4 files changed, 150 insertions(+), 52 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 459e2afb6..164516a2e 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -163,6 +163,22 @@
# RULE: LV_type1 and lv_is_prop1
#
#
+# AUTOTYPE: <segtype>
+# The cmd def implies the type. Optionally using --type foo
+# is not wrong, but it's redundant. If --type is specified
+# it is not used in matching a user command to the cmd def,
+# but once a user cmd is matched to the cmd def, a specified
+# type is compared to the AUTOTYPE to ensure they match.
+# We avoid including --type foo in the OO list because doing
+# so often makes the cmd def redundant with another cmd def
+# that has --type foo in its required_options. We want a user
+# command to only match a single cmd def.
+# Usually, a user command with --type foo will match a cmd def
+# that includes --type foo in its required_options.
+#
+# For lvcreate cmd defs, each should either include --type foo
+# in required_options, or it should include AUTOTYPE foo
+# (and not include --type in OO).
#
# For efficiency, sets of options can be defined and reused
@@ -445,11 +461,11 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type thin
lvconvert --thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero
-OO: --type thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO: --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_thin_with_external
-DESC: Convert LV to a thin LV, using the original LV as an external origin
-DESC: (infers --type thin).
+DESC: Convert LV to a thin LV, using the original LV as an external origin.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
RULE: all and lv_is_visible
RULE: all not lv_is_locked lv_is_raid_with_integrity
RULE: --poolmetadata not --readahead --stripesize --stripes_long
@@ -466,13 +482,14 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type cache
lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata
-OO: --type cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_cache_with_cachepool
-DESC: Attach a cache pool to an LV (infers --type cache).
+DESC: Attach a cache pool to an LV.
RULE: all and lv_is_visible
RULE: all not lv_is_raid_with_integrity
RULE: --poolmetadata not --readahead --stripesize --stripes_long
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: cache
---
@@ -550,7 +567,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# of creating a pool or swapping metadata should be used.
lvconvert --thinpool LV_linear_striped_raid_cache_thinpool
-OO: --type thin-pool, --stripes_long Number, --stripesize SizeKB,
+OO: --stripes_long Number, --stripesize SizeKB,
OO_LVCONVERT_THINPOOL, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thinpool_or_swap_metadata
@@ -560,6 +577,7 @@ FLAGS: PREVIOUS_SYNTAX
RULE: all and lv_is_visible
RULE: all not lv_is_raid_with_integrity
RULE: --poolmetadata not --readahead --stripesize --stripes_long
+AUTOTYPE: thin-pool
---
@@ -593,6 +611,17 @@ RULE: all not lv_is_raid_with_integrity
# This command syntax is deprecated, and the primary forms
# of creating a pool or swapping metadata should be used.
+# FIXME
+# AUTOTYPE: cache-pool doesn't work here.
+# A strange command matches this cmd def:
+# lvconvert --type cache-pool --cachepool LV
+# where the LV is already a cache pool. That command
+# seems to be used to change properties on an existing cache pool.
+# The command lvconvert --type cache-pool LV will also change
+# properties on an existing cache pool.
+# Neither seems like a logical command to change properties
+# of an LV, wouldn't lvchange do that?
+
lvconvert --cachepool LV_linear_striped_raid_cachepool_error_zero
OO: --type cache-pool, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
@@ -614,12 +643,13 @@ RULE: all and lv_is_visible
RULE: all not lv_is_locked lv_is_origin lv_is_merging_origin lv_is_external_origin lv_is_virtual lv_is_raid_with_integrity
lvconvert --vdopool LV_linear_striped_raid_cache
-OO: --type vdo-pool, OO_LVCONVERT_VDO, OO_LVCONVERT, --name LV_new, --virtualsize SizeMB,
+OO: OO_LVCONVERT_VDO, OO_LVCONVERT, --name LV_new, --virtualsize SizeMB,
ID: lvconvert_to_vdopool_param
DESC: Convert LV to type vdopool.
RULE: all and lv_is_visible
RULE: all not lv_is_locked lv_is_origin lv_is_merging_origin lv_is_external_origin lv_is_virtual lv_is_raid_with_integrity
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: vdo-pool
---
@@ -712,13 +742,14 @@ RULE: all not lv_is_locked lv_is_pvmove
RULE: all and lv_is_visible
lvconvert --snapshot LV LV_linear_striped
-OO: --type snapshot, --chunksize SizeKB, --zero Bool, OO_LVCONVERT
+OO: --chunksize SizeKB, --zero Bool, OO_LVCONVERT
ID: lvconvert_combine_split_snapshot
DESC: Combine a former COW snapshot (second arg) with a former
DESC: origin LV (first arg) to reverse a splitsnapshot command.
RULE: all not lv_is_locked lv_is_pvmove
RULE: all and lv_is_visible
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: snapshot
---
@@ -836,11 +867,12 @@ DESC: Create a linear LV.
FLAGS: SECONDARY_SYNTAX
lvcreate --size SizeMB VG
-OO: --type linear, OO_LVCREATE
+OO: OO_LVCREATE
OP: PV ...
IO: --mirrors 0, --stripes 1
ID: lvcreate_linear
DESC: Create a linear LV.
+AUTOTYPE: linear
---
@@ -880,10 +912,11 @@ FLAGS: SECONDARY_SYNTAX
# R13 (just --stripes)
lvcreate --stripes Number --size SizeMB VG
-OO: --stripesize SizeKB, --type striped, OO_LVCREATE
+OO: --stripesize SizeKB, OO_LVCREATE
OP: PV ...
ID: lvcreate_striped
-DESC: Create a striped LV (infers --type striped).
+DESC: Create a striped LV.
+AUTOTYPE: striped
# R5,R7 (--type mirror with or without --mirrors)
lvcreate --type mirror --size SizeMB VG
@@ -897,11 +930,13 @@ FLAGS: SECONDARY_SYNTAX
# R14 (just --mirrors)
# alternate form of lvcreate --type raid1|mirror
lvcreate --mirrors PNumber --size SizeMB VG
-OO: --stripes Number, --stripesize SizeKB,
---mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
+OO: --stripesize SizeKB, --mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
OP: PV ...
+IO: --stripes 1
ID: lvcreate_mirror_or_raid1
-DESC: Create a raid1 or mirror LV (infers --type raid1|mirror).
+DESC: Create a raid1 or mirror LV.
+AUTOTYPE: raid1
+AUTOTYPE: mirror
# R9,R10,R11,R12 (--type raid with any use of --stripes/--mirrors)
lvcreate --type raid --size SizeMB VG
@@ -913,11 +948,14 @@ ID: lvcreate_raid_any
DESC: Create a raid LV (a specific raid level must be used, e.g. raid1).
# R15 (--stripes and --mirrors which implies raid10)
+# FIXME: --mirrors N --stripes 1 is raid1|mirror and should only
+# match the cmd def above for raid1|mirror with IO: --stripes 1
lvcreate --mirrors PNumber --stripes Number --size SizeMB VG
OO: --stripesize SizeKB, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
OP: PV ...
ID: lvcreate_raid_any
DESC: Create a raid10 LV.
+AUTOTYPE: raid10
---
@@ -937,11 +975,12 @@ DESC: (also see --snapshot).
FLAGS: SECONDARY_SYNTAX
lvcreate --snapshot --size SizeMB LV
-OO: --type snapshot, --stripes Number, --stripesize SizeKB,
+OO: --stripes Number, --stripesize SizeKB,
--chunksize SizeKB, OO_LVCREATE
OP: PV ...
ID: lvcreate_cow_snapshot
DESC: Create a COW snapshot LV of an origin LV.
+AUTOTYPE: snapshot
---
@@ -966,24 +1005,24 @@ DESC: Create a thin pool.
# alternate form of lvcreate --type thin-pool
lvcreate --thin --size SizeMB VG
-OO: --stripes Number, --stripesize SizeKB,
---type thin-pool, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
+OO: --stripes Number, --stripesize SizeKB, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_thinpool
-DESC: Create a thin pool (infers --type thin-pool).
+DESC: Create a thin pool.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin-pool
# alternate form of lvcreate --type thin-pool
lvcreate --size SizeMB --thinpool LV_new VG
OO: --stripes Number, --stripesize SizeKB,
---thin, --type thin-pool, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
+--thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_thinpool
-DESC: Create a thin pool named by the --thinpool arg
-DESC: (infers --type thin-pool).
+DESC: Create a thin pool named in --thinpool.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin-pool
---
@@ -1032,20 +1071,21 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --virtualsize SizeMB --thinpool LV_thinpool VG
-OO: --type thin, --thin, OO_LVCREATE
+OO: --thin, OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_vol
-DESC: Create a thin LV in a thin pool (infers --type thin).
+DESC: Create a thin LV in a thin pool.
+AUTOTYPE: thin
# alternate form of lvcreate --type thin
lvcreate --virtualsize SizeMB LV_thinpool
-OO: --type thin, --thin, OO_LVCREATE
+OO: --thin, OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_vol
DESC: Create a thin LV in the thin pool named in the first arg
-DESC: (variant, infers --type thin, also see --thinpool for
-DESC: naming pool.)
+DESC: (also see --thinpool for naming pool.)
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
---
@@ -1058,20 +1098,20 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --thin LV_thin
-OO: --type thin, OO_LVCREATE
+OO: OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot
-DESC: Create a thin LV that is a snapshot of an existing thin LV
-DESC: (infers --type thin).
+DESC: Create a thin LV that is a snapshot of an existing thin LV.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
# alternate form of lvcreate --type thin
lvcreate --snapshot LV_thin
-OO: --type thin, OO_LVCREATE
+OO: OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot
-DESC: Create a thin LV that is a snapshot of an existing thin LV
-DESC: (infers --type thin).
+DESC: Create a thin LV that is a snapshot of an existing thin LV.
+AUTOTYPE: thin
lvcreate --type thin --thinpool LV_thinpool LV
OO: --thin, OO_LVCREATE
@@ -1081,12 +1121,12 @@ DESC: Create a thin LV that is a snapshot of an external origin LV.
# alternate form of lvcreate --type thin --thinpool LV_thinpool LV
lvcreate --snapshot --thinpool LV_thinpool LV
-OO: --type thin, OO_LVCREATE
+OO: OO_LVCREATE
IO: --mirrors 0
ID: lvcreate_thin_snapshot_of_external
-DESC: Create a thin LV that is a snapshot of an external origin LV
-DESC: (infers --type thin).
+DESC: Create a thin LV that is a snapshot of an external origin LV.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
---
@@ -1100,21 +1140,23 @@ DESC: Create a LV that returns VDO when used.
lvcreate --vdo --size SizeMB VG
OO: --stripes Number, --stripesize SizeKB,
---type vdo, --virtualsize SizeMB, --vdopool LV_new, OO_LVCREATE_VDO, OO_LVCREATE
+--virtualsize SizeMB, --vdopool LV_new, OO_LVCREATE_VDO, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_vdo_vol
DESC: Create a VDO LV with VDO pool.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: vdo
lvcreate --vdopool LV_new --size SizeMB VG
OO: --stripes Number, --stripesize SizeKB,
---vdo, --type vdo, --virtualsize SizeMB, OO_LVCREATE_VDO, OO_LVCREATE
+--virtualsize SizeMB, OO_LVCREATE_VDO, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_vdo_vol
DESC: Create a VDO LV with VDO pool.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: vdo
---
@@ -1147,14 +1189,14 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --virtualsize SizeMB --size SizeMB --thinpool LV_new VG
OO: --stripes Number, --stripesize SizeKB,
---type thin, --thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
+--thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_thin_vol_and_thinpool
DESC: Create a thin LV, first creating a thin pool for it,
-DESC: where the new thin pool is named by the --thinpool arg
-DESC: (variant, infers --type thin).
+DESC: where the new thin pool is named by --thinpool.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
# alternate form of lvcreate --type thin
lvcreate --type thin --virtualsize SizeMB --size SizeMB LV_new|VG
@@ -1172,32 +1214,32 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --thin --virtualsize SizeMB --size SizeMB LV_new|VG
OO: --stripes Number, --stripesize SizeKB,
---type thin, OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
+OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_thin_vol_and_thinpool
DESC: Create a thin LV, first creating a thin pool for it,
DESC: where the new thin pool is named in the first arg,
DESC: or the new thin pool name is generated when the first
-DESC: arg is a VG name (variant, infers --type thin).
+DESC: arg is a VG name.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
---
lvcreate --size SizeMB --virtualsize SizeMB VG
-OO: --stripes Number, --stripesize SizeKB,
---type String, --snapshot, --thin,
+OO: --stripes Number, --stripesize SizeKB, --snapshot, --thin,
OO_LVCREATE_THINPOOL, OO_LVCREATE_POOL, OO_LVCREATE
OP: PV ...
IO: --mirrors 0
ID: lvcreate_thin_vol_with_thinpool_or_sparse_snapshot
-DESC: Create a thin LV, first creating a thin pool for it
-DESC: (infers --type thin).
+DESC: Create a thin LV, first creating a thin pool for it.
DESC: Create a sparse snapshot of a virtual origin LV
-DESC: (infers --type snapshot).
-DESC: Chooses --type thin or --type snapshot according to
+DESC: Chooses type thin or snapshot according to
DESC: config setting sparse_segtype_default.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: thin
+AUTOTYPE: snapshot
---
@@ -1217,13 +1259,13 @@ DESC: which converts the new LV to type cache.
# (omits the --type cache option which is inferred)
lvcreate --size SizeMB --cachepool LV_cachepool VG
OO: --stripes Number, --stripesize SizeKB,
---cache, --type cache, OO_LVCREATE_CACHE, OO_LVCREATE
+--cache, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
ID: lvcreate_and_attach_cachepool_v2
DESC: Create a new LV, then attach the specified cachepool
-DESC: which converts the new LV to type cache
-DESC: (variant, infers --type cache.)
+DESC: which converts the new LV to type cache.
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: cache
# alternate form of lvcreate --type cache
# (moves cachepool from option arg to position arg,
@@ -1260,7 +1302,7 @@ FLAGS: SECONDARY_SYNTAX
# the LV type is known.
lvcreate --cache --size SizeMB LV
-OO: --type cache, OO_LVCREATE_CACHE, OO_LVCREATE_POOL, OO_LVCREATE,
+OO: OO_LVCREATE_CACHE, OO_LVCREATE_POOL, OO_LVCREATE,
--stripes Number, --stripesize SizeKB
OP: PV ...
ID: lvcreate_new_plus_old_cachepool_or_lvconvert_old_plus_new_cachepool
@@ -1270,6 +1312,7 @@ DESC: (variant, use --type cache and --cachepool.)
DESC: When the LV arg is not a cachepool, then create a new cachepool
DESC: and attach it to the LV arg (alternative, use lvconvert.)
FLAGS: SECONDARY_SYNTAX
+AUTOTYPE: cache
---
diff --git a/tools/command.c b/tools/command.c
index d6e0fec57..99661a517 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -645,6 +645,13 @@ static int _is_desc_line(char *str)
return 0;
}
+static int _is_autotype_line(char *str)
+{
+ if (!strncmp(str, "AUTOTYPE:", 6))
+ return 1;
+ return 0;
+}
+
static int _is_flags_line(char *str)
{
if (!strncmp(str, "FLAGS:", 6))
@@ -1209,6 +1216,19 @@ static void _add_flags(struct command *cmd, char *line)
cmd->cmd_flags |= CMD_FLAG_PREVIOUS_SYNTAX;
}
+static void _add_autotype(struct cmd_context *cmdtool, struct command *cmd, char *line)
+{
+ int line_argc;
+ char *line_argv[MAX_LINE_ARGC];
+
+ _split_line(line, &line_argc, line_argv, ' ');
+
+ if (cmd->autotype)
+ cmd->autotype2 = dm_pool_strdup(cmdtool->libmem, line_argv[1]);
+ else
+ cmd->autotype = dm_pool_strdup(cmdtool->libmem, line_argv[1]);
+}
+
#define MAX_RULE_OPTS 64
static void _add_rule(struct cmd_context *cmdtool, struct command *cmd, char *line)
@@ -1535,6 +1555,11 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name)
continue;
}
+ if (_is_autotype_line(line_argv[0]) && !skip && cmd) {
+ _add_autotype(cmdtool, cmd, line_orig);
+ continue;
+ }
+
if (_is_flags_line(line_argv[0]) && !skip && cmd) {
_add_flags(cmd, line_orig);
continue;
@@ -1951,6 +1976,14 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
goto op_count;
if (cmd->oo_count) {
+ if (cmd->autotype) {
+ printf("\n\t");
+ if (!cmd->autotype2)
+ printf("[ --type %s (implied) ]", cmd->autotype);
+ else
+ printf("[ --type %s|%s (implied) ]", cmd->autotype, cmd->autotype2);
+ }
+
if (include_extents) {
printf("\n\t[ -l|--extents ");
_print_val_usage(cmd, extents_ARG, opt_names[extents_ARG].val_enum);
@@ -2727,6 +2760,15 @@ static void _print_man_usage(char *lvmname, struct command *cmd)
printf(".RS 4\n");
printf(".ad l\n");
+ if (cmd->autotype) {
+ if (!cmd->autotype2)
+ printf("[ \\fB--type %s\\fP (implied) ]\n", cmd->autotype);
+ else
+ printf("[ \\fB--type %s\\fP|\\fB%s\\fP (implied) ]\n", cmd->autotype, cmd->autotype2);
+ printf(".br\n");
+ sep = 1;
+ }
+
if (include_extents) {
/*
* NB we don't just pass extents_VAL here because the
diff --git a/tools/command.h b/tools/command.h
index 325ad1dd0..df994e1ae 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -208,6 +208,10 @@ struct command {
struct cmd_rule rules[CMD_MAX_RULES];
+ /* usually only one autotype, in one case there are two */
+ char *autotype;
+ char *autotype2;
+
int any_ro_count;
int ro_count;
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 23ab6fa37..d97ff5720 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1708,6 +1708,15 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
continue;
}
+ /*
+ * If the cmd def has an implied type, specified in AUTOTYPE,
+ * then if the user command has --type, it must match.
+ */
+ if (type_arg && commands[i].autotype && strcmp(type_arg, commands[i].autotype))
+ continue;
+ if (type_arg && commands[i].autotype2 && strcmp(type_arg, commands[i].autotype2))
+ continue;
+
/*
* '--type foo' is special. If the user has set --type foo, then
* we will only look at command defs that include the same --type foo
3 years
main - man-generator: add option to check for repeated command definitions
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b77226df2ee7f4d1ba...
Commit: 7b77226df2ee7f4d1baa11d42752f600e408bf65
Parent: a616abba03a35ec3064360ac8cab9ebb2203d645
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 20 10:24:47 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 10:31:00 2021 -0500
man-generator: add option to check for repeated command definitions
Compares cmd defs based on two principles for avoiding repeated
commands (where a given command could match more than one cmd def):
. a cmd def should be a unique combination of required
option args and position args
. avoid adding optional options to a cmd def that if
used would make the command match a different cmd def
FIXME: record when repeated cmd defs are found so we can
avoid reporting them twice, e.g. once for A vs B and
second time for B vs A.
---
tools/command.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 218 insertions(+), 5 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index b78271373..d6e0fec57 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -3654,6 +3654,211 @@ static void _print_man_secondary(char *name)
}
}
+static void _print_opt_list(const char *prefix, int *opt_list, int opt_count)
+{
+ int i;
+ int opt_enum;
+
+ printf("%s ", prefix);
+ for (i = 0; i < opt_count; i++) {
+ opt_enum = opt_list[i];
+ printf(" %s", opt_names[opt_enum].long_opt);
+ }
+ printf("\n");
+}
+
+/* return 1 if the lists do not match, 0 if they match */
+static int _compare_opt_lists(int *list1, int count1, int *list2, int count2, const char *type1_str, const char *type2_str)
+{
+ int i, j;
+
+ if (count1 != count2)
+ return 1;
+
+ for (i = 0; i < count1; i++) {
+ for (j = 0; j < count2; j++) {
+
+ /* lists do not match if one has --type foo and the other --type bar */
+ if ((list1[i] == type_ARG) && (list2[j] == type_ARG) &&
+ type1_str && type2_str && strcmp(type1_str, type2_str)) {
+ return 1;
+ }
+
+ if (list1[i] == list2[j])
+ goto next;
+ }
+ return 1;
+ next:
+ ;
+ }
+
+ return 0;
+}
+
+static int _compare_cmds(struct command *cmd1, struct command *cmd2, int *all_req_opts)
+{
+ const char *cmd1_type_str = NULL;
+ const char *cmd2_type_str = NULL;
+ int opt_list_1[ARG_COUNT] = { 0 };
+ int opt_list_2[ARG_COUNT] = { 0 };
+ int opt_count_1 = 0;
+ int opt_count_2 = 0;
+ int i, j;
+ int r = 1;
+
+ /* different number of required pos items means different cmds */
+ if (cmd1->rp_count != cmd2->rp_count)
+ return 1;
+
+ /* different types of required pos items means different cmds */
+ for (i = 0; i < cmd1->rp_count; i++) {
+ if (cmd1->required_pos_args[i].def.val_bits != cmd2->required_pos_args[i].def.val_bits)
+ return 1;
+ }
+
+ /* create opt list from cmd1 */
+ for (i = 0; i < cmd1->ro_count; i++) {
+ if (!all_req_opts[cmd1->required_opt_args[i].opt])
+ continue;
+
+ opt_list_1[opt_count_1++] = cmd1->required_opt_args[i].opt;
+
+ if (cmd1->required_opt_args[i].opt == type_ARG)
+ cmd1_type_str = cmd1->required_opt_args[i].def.str;
+ }
+
+ /* create opt list from cmd2 */
+ for (i = 0; i < cmd2->ro_count; i++) {
+ if (!all_req_opts[cmd2->required_opt_args[i].opt])
+ continue;
+
+ opt_list_2[opt_count_2++] = cmd2->required_opt_args[i].opt;
+
+ if (cmd2->required_opt_args[i].opt == type_ARG)
+ cmd2_type_str = cmd2->required_opt_args[i].def.str;
+ }
+
+ /* "--type foo" and "--type bar" are different */
+ if (cmd1_type_str && cmd2_type_str && strcmp(cmd1_type_str, cmd2_type_str))
+ return 1;
+
+ /* compare opt_list_1 and opt_list_2 */
+ if (!_compare_opt_lists(opt_list_1, opt_count_1, opt_list_2, opt_count_2, NULL, NULL)) {
+ log_error("Repeated commands %s %s", cmd1->command_id, cmd2->command_id);
+ log_error("cmd1: %s", cmd1->desc);
+ log_error("cmd2: %s", cmd2->desc);
+ _print_opt_list("cmd1 options: ", opt_list_1, opt_count_1);
+ _print_opt_list("cmd2 options: ", opt_list_2, opt_count_2);
+ printf("\n");
+ r = 0;
+ }
+
+ /* check if cmd1 matches cmd2 + one of its oo */
+ for (i = 0; i < cmd2->oo_count; i++) {
+ /* for each cmd2 optional_opt_arg, add it to opt_list_2
+ and compare opt_list_1 and opt_list_2 again */
+
+ /* cmd1 "--type foo" and cmd2 OO "--type bar" are different */
+ if (cmd2->optional_opt_args[i].opt == type_ARG) {
+ if (cmd2->optional_opt_args[i].def.str && cmd1_type_str &&
+ strcmp(cmd2->optional_opt_args[i].def.str, cmd1_type_str))
+ return 1;
+ }
+
+ opt_list_2[opt_count_2] = cmd2->optional_opt_args[i].opt;
+
+ if (!_compare_opt_lists(opt_list_1, opt_count_1, opt_list_2, opt_count_2+1, NULL, NULL)) {
+ log_error("Repeated commands %s %s", cmd1->command_id, cmd2->command_id);
+ log_error("cmd1: %s", cmd1->desc);
+ log_error("cmd2: %s", cmd2->desc);
+ log_error("Included cmd2 OO: %s", opt_names[cmd2->optional_opt_args[i].opt].long_opt);
+ _print_opt_list("cmd1 options: ", opt_list_1, opt_count_1);
+ _print_opt_list("cmd2 options: ", opt_list_2, opt_count_2+1);
+ printf("\n");
+ r = 0;
+ }
+ }
+
+ /* check if cmd1 + an oo matches cmd2 + an oo */
+
+ if (!cmd1_type_str) {
+ for (i = 0; i < cmd1->oo_count; i++) {
+ if (cmd1->optional_opt_args[i].opt == type_ARG)
+ cmd1_type_str = cmd1->optional_opt_args[i].def.str;
+ }
+ }
+ if (!cmd2_type_str) {
+ for (j = 0; j < cmd2->oo_count; j++) {
+ if (cmd2->optional_opt_args[j].opt == type_ARG)
+ cmd2_type_str = cmd2->optional_opt_args[j].def.str;
+ }
+ }
+
+ for (i = 0; i < cmd1->oo_count; i++) {
+
+ for (j = 0; j < cmd2->oo_count; j++) {
+ if (cmd1->optional_opt_args[i].opt == cmd2->optional_opt_args[j].opt)
+ continue;
+
+ opt_list_1[opt_count_1] = cmd1->optional_opt_args[i].opt;
+ opt_list_2[opt_count_2] = cmd2->optional_opt_args[j].opt;
+
+ if (!_compare_opt_lists(opt_list_1, opt_count_1+1, opt_list_2, opt_count_2+1, cmd1_type_str, cmd2_type_str)) {
+ log_error("Repeated commands %s %s", cmd1->command_id, cmd2->command_id);
+ log_error("cmd1: %s", cmd1->desc);
+ log_error("cmd2: %s", cmd2->desc);
+ log_error("Included cmd1 OO: %s and cmd2 OO: %s",
+ opt_names[cmd1->optional_opt_args[i].opt].long_opt,
+ opt_names[cmd2->optional_opt_args[j].opt].long_opt);
+ _print_opt_list("cmd1 options: ", opt_list_1, opt_count_1+1);
+ _print_opt_list("cmd2 options: ", opt_list_2, opt_count_2+1);
+ printf("\n");
+ r = 0;
+ }
+ }
+ }
+ return r;
+}
+
+static int _check_overlap(void)
+{
+ int all_req_opts[ARG_COUNT] = { 0 };
+ struct command *cmd1, *cmd2;
+ int i, j;
+ int r = 1;
+
+ for (i = 0; i < COMMAND_COUNT; i++) {
+ cmd1 = &commands[i];
+ for (j = 0; j < cmd1->ro_count; j++)
+ all_req_opts[cmd1->required_opt_args[j].opt] = 1;
+ }
+
+ for (i = 0; i < COMMAND_COUNT; i++) {
+
+ cmd1 = &commands[i];
+
+ if (cmd1->any_ro_count)
+ continue;
+
+ for (j = 0; j < COMMAND_COUNT; j++) {
+ if (i == j)
+ continue;
+
+ cmd2 = &commands[j];
+
+ if (cmd2->any_ro_count)
+ continue;
+
+ if (strcmp(cmd1->name, cmd2->name))
+ continue;
+
+ if (!_compare_cmds(cmd1, cmd2, all_req_opts))
+ r = 0;
+ }
+ }
+ return r;
+}
+
#define STDOUT_BUF_SIZE (MAX_MAN_DESC + 4 * 1024)
int main(int argc, char *argv[])
@@ -3664,12 +3869,14 @@ int main(int argc, char *argv[])
char *stdout_buf;
int primary = 0;
int secondary = 0;
+ int check = 0;
int r = 0;
size_t sz = STDOUT_BUF_SIZE;
static struct option long_options[] = {
{"primary", no_argument, 0, 'p' },
{"secondary", no_argument, 0, 's' },
+ {"check", no_argument, 0, 'c' },
{0, 0, 0, 0 }
};
@@ -3684,7 +3891,7 @@ int main(int argc, char *argv[])
int c;
int option_index = 0;
- c = getopt_long(argc, argv, "ps", long_options, &option_index);
+ c = getopt_long(argc, argv, "psc", long_options, &option_index);
if (c == -1)
break;
@@ -3697,11 +3904,14 @@ int main(int argc, char *argv[])
case 's':
secondary = 1;
break;
+ case 'c':
+ check = 1;
+ break;
}
}
- if (!primary && !secondary) {
- log_error("Usage: %s --primary|--secondary <command> [/path/to/description-file].", argv[0]);
+ if (!primary && !secondary && !check) {
+ log_error("Usage: %s --primary|--secondary|--check <command> [/path/to/description-file].", argv[0]);
goto out_free;
}
@@ -3710,7 +3920,7 @@ int main(int argc, char *argv[])
log_error("Out of memory.");
goto out_free;
}
- } else {
+ } else if (!check) {
log_error("Missing command name.");
goto out_free;
}
@@ -3720,7 +3930,8 @@ int main(int argc, char *argv[])
define_commands(&cmdtool, NULL);
- configure_command_option_values(cmdname);
+ if (!check)
+ configure_command_option_values(cmdname);
factor_common_options();
@@ -3729,6 +3940,8 @@ int main(int argc, char *argv[])
else if (secondary) {
r = 1;
_print_man_secondary(cmdname);
+ } else if (check) {
+ r = _check_overlap();
}
out_free:
3 years