Compare commits
10 Commits
ec2d9bfe3a
...
df33a4e740
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df33a4e740 | ||
|
|
a2fe785540 | ||
|
|
d367249de9 | ||
|
|
eadd84b318 | ||
|
|
79f55dee63 | ||
|
|
504553dc7b | ||
|
|
f725284e94 | ||
|
|
128106ebb1 | ||
|
|
cb775b5787 | ||
|
|
80675566c8 |
44
Fix-allocated-memory-not-released.patch
Normal file
44
Fix-allocated-memory-not-released.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From c3dc7294670c91af89e0122c6979de70c63ce4f7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
|
Date: Sat, 18 Jun 2022 17:35:35 +0300
|
||||||
|
Subject: Fix https://puszcza.gnu.org.ua/bugs/index.php?563
|
||||||
|
|
||||||
|
---
|
||||||
|
src/gdbmshell.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
|
||||||
|
index 12fc2bd..4ab2660 100644
|
||||||
|
--- a/src/gdbmshell.c
|
||||||
|
+++ b/src/gdbmshell.c
|
||||||
|
@@ -1232,6 +1232,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))
|
||||||
|
{
|
||||||
|
@@ -1243,13 +1244,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.36.1
|
||||||
|
|
||||||
30
Fix-coredump-in-gdbmtool-history-command.patch
Normal file
30
Fix-coredump-in-gdbmtool-history-command.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From d3f504875cb94d2e458e1e233e5ab8b40281fe2b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
|
Date: Mon, 27 Jun 2022 11:49:31 +0300
|
||||||
|
Subject: [PATCH] Fix bug#569
|
||||||
|
|
||||||
|
* src/gdbmshell.c (input_history_begin): return GDBMSHELL_ERR
|
||||||
|
if history is not available.
|
||||||
|
|
||||||
|
Conflict: tools/gdbmshell.c --> src/gdbmshell.c
|
||||||
|
Reference: https://puszcza.gnu.org.ua/bugs/index.php?569
|
||||||
|
---
|
||||||
|
src/gdbmshell.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
|
||||||
|
index 4b84c23..12fc2bd 100644
|
||||||
|
--- a/src/gdbmshell.c
|
||||||
|
+++ b/src/gdbmshell.c
|
||||||
|
@@ -1714,7 +1714,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)
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
122
Fix-semantics-of-gdbm_load-r.patch
Normal file
122
Fix-semantics-of-gdbm_load-r.patch
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
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] Fix semantics of gdbm_load -r
|
||||||
|
|
||||||
|
Fixes https://puszcza.gnu.org.ua/bugs/index.php?573
|
||||||
|
|
||||||
|
* src/gdbm_load.c: New option: --update (-U)
|
||||||
|
The --replace (-r) option is valid only if used together with
|
||||||
|
--update.
|
||||||
|
* doc/gdbm.texi: Document changes.
|
||||||
|
---
|
||||||
|
doc/gdbm.texi | 25 ++++++++++++++++++++++---
|
||||||
|
src/gdbm_load.c | 20 ++++++++++++++++++--
|
||||||
|
2 files changed, 40 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/gdbm.texi b/doc/gdbm.texi
|
||||||
|
index a738c85..d39144f 100644
|
||||||
|
--- a/doc/gdbm.texi
|
||||||
|
+++ b/doc/gdbm.texi
|
||||||
|
@@ -3210,6 +3210,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
|
||||||
|
@@ -4029,9 +4031,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
|
||||||
|
|
||||||
|
@@ -4057,7 +4067,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/src/gdbm_load.c b/src/gdbm_load.c
|
||||||
|
index 41cb820..b2809e1 100644
|
||||||
|
--- a/src/gdbm_load.c
|
||||||
|
+++ b/src/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"), progname);
|
||||||
|
+ 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;
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
78
Improve-handling-of-u-in-gdbm_load.patch
Normal file
78
Improve-handling-of-u-in-gdbm_load.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
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] Improve handling of -u in gdbm_load
|
||||||
|
|
||||||
|
* src/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 ++++++++-----
|
||||||
|
src/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/src/gdbm_load.c b/src/gdbm_load.c
|
||||||
|
index 5d5e50e..e7e2ab1 100644
|
||||||
|
--- a/src/gdbm_load.c
|
||||||
|
+++ b/src/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;
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
60
Minor-fix-in-the-compatibility-library.patch
Normal file
60
Minor-fix-in-the-compatibility-library.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
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
|
||||||
|
|
||||||
24
gdbm.spec
24
gdbm.spec
@ -1,6 +1,6 @@
|
|||||||
Name: gdbm
|
Name: gdbm
|
||||||
Version: 1.22
|
Version: 1.22
|
||||||
Release: 6
|
Release: 11
|
||||||
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+
|
||||||
@ -11,8 +11,13 @@ Patch0: Fix-gdbmtool-import-command.patch
|
|||||||
Patch1: Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch
|
Patch1: Fix-binary-dump-format-for-key-and-or-data-of-zero-s.patch
|
||||||
Patch2: gdbm_dump-fix-command-line-error-detection.patch
|
Patch2: gdbm_dump-fix-command-line-error-detection.patch
|
||||||
Patch3: Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch
|
Patch3: Fix-location-tracking-in-gdbmtool.-Fix-the-recover-c.patch
|
||||||
|
Patch4: Fix-coredump-in-gdbmtool-history-command.patch
|
||||||
|
Patch5: Fix-semantics-of-gdbm_load-r.patch
|
||||||
|
Patch6: Improve-handling-of-u-in-gdbm_load.patch
|
||||||
|
Patch7: Fix-allocated-memory-not-released.patch
|
||||||
|
Patch8: Minor-fix-in-the-compatibility-library.patch
|
||||||
|
|
||||||
BuildRequires: gcc libtool gettext readline-devel bison flex
|
BuildRequires: gcc libtool gettext readline-devel bison flex texinfo
|
||||||
|
|
||||||
Provides: %{name}-libs
|
Provides: %{name}-libs
|
||||||
Provides: %{name}-libs%{?_isa}
|
Provides: %{name}-libs%{?_isa}
|
||||||
@ -102,6 +107,21 @@ fi
|
|||||||
%{_infodir}/*.info*
|
%{_infodir}/*.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 17 2023 wangzhiqiang <wangzhiqiang95@huawei.com> - 1:1.22-11
|
||||||
|
- DESC: Minor fix in the compatibility library
|
||||||
|
|
||||||
|
* 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
|
||||||
|
- DESC: Fix coredump in gdbmtool history command
|
||||||
|
|
||||||
* Thu Jun 23 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-6
|
* Thu Jun 23 2022 wangzhqiang <wangzhiqiang95@huawei.com> - 1:1.22-6
|
||||||
- DESC: fix location tracking in gdbmtool, fix the recover command
|
- DESC: fix location tracking in gdbmtool, fix the recover command
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user