This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [BZ 24544] Use support_install_prefix in elf/tst-pldd.c
On 13/05/2019 12:43, Carlos O'Donell wrote:
> On 5/10/19 8:29 AM, Adhemerval Zanella wrote:
>>> - const char prog[] = "/usr/bin/pldd";
>>> + char prog[PATH_MAX] = "";
>>> + strcpy(prog, support_install_prefix);
>>> + strcat(prog, "/bin/pldd");
>>
>> Use snprintf instead (there is no need to actually initialize
>> prog as well):
>>
>> snprintf (prog, sizeof prog, "%s/bin/pldd", support_install_prefix)
>>
>> LGTM with the change.
>
> This won't work.
>
> Users can configure --prefix, and --bindir, so you have to abstract
> this up a level:
In fact this does not work because we don't have a bindir definition
on config.make.in, so --bindir does not actually change anything. The
default value set by Makeconfig:206 is used regardless.
>
> * support/Makefile (CFLAGS-support_paths.c): Define -DBINDIR_PATH=\"$(bindir)\"
> * support/support_paths.h (support_install_bindir): Define as BINDIR_PATH
> * Use support_install_bindir to set pldd's path.
> snprintf (prog, sizeof prog, "%s/pldd", support_install_bindir)
In fact I think we should first fix the bindir set by configure, add
the bindir on libsupport and then fix tst-pldd with asprintf. I am
working on this.
>
> We'll eventually need one of each kind of variable for all the places
> binaries are installed because we want to test each of them in a
> container under test conditions.
>