From 89d8d81b10fc180be780285c6d03511ae7a835cd Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:42:42 +0000 Subject: [PATCH 01/10] cf-check: Added missing 'V' to short option string The --version long option worked, but the advertised -V short form was rejected as an unknown option because 'V' was missing from the getopt option string. The case 'V' handler already existed. Changelog: Fixed cf-check -V (--version) short option --- cf-check/cf-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-check/cf-check.c b/cf-check/cf-check.c index 46520c69d9..1fbdb69cab 100644 --- a/cf-check/cf-check.c +++ b/cf-check/cf-check.c @@ -130,7 +130,7 @@ int main(int argc, const char *const *argv) int c = 0; int start_index = 1; - const char *optstr = "+hMg:dvI"; // + means stop for non opt arg. :) + const char *optstr = "+hMVg:dvI"; // + means stop for non opt arg. :) while ((c = getopt_long(argc, (char *const *) argv, optstr, OPTIONS, &start_index)) != -1) { From da0c3f6ee1df3b1e07c82805c422ef902a9c9c2e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:42:54 +0000 Subject: [PATCH 02/10] cf-execd: Removed stray '1' from short option string '1' had no option table entry and no switch case, so -1 fell through to the generic usage error. It is a leftover from a removed undocumented alias for -F; --once/-O supersedes it. Changelog: none --- cf-execd/cf-execd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-execd/cf-execd.c b/cf-execd/cf-execd.c index 56ac5d7a58..d3b084ce60 100644 --- a/cf-execd/cf-execd.c +++ b/cf-execd/cf-execd.c @@ -240,7 +240,7 @@ static GenericAgentConfig *CheckOpts(int argc, char **argv) int longopt_idx; - while ((c = getopt_long(argc, argv, "dvnKIf:g:D:N:VxL:hFOV1gMWC::l", + while ((c = getopt_long(argc, argv, "dvnKIf:g:D:N:VxL:hFOVgMWC::l", OPTIONS, &longopt_idx)) != -1) { From fa793f5643ddb438cd497d11b514c627658ac7b6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:15 +0000 Subject: [PATCH 03/10] cf-monitord: Removed stray 'S' from short option string 'S' had no option table entry and no switch case, so -S fell through to the generic usage error. It is a leftover from the --syntax option removed in 2008. Changelog: none --- cf-monitord/cf-monitord.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-monitord/cf-monitord.c b/cf-monitord/cf-monitord.c index bc3c787164..d4281b2475 100644 --- a/cf-monitord/cf-monitord.c +++ b/cf-monitord/cf-monitord.c @@ -163,7 +163,7 @@ static GenericAgentConfig *CheckOpts(int argc, char **argv) GenericAgentConfig *config = GenericAgentConfigNewDefault(AGENT_TYPE_MONITOR, GetTTYInteractive()); int longopt_idx; - while ((c = getopt_long(argc, argv, "dvnIf:g:VSxHTKMFhC::l", + while ((c = getopt_long(argc, argv, "dvnIf:g:VxHTKMFhC::l", OPTIONS, &longopt_idx)) != -1) { switch (c) From 8f1f6529d5396bd5c39271ea32384b35a5e8557e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:28 +0000 Subject: [PATCH 04/10] cf-net: Added missing 't:' and 'c:' to short option string The long options --tls-version and --ciphers worked, but their advertised short forms -t and -c were rejected as unknown options because they were missing from the getopt option string. Both take a required argument and both already have switch case handlers. Changelog: Fixed cf-net -t (--tls-version) and -c (--ciphers) short options --- cf-net/cf-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-net/cf-net.c b/cf-net/cf-net.c index c20254035b..aaf8c7f4d2 100644 --- a/cf-net/cf-net.c +++ b/cf-net/cf-net.c @@ -304,7 +304,7 @@ static int CFNetParse(int argc, char **argv, *hostnames = NULL; int c = 0; int start_index = 1; - const char *optstr = "+hMg:H:p:sdvI"; // + means stop for non opt arg. :) + const char *optstr = "+hMg:H:p:sdvIt:c:"; // + means stop for non opt arg. :) while ((c = getopt_long(argc, argv, optstr, OPTIONS, &start_index)) != -1) { From 2d43475f9d2ea6d61daac99d06a81eeffff4c8ee Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:43 +0000 Subject: [PATCH 05/10] cf-promises: Removed stray 'S' and vestigial 'i:' from short option string Neither had an option table entry or a switch case: -S fell through to the generic usage error (leftover from the removed --syntax option), and -i silently swallowed an argument before erroring out. The deliberate deprecated -r error shim is left untouched. Changelog: none --- cf-promises/cf-promises.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-promises/cf-promises.c b/cf-promises/cf-promises.c index 022fe5b64f..ce10c61574 100644 --- a/cf-promises/cf-promises.c +++ b/cf-promises/cf-promises.c @@ -263,7 +263,7 @@ GenericAgentConfig *CheckOpts(int argc, char **argv) GenericAgentConfig *config = GenericAgentConfigNewDefault(AGENT_TYPE_COMMON, GetTTYInteractive()); int longopt_idx; - while ((c = getopt_long(argc, argv, "dvnIw:f:g:D:N:VSrxMb:i:p:s:cg:hW:C::T:l", + while ((c = getopt_long(argc, argv, "dvnIw:f:g:D:N:VrxMb:p:s:cg:hW:C::T:l", OPTIONS, &longopt_idx)) != -1) { From f7817a3b808b7f6b2923de659860929e463f3a78 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:57 +0000 Subject: [PATCH 06/10] cf-runagent: Removed vestigial 'q:' and stray 'S' from short option string Neither had an option table entry or a switch case: -q silently swallowed an argument before failing with the generic usage error (leftover from --query, which moved to cf-hub in 2013), and -S fell through to the same error (vestigial since 2008). Changelog: none --- cf-runagent/cf-runagent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-runagent/cf-runagent.c b/cf-runagent/cf-runagent.c index b465afb361..7f3ad88582 100644 --- a/cf-runagent/cf-runagent.c +++ b/cf-runagent/cf-runagent.c @@ -326,7 +326,7 @@ static GenericAgentConfig *CheckOpts(int argc, char **argv) REMOTEBUNDLES[0] = '\0'; int longopt_idx; - while ((c = getopt_long(argc, argv, "t:q:db::vnKhIif:g:D:VSxo:s:MH:C::l", + while ((c = getopt_long(argc, argv, "t:db::vnKhIif:g:D:Vxo:s:MH:C::l", OPTIONS, &longopt_idx)) != -1) { From 4fd98b4fc089342e1936f25f85827cb71799905a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:17 +0000 Subject: [PATCH 07/10] cf-runagent: Added --no-lock long option for existing -K The -K short option already worked (it sets ignore_locks) but had no option table entry, so it had no long form and was missing from --help and man output. This adds the --no-lock long option and hint, matching cf-agent, cf-execd, cf-serverd and cf-monitord. Changelog: Added --no-lock long option to cf-runagent, matching the existing -K short option --- cf-runagent/cf-runagent.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cf-runagent/cf-runagent.c b/cf-runagent/cf-runagent.c index 7f3ad88582..ae0f85d4b9 100644 --- a/cf-runagent/cf-runagent.c +++ b/cf-runagent/cf-runagent.c @@ -111,6 +111,7 @@ static const struct option OPTIONS[] = {"verbose", no_argument, 0, 'v'}, {"log-level", required_argument, 0, 'g'}, {"dry-run", no_argument, 0, 'n'}, + {"no-lock", no_argument, 0, 'K'}, {"version", no_argument, 0, 'V'}, {"file", required_argument, 0, 'f'}, {"define-class", required_argument, 0, 'D'}, @@ -138,6 +139,7 @@ static const char *const HINTS[] = "Output verbose information about the behaviour of cf-runagent", "Specify how detailed logs should be. Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug'", "All talk and no action mode - make no changes, only inform of promises not kept", + "Ignore locking constraints during execution (ifelapsed/expireafter) if \"too soon\" to run", "Output the version of the software", "Specify an alternative input file than the default. This option is overridden by FILE if supplied as argument.", "Define a list of comma separated classes to be sent to a remote agent", From 443c911fb1ef7732d973f1f62faea1347fdf0027 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:30 +0000 Subject: [PATCH 08/10] cf-secret: Added missing 'v', 'I' and 'g:' to short option string The --verbose, --inform and --log-level long options worked and their short forms are advertised in help and man output, but -v, -I and -g were rejected as unknown options because they were missing from the getopt option string. Also removed the stray 'e' left over from the removed --encrypt option. Changelog: Fixed cf-secret -v (--verbose), -g (--log-level) and -I (--inform) short options --- cf-secret/cf-secret.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-secret/cf-secret.c b/cf-secret/cf-secret.c index d446117e93..9d40269bb7 100644 --- a/cf-secret/cf-secret.c +++ b/cf-secret/cf-secret.c @@ -888,7 +888,7 @@ int main(int argc, char *argv[]) } int c = 0; - while ((c = getopt_long(argc - offset, argv + offset, "hMedk:o:H:", OPTIONS, NULL)) != -1) + while ((c = getopt_long(argc - offset, argv + offset, "hMdvIg:k:o:H:", OPTIONS, NULL)) != -1) { switch (c) { From 660af3c5692f0c46910c1e57d15551267f82b085 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:44 +0000 Subject: [PATCH 09/10] cf-serverd: Fixed -L (--ld-library-path) to consume its argument The option table declares --ld-library-path as required_argument, but the option string had a bare 'L', so '-L ' left optarg NULL (dereferenced unconditionally) and the path behind as a stray positional argument. Also removed the stray 'S' left over from the --syntax option removed in 2008. Changelog: Fixed cf-serverd -L (--ld-library-path) to accept its argument --- cf-serverd/cf-serverd-functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-serverd/cf-serverd-functions.c b/cf-serverd/cf-serverd-functions.c index 8e4d352780..b52be4d7c7 100644 --- a/cf-serverd/cf-serverd-functions.c +++ b/cf-serverd/cf-serverd-functions.c @@ -174,7 +174,7 @@ GenericAgentConfig *CheckOpts(int argc, char **argv) GenericAgentConfig *config = GenericAgentConfigNewDefault(AGENT_TYPE_SERVER, GetTTYInteractive()); int longopt_idx; - while ((c = getopt_long(argc, argv, "dvIKf:g:D:N:VSxLFMhAC::lt::", + while ((c = getopt_long(argc, argv, "dvIKf:g:D:N:VxL:FMhAC::lt::", OPTIONS, &longopt_idx)) != -1) { From 9bad5911edf25e2522b2174e1e07536fbffe4e76 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:58 +0000 Subject: [PATCH 10/10] cf-testd: Added missing 'r:' to short option string The --report long option worked and -r is advertised in help output, but the short form was rejected because 'r' was missing from the getopt option string. Also removed the orphan 'f:' left behind when --file/-f was renamed to --report/-r. Changelog: none --- cf-testd/cf-testd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-testd/cf-testd.c b/cf-testd/cf-testd.c index d195a46142..f5cde968b6 100644 --- a/cf-testd/cf-testd.c +++ b/cf-testd/cf-testd.c @@ -163,7 +163,7 @@ CFTestD_Config *CFTestD_CheckOpts(int argc, char **argv, long *n_threads) CFTestD_Config *config = CFTestD_ConfigInit(); assert(config != NULL); - while ((c = getopt_long(argc, argv, "a:df:g:hIj:k:lp:vV", OPTIONS, NULL)) != -1) + while ((c = getopt_long(argc, argv, "a:dg:hIj:k:lp:r:vV", OPTIONS, NULL)) != -1) { switch (c) {