diff --git a/Fix-allocated-memory-not-released.patch b/Fix-allocated-memory-not-released.patch deleted file mode 100644 index 74a4e53b267e0ddbd4464cd34303f94c3d17ff76..0000000000000000000000000000000000000000 --- a/Fix-allocated-memory-not-released.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 1f10d92214e3f6f23b8d00dccafb5ad57856fbbd Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 18 Jun 2022 17:35:35 +0300 -Subject: [PATCH] Fix https://puszcza.gnu.org.ua/bugs/index.php?563 - ---- - tools/gdbmshell.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c -index 20c6ea9..1f61b5b 100644 ---- a/tools/gdbmshell.c -+++ b/tools/gdbmshell.c -@@ -1328,6 +1328,7 @@ snapshot_handler (struct command_param *param, struct command_environ *cenv) - char *sb = tildexpand (PARAM_STRING (param, 1)); - char const *sel; - int rc = gdbm_latest_snapshot (sa, sb, &sel); -+ int res; - - if (rc >= 0 && rc < ARRAY_SIZE (snapshot_status_info)) - { -@@ -1339,13 +1340,17 @@ snapshot_handler (struct command_param *param, struct command_environ *cenv) - snapshot_status_info[rc].fn (cenv->fp, sa, sb); - if (rc == GDBM_SNAPSHOT_OK) - print_snapshot (sel, cenv->fp); -+ res = GDBMSHELL_OK; - } - else - { - terror (_("unexpected error code: %d"), rc); -- return GDBMSHELL_ERR; -+ res = GDBMSHELL_ERR; - } -- return GDBMSHELL_OK; -+ -+ free (sa); -+ free (sb); -+ return res; - } - - --- -2.33.0 - diff --git a/Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch b/Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch deleted file mode 100644 index e52c64240c1de0302c676fb885d300543238dc18..0000000000000000000000000000000000000000 --- a/Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 94d0a6238e9573473d2cfdc74135305b2f6741f2 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Thu, 9 Jun 2022 22:44:26 +0300 -Subject: [PATCH 05/14] Fix binary dump format for key and/or data of zero - size. - -Fixes https://puszcza.gnu.org.ua/bugs/?565 - -* src/gdbmexp.c (gdbm_export_to_file): Check for positive size before -attempting to write. -* src/gdbmimp.c (gdbm_import_from_file): Check for positive size before -attempting to read. ---- - src/gdbmexp.c | 4 ++-- - src/gdbmimp.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/gdbmexp.c b/src/gdbmexp.c -index 6646bba..6f20fe6 100644 ---- a/src/gdbmexp.c -+++ b/src/gdbmexp.c -@@ -65,13 +65,13 @@ gdbm_export_to_file (GDBM_FILE dbf, FILE *fp) - size = htonl (key.dsize); - if (fwrite (&size, sizeof (size), 1, fp) != 1) - goto write_fail; -- if (fwrite (key.dptr, key.dsize, 1, fp) != 1) -+ if (key.dsize > 0 && fwrite (key.dptr, key.dsize, 1, fp) != 1) - goto write_fail; - - size = htonl (data.dsize); - if (fwrite (&size, sizeof (size), 1, fp) != 1) - goto write_fail; -- if (fwrite (data.dptr, data.dsize, 1, fp) != 1) -+ if (data.dsize > 0 && fwrite (data.dptr, data.dsize, 1, fp) != 1) - goto write_fail; - } - -diff --git a/src/gdbmimp.c b/src/gdbmimp.c -index be98ed7..73c0b74 100644 ---- a/src/gdbmimp.c -+++ b/src/gdbmimp.c -@@ -113,7 +113,7 @@ gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag) - key.dsize = (int) size; - - /* Read the data. */ -- if (fread (&rsize, sizeof (rsize), 1, fp) != 1) -+ if (size > 0 && fread (&rsize, sizeof (rsize), 1, fp) != 1) - { - ec = GDBM_FILE_READ_ERROR; - break; -@@ -135,7 +135,7 @@ gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag) - break; - } - } -- if (fread (dbuffer, size, 1, fp) != 1) -+ if (size > 0 && fread (dbuffer, size, 1, fp) != 1) - { - ec = GDBM_FILE_READ_ERROR; - break; --- -2.33.0 - diff --git a/Fix-coredump-in-gdbmtool-history-command.patch b/Fix-coredump-in-gdbmtool-history-command.patch deleted file mode 100644 index 491587582c38ba7d2555ece5e47d93e7483b0fcb..0000000000000000000000000000000000000000 --- a/Fix-coredump-in-gdbmtool-history-command.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c25c66f3194f9c75483e550832d65d6554b22ec8 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Mon, 27 Jun 2022 11:49:31 +0300 -Subject: [PATCH] Fix bug #569 - -* tools/gdbmshell.c (input_history_begin): return GDBMSHELL_ERR -if history is not available. ---- - tools/gdbmshell.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c -index bccda41..20c6ea9 100644 ---- a/tools/gdbmshell.c -+++ b/tools/gdbmshell.c -@@ -1892,7 +1892,7 @@ input_history_begin (struct command_param *param, - /* TRANSLATORS: %s is the stream name */ - terror (_("input history is not available for %s input stream"), - input_stream_name ()); -- return GDBMSHELL_OK; -+ return GDBMSHELL_ERR; - } - - switch (param->argc) --- -2.33.0 - diff --git a/Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch b/Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch deleted file mode 100644 index 7b7f0cc2920ec07a47df2af75cf76114eb47e8ea..0000000000000000000000000000000000000000 --- a/Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch +++ /dev/null @@ -1,247 +0,0 @@ -From b5801318089f1dd062d039661aed3c701f2943c8 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 18 Jun 2022 17:18:05 +0300 -Subject: [PATCH] Fix location tracking in gdbmtool. Fix the recover command. - -In particular, this addresses https://puszcza.gnu.org.ua/bugs/?566 - -* tools/gdbmshell.c: Fix parameter parsing failure -(recover_handler): Accept varargs -(command_tab): Use argdoc to provide help for varargs -(help_handler): Handle argdoc -* tools/gram.y: Accept a single unadorned key=value pair as argument. - -Conflict: Fix only the part that caused the problem -Origin Patch: https://git.gnu.org.ua/gdbm.git/commit/?id=b8271d89db991558e10c26d45d960bbc0257fa31 ---- - tools/gdbmshell.c | 150 ++++++++++++++++++++++++++++------------------ - tools/gram.y | 8 +++ - 2 files changed, 101 insertions(+), 57 deletions(-) - -diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c -index 22c4938..bccda41 100644 ---- a/tools/gdbmshell.c -+++ b/tools/gdbmshell.c -@@ -668,64 +668,95 @@ recover_handler (struct command_param *param, struct command_environ *cenv) - gdbm_recovery rcvr; - int flags = 0; - int rc; -- int i; - char *p; - int summary = 0; - -- for (i = 0; i < param->argc; i++) -+ if (param->vararg) - { -- char *arg = PARAM_STRING (param, i); -- if (strcmp (arg, "verbose") == 0) -- { -- rcvr.errfun = err_printer; -- flags |= GDBM_RCVR_ERRFUN; -- } -- else if (strcmp (arg, "force") == 0) -- { -- flags |= GDBM_RCVR_FORCE; -- } -- else if (strcmp (arg, "summary") == 0) -- { -- summary = 1; -- } -- else if (strcmp (arg, "backup") == 0) -- { -- flags |= GDBM_RCVR_BACKUP; -- } -- else if (strncmp (arg, "max-failures=", 13) == 0) -+ struct gdbmarg *arg; -+ int i; -+ -+ for (arg = param->vararg, i = 0; arg; arg = arg->next, i++) - { -- rcvr.max_failures = strtoul (arg + 13, &p, 10); -- if (*p) -+ if (arg->type == GDBM_ARG_STRING) - { -- terror (_("not a number (stopped near %s)"), p); -- return 1; -+ if (strcmp (arg->v.string, "verbose") == 0) -+ { -+ rcvr.errfun = err_printer; -+ flags |= GDBM_RCVR_ERRFUN; -+ } -+ else if (strcmp (arg->v.string, "force") == 0) -+ { -+ flags |= GDBM_RCVR_FORCE; -+ } -+ else if (strcmp (arg->v.string, "summary") == 0) -+ { -+ summary = 1; -+ } -+ else if (strcmp (arg->v.string, "backup") == 0) -+ { -+ flags |= GDBM_RCVR_BACKUP; -+ } -+ else -+ { -+ lerror (&arg->loc, _("unrecognized argument: %s"), arg->v.string); -+ return GDBMSHELL_SYNTAX; -+ } - } -- flags |= GDBM_RCVR_MAX_FAILURES; -- } -- else if (strncmp (arg, "max-failed-keys=", 16) == 0) -- { -- rcvr.max_failed_keys = strtoul (arg + 16, &p, 10); -- if (*p) -+ else if (arg->type == GDBM_ARG_KVPAIR) - { -- terror (_("not a number (stopped near %s)"), p); -- return 1; -+ if (arg->v.kvpair->type != KV_STRING) -+ { -+ lerror (&arg->loc, _("%s: bad argument type"), arg->v.kvpair->key); -+ return GDBMSHELL_SYNTAX; -+ } -+ else if (arg->v.kvpair->next) -+ { -+ lerror (&arg->loc, _("unexpected compound statement")); -+ return GDBMSHELL_SYNTAX; -+ } -+ -+ if (strcmp (arg->v.kvpair->key, "max-failures") == 0) -+ { -+ rcvr.max_failures = strtoul (arg->v.kvpair->val.s, &p, 10); -+ if (*p) -+ { -+ lerror (&arg->loc, _("not a number (stopped near %s)"), p); -+ return GDBMSHELL_SYNTAX; -+ } -+ flags |= GDBM_RCVR_MAX_FAILURES; -+ } -+ else if (strcmp (arg->v.kvpair->key, "max-failed-keys") == 0) -+ { -+ rcvr.max_failed_keys = strtoul (arg->v.kvpair->val.s, &p, 10); -+ if (*p) -+ { -+ lerror (&arg->loc, _("not a number (stopped near %s)"), p); -+ return GDBMSHELL_SYNTAX; -+ } -+ flags |= GDBM_RCVR_MAX_FAILED_KEYS; -+ } -+ else if (strcmp (arg->v.kvpair->key, "max-failed-buckets") == 0) -+ { -+ rcvr.max_failures = strtoul (arg->v.kvpair->val.s, &p, 10); -+ if (*p) -+ { -+ lerror (&arg->loc, _("not a number (stopped near %s)"), p); -+ return GDBMSHELL_SYNTAX; -+ } -+ flags |= GDBM_RCVR_MAX_FAILED_BUCKETS; -+ } -+ else -+ { -+ lerror (&arg->loc, _("unrecognized argument: %s"), arg->v.kvpair->key); -+ return GDBMSHELL_SYNTAX; -+ } - } -- flags |= GDBM_RCVR_MAX_FAILED_KEYS; -- } -- else if (strncmp (arg, "max-failed-buckets=", 19) == 0) -- { -- rcvr.max_failures = strtoul (arg + 19, &p, 10); -- if (*p) -+ else - { -- terror (_("not a number (stopped near %s)"), p); -- return 1; -+ lerror (&arg->loc, _("unexpected datum")); -+ return GDBMSHELL_SYNTAX; - } -- flags |= GDBM_RCVR_MAX_FAILED_BUCKETS; -- } -- else -- { -- terror (_("unrecognized argument: %s"), arg); -- return GDBMSHELL_SYNTAX; - } - } - -@@ -1943,6 +1974,7 @@ struct command - int (*handler) (struct command_param *param, struct command_environ *cenv); - void (*end) (void *data); - struct argdef args[NARGS]; -+ char *argdoc[NARGS]; - int variadic; - enum command_repeat_type repeat; - char *doc; -@@ -2073,21 +2105,21 @@ static struct command command_tab[] = { - }, - { - .name = "recover", -- .args = { -- { "[verbose]", GDBM_ARG_STRING }, -- { "[summary]", GDBM_ARG_STRING }, -- { "[backup]", GDBM_ARG_STRING }, -- { "[force]", GDBM_ARG_STRING }, -- { "[max-failed-keys=N]", GDBM_ARG_STRING }, -- { "[max-failed-buckets=N]", GDBM_ARG_STRING }, -- { "[max-failures=N]", GDBM_ARG_STRING }, -- { NULL } -+ .argdoc = { -+ "[verbose]", -+ "[summary]", -+ "[backup]", -+ "[force]", -+ "[max-failed-keys=N]", -+ "[max-failed-buckets=N]", -+ "[max-failures=N]", -+ NULL - }, - .doc = N_("recover the database"), - .tok = T_CMD, - .begin = checkdb_begin, - .handler = recover_handler, -- .variadic = FALSE, -+ .variadic = TRUE, - .repeat = REPEAT_NEVER, - }, - { -@@ -2435,6 +2467,10 @@ help_handler (struct command_param *param GDBM_ARG_UNUSED, - { - wordwrap_printf (wf, " %s", gettext (cmd->args[i].name)); - } -+ for (i = 0; cmd->argdoc[i]; i++) -+ { -+ wordwrap_printf (wf, " %s", gettext (cmd->argdoc[i])); -+ } - - wordwrap_set_right_margin (wf, 0); - wordwrap_set_left_margin (wf, CMDCOLS); -diff --git a/tools/gram.y b/tools/gram.y -index 6b09152..b1360ae 100644 ---- a/tools/gram.y -+++ b/tools/gram.y -@@ -149,6 +149,13 @@ arg : string - { - $$ = gdbmarg_string ($1, &@1); - } -+ | T_IDENT '=' string -+ { -+ struct locus loc = { .beg = @1.beg, .end = @3.end }; -+ struct kvpair *kvp = kvpair_string (&loc, $3); -+ kvp->key = $1; -+ $$ = gdbmarg_kvpair (kvp, &loc); -+ } - | compound - { - $$ = gdbmarg_kvpair ($1, &@1); -@@ -184,6 +191,7 @@ kvpair : value - | T_IDENT '=' value - { - $3->key = $1; -+ $3->loc.beg = @1.beg; - $$ = $3; - } - ; --- -2.33.0 - diff --git a/Fix-semantics-of-gdbm_load-r.patch b/Fix-semantics-of-gdbm_load-r.patch deleted file mode 100644 index 8b5a68474a8dff3ad0612e23a666316409637748..0000000000000000000000000000000000000000 --- a/Fix-semantics-of-gdbm_load-r.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 0591202918948d41e331094b283ff699ab916c54 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Fri, 1 Jul 2022 14:03:22 +0300 -Subject: [PATCH 11/14] Fix semantics of gdbm_load -r - -Fixes https://puszcza.gnu.org.ua/bugs/index.php?573 - -* tools/gdbm_load.c: New option: --update (-U) -The --replace (-r) option is valid only if used together with ---update. -* NEWS: Document changes. -* doc/gdbm.texi: Document changes. ---- - NEWS | 13 ++++++++++++- - doc/gdbm.texi | 25 ++++++++++++++++++++++--- - tools/gdbm_load.c | 20 ++++++++++++++++++-- - 3 files changed, 52 insertions(+), 6 deletions(-) - -diff --git a/NEWS b/NEWS -index 16d8d2a..a0d16b1 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,8 +1,19 @@ --GNU dbm NEWS -- history of user-visible changes. 2022-02-04 -+GNU dbm NEWS -- history of user-visible changes. 2022-07-01 - Copyright (C) 1990-2022 Free Software Foundation, Inc. - See the end of file for copying conditions. - - Please send gdbm bug reports to . -+ -+ -+* New gdbm_load option: --update -+ -+The --update (-U) option instructs gdbm_load to update an existing -+database, whose name is supplied by the second argument. -+ -+* Fix semantics of gdbm_load -r -+ -+The --replace (-r) is valid only when used together with --update. -+ - - Version 1.23, 2022-02-04 - -diff --git a/doc/gdbm.texi b/doc/gdbm.texi -index e34873f..4fa841f 100644 ---- a/doc/gdbm.texi -+++ b/doc/gdbm.texi -@@ -3251,6 +3251,8 @@ symmetry). A special code @samp{all} stands for all available error codes. - - In boolean context, the @code{true} value is equivalent to @samp{all}, - and @code{false} (i.e. variable unset) is equivalent to @samp{-all}. -+ -+This variable cannot be set from interactive sessions. - @end deftypevr - - @deftypevr {gdbmtool variable} string errormask -@@ -4070,9 +4072,17 @@ must be given as the second argument. - - In general, if two arguments are given, the second one is treated as - the name of the database to create, overriding the file name specified --in the flat file. -+in the flat file. All existing keys will be removed from this -+database prior to loading from the dump. Use the @option{--update} -+(@option{-U}) option if it is not what you wish. -+ -+When given the @option{--update} (@option{-U}) option, -+@command{gdbm_load} will update the existing database with the data -+from the dump. It will bail out if the dump contains a key that is -+already present in the database. To silently overwrite existing keys, -+use the @option{--replace} (@option{-r}) option. - --The utility understands the following command line arguments: -+The utility understands the following command line options: - - @table @option - -@@ -4098,7 +4108,16 @@ Do not restore file meta-data (ownership and mode) from the flat file. - - @item -r - @itemx --replace --Replace existing keys. -+Replace existing keys. This option can be used only together with -+@option{--update} (@option{-U}). -+ -+@item -U -+@itemx --update -+Update an existing database. The database name must be given in the -+second argument to @command{gdbm_load}. The key/value pairs from the -+dump file will be added to that database, without removing the -+existing keys. To overwrite the existing keys from the dump file, use -+@option{--update --replace}. - - @item -u @var{user}[:@var{group}] - @itemx --user=@var{user}[:@var{group}] -diff --git a/tools/gdbm_load.c b/tools/gdbm_load.c -index b4691c9..5d5e50e 100644 ---- a/tools/gdbm_load.c -+++ b/tools/gdbm_load.c -@@ -32,8 +32,9 @@ gid_t owner_gid; - char *parseopt_program_doc = N_("load a GDBM database from a file"); - char *parseopt_program_args = N_("FILE [DB_FILE]"); - struct gdbm_option optab[] = { -- { 'r', "replace", NULL, N_("replace records in the existing database") }, -+ { 'r', "replace", NULL, N_("replace records in the existing database (needs -U)") }, - { 'm', "mode", N_("MODE"), N_("set file mode") }, -+ { 'U', "update", NULL, N_("update the existing database") }, - { 'u', "user", N_("NAME|UID[:NAME|GID]"), N_("set file owner") }, - { 'n', "no-meta", NULL, N_("do not attempt to set file meta-data") }, - { 'M', "mmap", NULL, N_("use memory mapping") }, -@@ -139,6 +140,10 @@ main (int argc, char **argv) - } - break; - -+ case 'U': -+ oflags = (oflags & ~GDBM_OPENMASK) | GDBM_WRCREAT; -+ break; -+ - case 'u': - { - size_t len; -@@ -228,13 +233,24 @@ main (int argc, char **argv) - - if (argc > 2) - { -- error (_("too many arguments; try `%s -h' for more info"), progname); -+ error (_("too many arguments; try `%s -h' for more info")); -+ exit (EXIT_USAGE); -+ } -+ -+ if (replace && (oflags & GDBM_OPENMASK) != GDBM_WRCREAT) -+ { -+ error (_("-r is useless without -U")); - exit (EXIT_USAGE); - } - - filename = argv[0]; - if (argc == 2) - dbname = argv[1]; -+ else if (oflags & GDBM_WRCREAT) -+ { -+ error (_("-U requires DB_FILE to be supplied")); -+ exit (EXIT_USAGE); -+ } - else - dbname = NULL; - --- -2.33.0 - diff --git a/Improve-handling-of-u-in-gdbm_load.patch b/Improve-handling-of-u-in-gdbm_load.patch deleted file mode 100644 index 7f6047e0698da649e31956a62a31ccf5de4f0766..0000000000000000000000000000000000000000 --- a/Improve-handling-of-u-in-gdbm_load.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 4cfdc68fd862a4e80f42f14aa92cb25db08b2466 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 2 Jul 2022 19:29:47 +0300 -Subject: [PATCH 12/14] Improve handling of -u in gdbm_load - -* tools/gdbm_load.c (main): Imply the owner login group if owner name -is followed by a :, and the current login group otherwise. -* doc/gdbm.texi: Document changes. ---- - doc/gdbm.texi | 13 ++++++++----- - tools/gdbm_load.c | 9 +++++++-- - 2 files changed, 15 insertions(+), 7 deletions(-) - -diff --git a/doc/gdbm.texi b/doc/gdbm.texi -index 4fa841f..037ae07 100644 ---- a/doc/gdbm.texi -+++ b/doc/gdbm.texi -@@ -4119,13 +4119,16 @@ dump file will be added to that database, without removing the - existing keys. To overwrite the existing keys from the dump file, use - @option{--update --replace}. - --@item -u @var{user}[:@var{group}] --@itemx --user=@var{user}[:@var{group}] --Set file owner. The @var{user} can be either a valid user name or -+@item -u @var{owner}[:[@var{group}]] -+@itemx --user=@var{owner}[:[@var{group}]] -+Set file owner. The @var{owner} can be either a valid user name or - UID. Similarly, the @var{group} is either a valid group name or GID. --If @var{group} is not given, the main group of @var{user} is used. -+If @var{group} is not given, the main group of @var{owner} is implied, if -+@var{owner} is followed by a @samp{:}, otherwise the login group of the -+current user is implied. - --User and group parts can be separated by a dot, instead of the colon. -+User and group parts can be separated by a dot, instead of the colon, -+but such usage is discouraged. - - @item -h - @itemx --help -diff --git a/tools/gdbm_load.c b/tools/gdbm_load.c -index 5d5e50e..e7e2ab1 100644 ---- a/tools/gdbm_load.c -+++ b/tools/gdbm_load.c -@@ -148,9 +148,10 @@ main (int argc, char **argv) - { - size_t len; - struct passwd *pw; -+ int delim; - - len = strcspn (optarg, ".:"); -- if (optarg[len]) -+ if ((delim = optarg[len]) != 0) - optarg[len++] = 0; - pw = getpwnam (optarg); - if (pw) -@@ -187,7 +188,7 @@ main (int argc, char **argv) - } - } - } -- else -+ else if (delim) - { - if (!pw) - { -@@ -200,6 +201,10 @@ main (int argc, char **argv) - } - owner_gid = pw->pw_gid; - } -+ else -+ { -+ owner_gid = getgid(); -+ } - meta_mask |= GDBM_META_MASK_OWNER; - } - break; --- -2.33.0 - diff --git a/Minor-fix-in-the-compatibility-library.patch b/Minor-fix-in-the-compatibility-library.patch deleted file mode 100644 index f96e2a7b38cf3169db43d3c2ac6a8d6d1f561433..0000000000000000000000000000000000000000 --- a/Minor-fix-in-the-compatibility-library.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 3e63a788d4c7b5cb1173937118135c2bcca35a02 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Fri, 3 Mar 2023 13:52:56 +0200 -Subject: [PATCH] Minor fix in the compatibility library. - -* compat/dbmopen.c (ndbm_open_dir_file0): Don't try to unlink -the 1.8-compatible dir file or create a missing one if the database -is being opened read-only. ---- - compat/dbmopen.c | 26 +++++++++++++++++++++----- - 1 file changed, 21 insertions(+), 5 deletions(-) - -diff --git a/compat/dbmopen.c b/compat/dbmopen.c -index b11af98..cb979b5 100644 ---- a/compat/dbmopen.c -+++ b/compat/dbmopen.c -@@ -81,12 +81,21 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode) - { - if (st.st_dev == pagst.st_dev && st.st_ino == pagst.st_ino) - { -- if (unlink (file_name)) -+ if (flags == O_RDONLY) - { -- if ((mode & GDBM_OPENMASK) == GDBM_READER) -- /* Ok, try to cope with it. */ -- return pagfd; -- else if (errno != ENOENT) -+ /* -+ * Don't touch the link if the database is opened read-only. -+ * Return a meaningful file descriptor for the sake -+ * of those programs that compare it with pagfd trying -+ * to detect old GDBM versions (as Sendmail does). -+ */ -+ if ((fd = open ("/dev/null", flags)) == -1) -+ gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE); -+ return fd; -+ } -+ else if (unlink (file_name)) -+ { -+ if (errno != ENOENT) - { - gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE); - return -1; -@@ -138,6 +147,13 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode) - return -1; - } - } -+ else if (flags == O_RDONLY) -+ { -+ /* See the comment above. */ -+ if ((fd = open ("/dev/null", flags)) == -1) -+ gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE); -+ return fd; -+ } - - /* File does not exist. Create it. */ - fd = open (file_name, flags | O_CREAT, pagst.st_mode & 0777); --- -2.33.0 - diff --git a/Restore-accidentally-removed-parameter-and-New-macro.patch b/Restore-accidentally-removed-parameter-and-New-macro.patch deleted file mode 100644 index a846dd3968338d44bb6c9a72f3d85ef1fa3a1d04..0000000000000000000000000000000000000000 --- a/Restore-accidentally-removed-parameter-and-New-macro.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 331f05ac9c58d358806fe1bcba88a01467ab0895 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Mon, 4 Jul 2022 13:41:43 +0300 -Subject: [PATCH] Bugfix - -* tools/gdbm_load.c (main): Restore accidentally removed parameter. -* tools/gdbmapp.h (GDBM_PRINTFLIKE): New macro -(gdbm_perror, sys_perror, error): Mark as printf-like. ---- - tools/gdbm_load.c | 2 +- - tools/gdbmapp.h | 10 +++++++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/tools/gdbm_load.c b/tools/gdbm_load.c -index e7e2ab1..78ab6a8 100644 ---- a/tools/gdbm_load.c -+++ b/tools/gdbm_load.c -@@ -238,7 +238,7 @@ main (int argc, char **argv) - - if (argc > 2) - { -- error (_("too many arguments; try `%s -h' for more info")); -+ error (_("too many arguments; try `%s -h' for more info"), progname); - exit (EXIT_USAGE); - } - -diff --git a/tools/gdbmapp.h b/tools/gdbmapp.h -index 1bccb3d..94c04f6 100644 ---- a/tools/gdbmapp.h -+++ b/tools/gdbmapp.h -@@ -21,12 +21,16 @@ - # include - #endif - -+#ifndef GDBM_PRINTFLIKE -+# define GDBM_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg))) -+#endif -+ - extern const char *progname; - - void set_progname (const char *arg); --void gdbm_perror (const char *fmt, ...); --void sys_perror (int code, const char *fmt, ...); --void error (const char *fmt, ...); -+void gdbm_perror (const char *fmt, ...) GDBM_PRINTFLIKE(1,2); -+void sys_perror (int code, const char *fmt, ...) GDBM_PRINTFLIKE(2,3); -+void error (const char *fmt, ...) GDBM_PRINTFLIKE(1,2); - void verror (const char *fmt, va_list ap); - - void *emalloc (size_t size); --- -2.33.0 - diff --git a/gdbm-1.23.tar.gz b/gdbm-1.23.tar.gz deleted file mode 100644 index 9ee212707bac2e3eb78d2d66f295f6673100068e..0000000000000000000000000000000000000000 Binary files a/gdbm-1.23.tar.gz and /dev/null differ diff --git a/gdbm-1.26.tar.gz b/gdbm-1.26.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7f9a853e445b5d7ab875f30dd718ef51e74dafd8 Binary files /dev/null and b/gdbm-1.26.tar.gz differ diff --git a/gdbm.spec b/gdbm.spec index 2580f04489e042c6c63bf987ced51fa511d25a04..b2312389ca2e29d82a52878e2b1c82066ceca4a2 100644 --- a/gdbm.spec +++ b/gdbm.spec @@ -1,27 +1,17 @@ Name: gdbm -Version: 1.23 -Release: 3 +Version: 1.26 +Release: 1 Epoch: 1 Summary: A library of database functions that work similar to the standard UNIX dbm -License: GPLv3+ -URL: http://www.gnu.org/software/gdbm/ -Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz - -Patch0: Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch -Patch1: gdbm_dump-fix-command-line-error-detection.patch -Patch2: Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch -Patch3: Fix-coredump-in-gdbmtool-history-command.patch -Patch4: Fix-semantics-of-gdbm_load-r.patch -Patch5: Improve-handling-of-u-in-gdbm_load.patch -Patch6: Fix-allocated-memory-not-released.patch -Patch7: Restore-accidentally-removed-parameter-and-New-macro.patch -Patch8: Minor-fix-in-the-compatibility-library.patch +License: GPL-3.0-or-later +URL: https://www.gnu.org/software/gdbm/ +Source0: https://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz BuildRequires: gcc libtool gettext readline-devel bison flex texinfo -Provides: %{name}-libs -Provides: %{name}-libs%{?_isa} -Obsoletes: %{name}-libs <= %{version} +Provides: %{name}-libs = %{epoch}:%{version}-%{release} +Provides: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-libs < %{epoch}:%{version} %description GNU dbm (or GDBM, for short) is a library of database functions that @@ -32,30 +22,20 @@ manipulate a hashed database. %package devel Summary: Header files and libraries for development Requires: %{name} = %{epoch}:%{version}-%{release} -Requires(post): info -Requires(preun): info -Obsoletes: %{name}-libs <= %{version} %description devel Gdbm-devel contains the header files and libraries for development. You should install this package if you want to develop applications base on gdbm database. -%package help -Summary: Documents for %{name} -Buildarch: noarch -Requires: man info - -%description help -Man pages and other related documents for %{name}. +%package_help %prep %autosetup -n %{name}-%{version} -p1 %build %configure --disable-static --disable-largefile --disable-rpath --enable-libgdbm-compat -sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool -sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +%disable_rpath %make_build %install @@ -70,22 +50,11 @@ ln -sf ../ndbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/ndbm.h ln -sf ../dbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/dbm.h rm -f $RPM_BUILD_ROOT/%{_infodir}/dir +%delete_la %check export LD_LIBRARY_PATH=`pwd`/src/.libs/:`pwd`/compat/.libs/ -make check - -%ldconfig_scriptlets - -%post devel -/sbin/install-info %{_infodir}/gdbm.info.gz %{_infodir}/dir \ - --entry="* gdbm: (gdbm). The GNU Database." || : - -%preun devel -if [ $1 = 0 ]; then - /sbin/install-info --delete %{_infodir}/gdbm.info.gz %{_infodir}/dir \ - --entry="* gdbm: (gdbm). The GNU Database." || : -fi +%make_build check %files -f %{name}.lang %doc NEWS README THANKS AUTHORS NOTE-WARNING @@ -93,20 +62,20 @@ fi %{_bindir}/gdbm* %{_libdir}/libgdbm.so.6* %{_libdir}/libgdbm_compat.so.4* -%exclude %{_libdir}/*.la %files devel %{_libdir}/libgdbm.so %{_libdir}/libgdbm_compat.so %{_includedir}/* -%{_infodir}/*.info* %files help -%{_mandir}/man1/gdbm* -%{_mandir}/man3/* +%{_mandir}/man?/* %{_infodir}/*.info* %changelog +* Thu Sep 18 2025 Funda Wang - 1:1.26-1 +- update to version 1.26 + * Wed Jul 2 2025 lvyy - 1:1.23-3 - Remove the percent sign in the changelog diff --git a/gdbm_dump-fix-command-line-error-detection.patch b/gdbm_dump-fix-command-line-error-detection.patch deleted file mode 100644 index 274a950a901f9b8dcf6ba0fd788399c5bce3bb97..0000000000000000000000000000000000000000 --- a/gdbm_dump-fix-command-line-error-detection.patch +++ /dev/null @@ -1,72 +0,0 @@ -From c96c160375bd1f3861651311e8645fb6478a1ffd Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Mon, 20 Jun 2022 11:50:46 +0300 -Subject: [PATCH 09/14] gdbm_dump: fix command line error detection - -This fixes https://puszcza.gnu.org.ua/bugs/?567 ---- - tools/gdbm_dump.c | 23 +++++++++++++++++------ - 1 file changed, 17 insertions(+), 6 deletions(-) - -diff --git a/tools/gdbm_dump.c b/tools/gdbm_dump.c -index a480152..2f37eac 100644 ---- a/tools/gdbm_dump.c -+++ b/tools/gdbm_dump.c -@@ -57,19 +57,31 @@ main (int argc, char **argv) - format = GDBM_DUMP_FMT_ASCII; - else - { -- format = atoi (optarg); -- switch (format) -+ char *p; -+ unsigned long n; -+ -+ errno = 0; -+ n = strtoul (optarg, &p, 10); -+ if (errno || *p != 0) -+ { -+ error (_("unknown dump format")); -+ exit (EXIT_USAGE); -+ } -+ -+ switch (n) - { - case GDBM_DUMP_FMT_BINARY: - case GDBM_DUMP_FMT_ASCII: -+ format = n; - break; -+ - default: - error (_("unknown dump format")); - exit (EXIT_USAGE); - } - } - break; -- -+ - default: - error (_("unknown option")); - exit (EXIT_USAGE); -@@ -90,7 +102,7 @@ main (int argc, char **argv) - error (_("too many arguments; try `%s -h' for more info"), progname); - exit (EXIT_USAGE); - } -- -+ - dbname = argv[0]; - if (argc == 2) - filename = argv[1]; -@@ -124,9 +136,8 @@ main (int argc, char **argv) - { - gdbm_perror (_("dump error"), filename); - } -- -+ - gdbm_close (dbf); - - exit (rc == GDBM_NO_ERROR ? EXIT_OK : EXIT_FATAL); - } -- --- -2.33.0 -