From c03f812900380b2e76e4c93ff179cf256fba2549 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:42:42 +0000 Subject: [PATCH 01/11] 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 (cherry picked from commit 89d8d81b10fc180be780285c6d03511ae7a835cd) --- 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 46520c69d97..1fbdb69cab8 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 6ee1b20ba5fa8e1b3c48e53de1c4854b8442b73d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:42:54 +0000 Subject: [PATCH 02/11] 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 (cherry picked from commit da0c3f6ee1df3b1e07c82805c422ef902a9c9c2e) --- 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 56ac5d7a58f..d3b084ce603 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 2c359119dac6a40e4a9e80e2851784f6b9e552c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:15 +0000 Subject: [PATCH 03/11] 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 (cherry picked from commit fa793f5643ddb438cd497d11b514c627658ac7b6) --- 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 bc3c787164d..d4281b24757 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 690aee5076e3c0450a3420bb568a36d578301a60 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:28 +0000 Subject: [PATCH 04/11] 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 (cherry picked from commit 8f1f6529d5396bd5c39271ea32384b35a5e8557e) --- 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 1573847e15c..424cff1a3af 100644 --- a/cf-net/cf-net.c +++ b/cf-net/cf-net.c @@ -293,7 +293,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 12b70b493b3e4952cb6d2d840aeb2c7b43fc9274 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:43 +0000 Subject: [PATCH 05/11] 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 (cherry picked from commit 2d43475f9d2ea6d61daac99d06a81eeffff4c8ee) --- 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 022fe5b64f7..ce10c615743 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 ac427f1c7e149d0a39c91fed7f3ca9c6dc13ba36 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:43:57 +0000 Subject: [PATCH 06/11] 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 (cherry picked from commit f7817a3b808b7f6b2923de659860929e463f3a78) --- 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 b465afb3617..7f3ad885827 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 7a7a55256abc62182e69bcbba5a9a631d0e8d791 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:17 +0000 Subject: [PATCH 07/11] 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 (cherry picked from commit 4fd98b4fc089342e1936f25f85827cb71799905a) --- 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 7f3ad885827..ae0f85d4b94 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 44a2f65a00ade39fd63ee111b069defe3c8cd8e4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:30 +0000 Subject: [PATCH 08/11] 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 (cherry picked from commit 443c911fb1ef7732d973f1f62faea1347fdf0027) --- 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 d446117e93c..9d40269bb7b 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 097d4a39e38ab918c7648e0066537558325c6d87 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:44 +0000 Subject: [PATCH 09/11] 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 (cherry picked from commit 660af3c5692f0c46910c1e57d15551267f82b085) --- 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 8e4d3527802..b52be4d7c79 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 130582c9c7c31b0b621cc61fb97eb0f5948c6ec3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Jul 2026 19:44:58 +0000 Subject: [PATCH 10/11] 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 (cherry picked from commit 9bad5911edf25e2522b2174e1e07536fbffe4e76) --- 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 f089ce118ab..d2dde9dc26f 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) { From 6ed58684cd9dcca3803414a0ffe3dda96d53f402 Mon Sep 17 00:00:00 2001 From: Victor Moene Date: Wed, 16 Sep 2026 16:20:28 +0200 Subject: [PATCH 11/11] Fixed lmdb maxkeysize assertion for macos Changelog: title Signed-off-by: Victor Moene As of LMDB 1.0.0, MDB_MAXKEYSIZE defaults to 0 (computed from the page size) instead of the fixed compile-time 511 used by LMDB <1.0.0, and mdb_env_get_maxkeysize() only returns the correct value once the environment has actually been opened (env->me_maxkey is populated by mdb_env_open()). So this can only be checked after a successful open, not beforehand like it could with older LMDB versions. The assertion breaks on macos because the environement there uses a newer lmdb package. (cherry picked from commit 0e31cc1dbf58596c83afe4c9cfbad6560d9ca8f0) Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QBeMeG8RBD7KoaQchhpCGq --- libpromises/dbm_lmdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpromises/dbm_lmdb.c b/libpromises/dbm_lmdb.c index b062774092b..76674c7c0a7 100644 --- a/libpromises/dbm_lmdb.c +++ b/libpromises/dbm_lmdb.c @@ -221,7 +221,6 @@ static int LmdbEnvOpen( { assert(env != NULL); // dereferenced in lmdb (mdb_env_open) assert(path != NULL); // dereferenced (strlen) in lmdb (mdb_env_open) - assert(mdb_env_get_maxkeysize(env) == 511); // Search for 511 in locks.c /* There is a race condition in LMDB that will fail to open the database * environment if another process is opening it at the exact same time. This @@ -233,6 +232,10 @@ static int LmdbEnvOpen( while (attempts-- > 0) { int rc = mdb_env_open(env, path, flags, mode); + if (rc == MDB_SUCCESS) + { + assert(mdb_env_get_maxkeysize(env) >= 511); // Search for 511 in locks.c + } if (rc != ENOENT) { return rc;