[pulseaudio-discuss] [PATCH 1/2] daemon: Fix dlsearchpath while running from build tree
Tanu Kaskinen
tanu.kaskinen at intel.com
Mon Apr 22 05:45:10 PDT 2013
On Mon, 2013-04-22 at 12:41 +0300, Tanu Kaskinen wrote:
> On Sat, 2013-04-20 at 10:14 +0530, Arun Raghavan wrote:
> > It appears that, libltdl will find the .la file in the builddir and
> > figure out where the real .so is.
> >
> > This also requires .ifexists to be fixed up to correspondingly search in
> > <dlsearchpath>/.libs.
> > ---
> > src/daemon/daemon-conf.c | 2 +-
> > src/pulsecore/cli-command.c | 12 +++++++++++-
> > 2 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
> > index 2c43cf9..f1e5476 100644
> > --- a/src/daemon/daemon-conf.c
> > +++ b/src/daemon/daemon-conf.c
> > @@ -156,7 +156,7 @@ pa_daemon_conf *pa_daemon_conf_new(void) {
> > #else
> > if (pa_run_from_build_tree()) {
> > pa_log_notice("Detected that we are run from the build tree, fixing search path.");
> > - c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/");
> > + c->dl_search_path = pa_xstrdup(PA_BUILDDIR);
> > } else
> > c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
> > #endif
> > diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
> > index 1ec8054..f5489d6 100644
> > --- a/src/pulsecore/cli-command.c
> > +++ b/src/pulsecore/cli-command.c
> > @@ -2062,11 +2062,21 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
> > char *pathname;
> >
> > pathname = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", p, filename);
> > - pa_xfree(p);
> >
> > *ifstate = access(pathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
> > pa_log_debug("Checking for existence of '%s': %s", pathname, *ifstate == IFSTATE_TRUE ? "success" : "failure");
> >
> > + if (PA_UNLIKELY(pa_run_from_build_tree())) {
> > + /* If run from the build tree, search in <path>/.libs as well */
> > + char *ltpathname = pa_sprintf_malloc("%s" PA_PATH_SEP ".libs" PA_PATH_SEP "%s", p, filename);
> > +
> > + *ifstate = access(ltpathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
> > + pa_log_debug("Checking for existence of '%s': %s", ltpathname, *ifstate == IFSTATE_TRUE ? "success" : "failure");
> > +
> > + pa_xfree(ltpathname);
> > + }
>
> Why do we search in two places if we're running from build tree?
Answering myself: if the --dl-search-path command line option is being
used, appending .libs doesn't necessarily work. This code would need to
know whether --dl-search-path was given or not in order to avoid trying
two locations.
Arun, you have my ack for this patch. Peter's concern about relying on
libtool implementation details is valid, but I think it's acceptable in
this case, because it's not a disaster if this code suddenly stops
working some day.
--
Tanu
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the pulseaudio-discuss
mailing list