Compare commits
No commits in common. "eac827f0e53317e9b87a08fc97a80098585485cc" and "26b7e23284435e6fdaed9bd7b8bf58c88a149ea9" have entirely different histories.
eac827f0e5
...
26b7e23284
@ -1,44 +0,0 @@
|
|||||||
From 1f10d92214e3f6f23b8d00dccafb5ad57856fbbd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
|
||||||
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
|
|
||||||
|
|
||||||
@ -1,8 +1,7 @@
|
|||||||
From 94d0a6238e9573473d2cfdc74135305b2f6741f2 Mon Sep 17 00:00:00 2001
|
From 94d0a6238e9573473d2cfdc74135305b2f6741f2 Mon Sep 17 00:00:00 2001
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
Date: Thu, 9 Jun 2022 22:44:26 +0300
|
Date: Thu, 9 Jun 2022 22:44:26 +0300
|
||||||
Subject: [PATCH 05/14] Fix binary dump format for key and/or data of zero
|
Subject: [PATCH] Fix binary dump format for key and/or data of zero size.
|
||||||
size.
|
|
||||||
|
|
||||||
Fixes https://puszcza.gnu.org.ua/bugs/?565
|
Fixes https://puszcza.gnu.org.ua/bugs/?565
|
||||||
|
|
||||||
@ -58,5 +57,5 @@ index be98ed7..73c0b74 100644
|
|||||||
ec = GDBM_FILE_READ_ERROR;
|
ec = GDBM_FILE_READ_ERROR;
|
||||||
break;
|
break;
|
||||||
--
|
--
|
||||||
2.33.0
|
2.27.0
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,22 @@
|
|||||||
From c25c66f3194f9c75483e550832d65d6554b22ec8 Mon Sep 17 00:00:00 2001
|
From d3f504875cb94d2e458e1e233e5ab8b40281fe2b Mon Sep 17 00:00:00 2001
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
Date: Mon, 27 Jun 2022 11:49:31 +0300
|
Date: Mon, 27 Jun 2022 11:49:31 +0300
|
||||||
Subject: [PATCH] Fix bug #569
|
Subject: [PATCH] Fix bug#569
|
||||||
|
|
||||||
* tools/gdbmshell.c (input_history_begin): return GDBMSHELL_ERR
|
* src/gdbmshell.c (input_history_begin): return GDBMSHELL_ERR
|
||||||
if history is not available.
|
if history is not available.
|
||||||
|
|
||||||
|
Conflict: tools/gdbmshell.c --> src/gdbmshell.c
|
||||||
|
Reference: https://puszcza.gnu.org.ua/bugs/index.php?569
|
||||||
---
|
---
|
||||||
tools/gdbmshell.c | 2 +-
|
src/gdbmshell.c | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c
|
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
|
||||||
index bccda41..20c6ea9 100644
|
index 4b84c23..12fc2bd 100644
|
||||||
--- a/tools/gdbmshell.c
|
--- a/src/gdbmshell.c
|
||||||
+++ b/tools/gdbmshell.c
|
+++ b/src/gdbmshell.c
|
||||||
@@ -1892,7 +1892,7 @@ input_history_begin (struct command_param *param,
|
@@ -1714,7 +1714,7 @@ input_history_begin (struct command_param *param,
|
||||||
/* TRANSLATORS: %s is the stream name */
|
/* TRANSLATORS: %s is the stream name */
|
||||||
terror (_("input history is not available for %s input stream"),
|
terror (_("input history is not available for %s input stream"),
|
||||||
input_stream_name ());
|
input_stream_name ());
|
||||||
@ -23,5 +26,5 @@ index bccda41..20c6ea9 100644
|
|||||||
|
|
||||||
switch (param->argc)
|
switch (param->argc)
|
||||||
--
|
--
|
||||||
2.33.0
|
1.8.3.1
|
||||||
|
|
||||||
|
|||||||
45
Fix-gdbmtool-import-command.patch
Normal file
45
Fix-gdbmtool-import-command.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
From f3c7872fed5e0782438d186ac88c63035a637462 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
|
Date: Thu, 18 Nov 2021 12:22:59 +0200
|
||||||
|
Subject: Fix gdbmtool import command
|
||||||
|
|
||||||
|
* src/gdbmshell.c (import_handler): Fix option addressing (see
|
||||||
|
https://puszcza.gnu.org.ua/bugs/?535).
|
||||||
|
Fix freeing of the uninitialized variable.
|
||||||
|
---
|
||||||
|
src/gdbmshell.c | 5 ++---
|
||||||
|
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
|
||||||
|
index 08042ce..96b5844 100644
|
||||||
|
--- a/src/gdbmshell.c
|
||||||
|
+++ b/src/gdbmshell.c
|
||||||
|
@@ -661,7 +661,7 @@ err_printer (void *data GDBM_ARG_UNUSED, char const *fmt, ...)
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* recover sumamry verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */
|
||||||
|
+/* recover summary verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */
|
||||||
|
static int
|
||||||
|
recover_handler (struct command_param *param, struct command_environ *cenv)
|
||||||
|
{
|
||||||
|
@@ -1585,7 +1585,7 @@ import_handler (struct command_param *param,
|
||||||
|
int rc = GDBMSHELL_OK;
|
||||||
|
char *file_name;
|
||||||
|
|
||||||
|
- for (i = 0; i < param->argc; i++)
|
||||||
|
+ for (i = 1; i < param->argc; i++)
|
||||||
|
{
|
||||||
|
if (strcmp (PARAM_STRING (param, i), "replace") == 0)
|
||||||
|
flag = GDBM_REPLACE;
|
||||||
|
@@ -1637,7 +1637,6 @@ import_handler (struct command_param *param,
|
||||||
|
return GDBMSHELL_GDBM_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
- free (file_name);
|
||||||
|
if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name)))
|
||||||
|
{
|
||||||
|
dberror ("%s", "GDBM_GETDBNAME");
|
||||||
|
--
|
||||||
|
cgit v1.2.1
|
||||||
|
|
||||||
@ -1,28 +1,28 @@
|
|||||||
From b5801318089f1dd062d039661aed3c701f2943c8 Mon Sep 17 00:00:00 2001
|
From b8271d89db991558e10c26d45d960bbc0257fa31 Mon Sep 17 00:00:00 2001
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
Date: Sat, 18 Jun 2022 17:18:05 +0300
|
Date: Sat, 18 Jun 2022 17:18:05 +0300
|
||||||
Subject: [PATCH] Fix location tracking in gdbmtool. Fix the recover command.
|
Subject: [PATCH] Fix location tracking in gdbmtool. Fix the recover command.
|
||||||
|
|
||||||
In particular, this addresses https://puszcza.gnu.org.ua/bugs/?566
|
In particular, this addresses https://puszcza.gnu.org.ua/bugs/?566
|
||||||
|
|
||||||
* tools/gdbmshell.c: Fix parameter parsing failure
|
* src/gdbmshell.c: Fix parameter parsing failure
|
||||||
(recover_handler): Accept varargs
|
(recover_handler): Accept varargs
|
||||||
(command_tab): Use argdoc to provide help for varargs
|
(command_tab): Use argdoc to provide help for varargs
|
||||||
(help_handler): Handle argdoc
|
(help_handler): Handle argdoc
|
||||||
* tools/gram.y: Accept a single unadorned key=value pair as argument.
|
* src/gram.y: Accept a single unadorned key=value pair as argument.
|
||||||
|
|
||||||
Conflict: Fix only the part that caused the problem
|
Conflict: Fix only the part that caused the problem
|
||||||
Origin Patch: https://git.gnu.org.ua/gdbm.git/commit/?id=b8271d89db991558e10c26d45d960bbc0257fa31
|
Origin Patch: https://git.gnu.org.ua/gdbm.git/commit/?id=b8271d89db991558e10c26d45d960bbc0257fa31
|
||||||
---
|
---
|
||||||
tools/gdbmshell.c | 150 ++++++++++++++++++++++++++++------------------
|
src/gdbmshell.c | 156 +++++++++++++++++++++++++++++++++++---------------------
|
||||||
tools/gram.y | 8 +++
|
src/gram.y | 8 +++
|
||||||
2 files changed, 101 insertions(+), 57 deletions(-)
|
2 files changed, 106 insertions(+), 58 deletions(-)
|
||||||
|
|
||||||
diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c
|
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
|
||||||
index 22c4938..bccda41 100644
|
index 9f0d06c..4b84c23 100644
|
||||||
--- a/tools/gdbmshell.c
|
--- a/src/gdbmshell.c
|
||||||
+++ b/tools/gdbmshell.c
|
+++ b/src/gdbmshell.c
|
||||||
@@ -668,64 +668,95 @@ recover_handler (struct command_param *param, struct command_environ *cenv)
|
@@ -625,64 +625,95 @@ recover_handler (struct command_param *param, struct command_environ *cenv)
|
||||||
gdbm_recovery rcvr;
|
gdbm_recovery rcvr;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int rc;
|
int rc;
|
||||||
@ -165,7 +165,7 @@ index 22c4938..bccda41 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1943,6 +1974,7 @@ struct command
|
@@ -1765,6 +1796,7 @@ struct command
|
||||||
int (*handler) (struct command_param *param, struct command_environ *cenv);
|
int (*handler) (struct command_param *param, struct command_environ *cenv);
|
||||||
void (*end) (void *data);
|
void (*end) (void *data);
|
||||||
struct argdef args[NARGS];
|
struct argdef args[NARGS];
|
||||||
@ -173,7 +173,7 @@ index 22c4938..bccda41 100644
|
|||||||
int variadic;
|
int variadic;
|
||||||
enum command_repeat_type repeat;
|
enum command_repeat_type repeat;
|
||||||
char *doc;
|
char *doc;
|
||||||
@@ -2073,21 +2105,21 @@ static struct command command_tab[] = {
|
@@ -1891,21 +1923,21 @@ static struct command command_tab[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "recover",
|
.name = "recover",
|
||||||
@ -205,22 +205,28 @@ index 22c4938..bccda41 100644
|
|||||||
.repeat = REPEAT_NEVER,
|
.repeat = REPEAT_NEVER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2435,6 +2467,10 @@ help_handler (struct command_param *param GDBM_ARG_UNUSED,
|
@@ -2244,7 +2276,15 @@ 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++)
|
n += fprintf (fp, " %s", gettext (cmd->args[i].name));
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ for (i = 0; i < NARGS && cmd->argdoc[i]; i++)
|
||||||
+ {
|
+ {
|
||||||
+ wordwrap_printf (wf, " %s", gettext (cmd->argdoc[i]));
|
+ if (n >= CMDCOLS)
|
||||||
|
+ {
|
||||||
|
+ fputc ('\n', fp);
|
||||||
|
+ n = fprintf (fp, "%*.*s", optoff, optoff, "");
|
||||||
+ }
|
+ }
|
||||||
|
+ n += fprintf (fp, " %s", gettext (cmd->argdoc[i]));
|
||||||
wordwrap_set_right_margin (wf, 0);
|
+ }
|
||||||
wordwrap_set_left_margin (wf, CMDCOLS);
|
if (n < CMDCOLS)
|
||||||
diff --git a/tools/gram.y b/tools/gram.y
|
fprintf (fp, "%*.s", CMDCOLS-n, "");
|
||||||
index 6b09152..b1360ae 100644
|
else
|
||||||
--- a/tools/gram.y
|
diff --git a/src/gram.y b/src/gram.y
|
||||||
+++ b/tools/gram.y
|
index 561de89..156bb2c 100644
|
||||||
@@ -149,6 +149,13 @@ arg : string
|
--- a/src/gram.y
|
||||||
|
+++ b/src/gram.y
|
||||||
|
@@ -140,6 +140,13 @@ arg : string
|
||||||
{
|
{
|
||||||
$$ = gdbmarg_string ($1, &@1);
|
$$ = gdbmarg_string ($1, &@1);
|
||||||
}
|
}
|
||||||
@ -234,7 +240,7 @@ index 6b09152..b1360ae 100644
|
|||||||
| compound
|
| compound
|
||||||
{
|
{
|
||||||
$$ = gdbmarg_kvpair ($1, &@1);
|
$$ = gdbmarg_kvpair ($1, &@1);
|
||||||
@@ -184,6 +191,7 @@ kvpair : value
|
@@ -175,6 +182,7 @@ kvpair : value
|
||||||
| T_IDENT '=' value
|
| T_IDENT '=' value
|
||||||
{
|
{
|
||||||
$3->key = $1;
|
$3->key = $1;
|
||||||
@ -243,5 +249,5 @@ index 6b09152..b1360ae 100644
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
--
|
--
|
||||||
2.33.0
|
1.8.3.1
|
||||||
|
|
||||||
|
|||||||
@ -1,149 +0,0 @@
|
|||||||
From 0591202918948d41e331094b283ff699ab916c54 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
|
||||||
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 <bug-gdbm@gnu.org>.
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+* 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
|
|
||||||
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
From 4cfdc68fd862a4e80f42f14aa92cb25db08b2466 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
|
||||||
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
|
|
||||||
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
From 3e63a788d4c7b5cb1173937118135c2bcca35a02 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
|
||||||
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
|
|
||||||
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
From 331f05ac9c58d358806fe1bcba88a01467ab0895 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
|
||||||
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 <locale.h>
|
|
||||||
#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
|
|
||||||
|
|
||||||
BIN
gdbm-1.22.tar.gz
Normal file
BIN
gdbm-1.22.tar.gz
Normal file
Binary file not shown.
BIN
gdbm-1.23.tar.gz
BIN
gdbm-1.23.tar.gz
Binary file not shown.
35
gdbm.spec
35
gdbm.spec
@ -1,23 +1,19 @@
|
|||||||
Name: gdbm
|
Name: gdbm
|
||||||
Version: 1.23
|
Version: 1.22
|
||||||
Release: 2
|
Release: 7
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: A library of database functions that work similar to the standard UNIX dbm
|
Summary: A library of database functions that work similar to the standard UNIX dbm
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/gdbm/
|
URL: http://www.gnu.org/software/gdbm/
|
||||||
Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
|
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
|
Patch0: Fix-gdbmtool-import-command.patch
|
||||||
Patch1: gdbm_dump-fix-command-line-error-detection.patch
|
Patch1: Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch
|
||||||
Patch2: Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch
|
Patch2: gdbm_dump-fix-command-line-error-detection.patch
|
||||||
Patch3: Fix-coredump-in-gdbmtool-history-command.patch
|
Patch3: Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch
|
||||||
Patch4: Fix-semantics-of-gdbm_load-r.patch
|
Patch4: Fix-coredump-in-gdbmtool-history-command.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
|
|
||||||
|
|
||||||
BuildRequires: gcc libtool gettext readline-devel bison flex texinfo
|
BuildRequires: gcc libtool gettext readline-devel bison flex
|
||||||
|
|
||||||
Provides: %{name}-libs
|
Provides: %{name}-libs
|
||||||
Provides: %{name}-libs%{?_isa}
|
Provides: %{name}-libs%{?_isa}
|
||||||
@ -107,21 +103,6 @@ fi
|
|||||||
%{_infodir}/*.info*
|
%{_infodir}/*.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Mar 16 2023 wangzhiqiang <wangzhiqiang95@huawei.com> - 1:1.23-2
|
|
||||||
- DESC:backport upstream patch
|
|
||||||
|
|
||||||
* Thu Dec 8 2022 wangzhiqiang <wangzhiqiang95@huawei.com> - 1:1.23-1
|
|
||||||
- DESC: update to version 1.23
|
|
||||||
|
|
||||||
* Tue Aug 30 2022 yangchenguang <yangchenguang@uniontech.com> - 1:1.22-10
|
|
||||||
- DESC: Fix allocated memory not released
|
|
||||||
|
|
||||||
* Tue Jul 5 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-9
|
|
||||||
- DESC: Improve handling of -u in gdbm_load
|
|
||||||
|
|
||||||
* Mon Jul 4 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-8
|
|
||||||
- DESC: Fix semantics of gdbm_load -r
|
|
||||||
|
|
||||||
* Tue Jun 28 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-7
|
* Tue Jun 28 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-7
|
||||||
- DESC: Fix coredump in gdbmtool history command
|
- DESC: Fix coredump in gdbmtool history command
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
From c96c160375bd1f3861651311e8645fb6478a1ffd Mon Sep 17 00:00:00 2001
|
From c96c160375bd1f3861651311e8645fb6478a1ffd Mon Sep 17 00:00:00 2001
|
||||||
From: Sergey Poznyakoff <gray@gnu.org>
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
Date: Mon, 20 Jun 2022 11:50:46 +0300
|
Date: Mon, 20 Jun 2022 11:50:46 +0300
|
||||||
Subject: [PATCH 09/14] gdbm_dump: fix command line error detection
|
Subject: [PATCH] gdbm_dump: fix command line error detection
|
||||||
|
|
||||||
This fixes https://puszcza.gnu.org.ua/bugs/?567
|
This fixes https://puszcza.gnu.org.ua/bugs/?567
|
||||||
---
|
---
|
||||||
tools/gdbm_dump.c | 23 +++++++++++++++++------
|
src/gdbm_dump.c | 23 +++++++++++++++++------
|
||||||
1 file changed, 17 insertions(+), 6 deletions(-)
|
1 file changed, 17 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/tools/gdbm_dump.c b/tools/gdbm_dump.c
|
diff --git a/src/gdbm_dump.c b/src/gdbm_dump.c
|
||||||
index a480152..2f37eac 100644
|
index a480152..2f37eac 100644
|
||||||
--- a/tools/gdbm_dump.c
|
--- a/src/gdbm_dump.c
|
||||||
+++ b/tools/gdbm_dump.c
|
+++ b/src/gdbm_dump.c
|
||||||
@@ -57,19 +57,31 @@ main (int argc, char **argv)
|
@@ -57,19 +57,31 @@ main (int argc, char **argv)
|
||||||
format = GDBM_DUMP_FMT_ASCII;
|
format = GDBM_DUMP_FMT_ASCII;
|
||||||
else
|
else
|
||||||
@ -68,5 +68,5 @@ index a480152..2f37eac 100644
|
|||||||
}
|
}
|
||||||
-
|
-
|
||||||
--
|
--
|
||||||
2.33.0
|
1.8.3.1
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user