Re: Can't specify different names for config file in project data
Alessio Vanni <[email protected]> Tue, 10 Sep 2019 21:41:53 +0200
| Newsgroups | gmane.network.gnunet.bugs |
|---|---|
| Message-ID | <[email protected]> |
--=-=-=
Content-Type: text/plain
Sorry for the late reply. I didn't see there was a reply to the report
(I'm not subscribed to this list... I check the archives from time to
time though.)
> This shouldn't be the case, as GNUnet picks up the (default) service
> contact information from a the share/gnunet/config.d/ directory.
>
> Also, when I change the value, everything still works for me. What is
> the error message you are seeing (if any)?
The problem is in 3rd-party applications. GNUnet itself correctly reads
its config files from the correct directories. However, if the
GNUNET_OS_ProjectData structure holds different values, the application
doesn't work.
The main problem is that it can't connect to GNUnet services, so the
error is that `GNUNET_CLIENT_connect' returns NULL when making a
connection.
For a concrete error message, using `GNUNET_IDENTITY_ego_lookup' (which
makes an implicit connection to the IDENTITY service) when .config_file
and .user_config_file are different from "gnunet.conf" and
"~/.config/gnunet.conf" respectively, it fails with the following
message:
ERROR Assertion failed at identity_api_lookup.c:202.
The line in question is a `GNUNET_break' called when
`GNUNET_CLIENT_connect' returns NULL.
The error does not happen if the configuration file (either one, as long
as it exists) is the same as GNUnet itself.
I attached a minimal program for testing this issue. It simply calls
`GNUNET_IDENTITY_ego_lookup'. If it successfully connects, it will
print wether or not the ego "test-ego" exists; otherwise, it will fail
with the above message.
Thanks,
A.V.
--=-=-=
Content-Type: text/x-csrc
Content-Disposition: attachment; filename=test-config.c
Content-Description: Test for configuration issue
#include <netinet/in.h>
#define SOCKTYPE int
#define FDTYPE int
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_identity_service.h>
static struct GNUNET_OS_ProjectData test_pd = {
.libname = "test",
.project_dirname = "test",
.binary_name = "test-config",
.env_varname = "TEST_PREFIX",
.base_config_varname = "TEST_CONFIG",
.bug_email = "",
.homepage = "",
.config_file = "test.conf",
.user_config_file = "/tmp/test.conf",
.version = "1.0",
.is_gnu = 0,
.gettext_domain = "test",
.gettext_path = NULL,
};
static const struct GNUNET_CONFIGURATION_Handle *cfg = NULL;
static void
ego_lookup(void *cls, const struct GNUNET_IDENTITY_Ego *ego) {
if (ego == NULL) {
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "test-ego does not exist\n");
} else {
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "test-ego exists\n");
}
GNUNET_SCHEDULER_shutdown();
}
static void
run(void *cls, char *const *args, const char *cfgname,
const struct GNUNET_CONFIGURATION_Handle *c) {
GNUNET_log_setup("test-config", "INFO", NULL);
cfg = c;
if (GNUNET_IDENTITY_ego_lookup(cfg, "test-ego", &ego_lookup, NULL) == NULL) {
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Error with ego lookup\n");
GNUNET_SCHEDULER_shutdown();
}
}
int
main(int argc, char *argv[]) {
const struct GNUNET_GETOPT_CommandLineOption opts[] = {
GNUNET_GETOPT_OPTION_END,
};
GNUNET_OS_init(&test_pd);
return (GNUNET_PROGRAM_run(argc, argv, "test-config",
"test", opts, &run, NULL)
!= GNUNET_OK);
}
--=-=-=
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KQnVnLUdOVW5l
dCBtYWlsaW5nIGxpc3QKQnVnLUdOVW5ldEBnbnUub3JnCmh0dHBzOi8vbGlzdHMuZ251Lm9yZy9t
YWlsbWFuL2xpc3RpbmZvL2J1Zy1nbnVuZXQK
--=-=-=--