* [PATCH 0/3] Fix tst-ldconfig-ld_so_conf-update and tst-glibc-hwcaps-prepend-cache with custom configure prefix value
@ 2023-03-26 20:00 Romain Geissler
2023-03-26 20:00 ` [PATCH 1/3] support: introduce support_sysconfdir_prefix Romain Geissler
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Romain Geissler @ 2023-03-26 20:00 UTC (permalink / raw)
To: libc-alpha; +Cc: romain.geissler
Hi,
This small patchset fixes two tests tst-ldconfig-ld_so_conf-update and
tst-glibc-hwcaps-prepend-cache which are failing when using a
non-default --prefix at configuration time, as the tests hardcode
the path /etc/ld.so.conf. Change it to use ${sysconfdir} instead of
/etc.
Cheers,
Romain
Romain Geissler (3):
support: introduce support_sysconfdir_prefix
Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value
Fix tst-glibc-hwcaps-prepend-cache with custom configure prefix value
elf/tst-glibc-hwcaps-prepend-cache.c | 10 +++++++---
elf/tst-ldconfig-ld_so_conf-update.c | 13 ++++++++-----
support/Makefile | 3 ++-
support/support.h | 2 ++
support/support_paths.c | 7 +++++++
5 files changed, 26 insertions(+), 9 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] support: introduce support_sysconfdir_prefix
2023-03-26 20:00 [PATCH 0/3] Fix tst-ldconfig-ld_so_conf-update and tst-glibc-hwcaps-prepend-cache with custom configure prefix value Romain Geissler
@ 2023-03-26 20:00 ` Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
2023-03-26 20:00 ` [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value Romain Geissler
2023-03-26 20:00 ` [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache " Romain Geissler
2 siblings, 1 reply; 7+ messages in thread
From: Romain Geissler @ 2023-03-26 20:00 UTC (permalink / raw)
To: libc-alpha; +Cc: romain.geissler
---
support/Makefile | 3 ++-
support/support.h | 2 ++
support/support_paths.c | 7 +++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/support/Makefile b/support/Makefile
index 05b31159ea5..71d51485132 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -231,7 +231,8 @@ CFLAGS-support_paths.c = \
-DSBINDIR_PATH=\"$(sbindir)\" \
-DSLIBDIR_PATH=\"$(slibdir)\" \
-DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
- -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
+ -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" \
+ -DSYSCONFDIR_PATH=\"$(sysconfdir)\"
# In support_timespec_check_in_range we may be passed a very tight
# range for which we should produce a correct result for expected
diff --git a/support/support.h b/support/support.h
index 525ff1ebcec..b7f76bf0809 100644
--- a/support/support.h
+++ b/support/support.h
@@ -144,6 +144,8 @@ extern const char support_slibdir_prefix[];
extern const char support_install_rootsbindir[];
/* Corresponds to the install's compiled locale directory. */
extern const char support_complocaledir_prefix[];
+/* Corresponds to the install's etc/ directory. */
+extern const char support_sysconfdir_prefix[];
/* Copies the file at the path FROM to TO. If TO does not exist, it
is created. If TO is a regular file, it is truncated before
diff --git a/support/support_paths.c b/support/support_paths.c
index f9d75998cf2..0710bcd4122 100644
--- a/support/support_paths.c
+++ b/support/support_paths.c
@@ -92,3 +92,10 @@ const char support_complocaledir_prefix[] = COMPLOCALEDIR_PATH;
#else
# error please -DCOMPLOCALEDIR_PATH=something in the Makefile
#endif
+
+#ifdef SYSCONFDIR_PATH
+/* Corresponds to the install's etc/ directory. */
+const char support_sysconfdir_prefix[] = SYSCONFDIR_PATH;
+#else
+# error please -DSYSCONFDIR_PATH=something in the Makefile
+#endif
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value
2023-03-26 20:00 [PATCH 0/3] Fix tst-ldconfig-ld_so_conf-update and tst-glibc-hwcaps-prepend-cache with custom configure prefix value Romain Geissler
2023-03-26 20:00 ` [PATCH 1/3] support: introduce support_sysconfdir_prefix Romain Geissler
@ 2023-03-26 20:00 ` Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
2023-03-26 20:00 ` [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache " Romain Geissler
2 siblings, 1 reply; 7+ messages in thread
From: Romain Geissler @ 2023-03-26 20:00 UTC (permalink / raw)
To: libc-alpha; +Cc: romain.geissler
---
elf/tst-ldconfig-ld_so_conf-update.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/elf/tst-ldconfig-ld_so_conf-update.c b/elf/tst-ldconfig-ld_so_conf-update.c
index 503afb3211e..2c5c48615d8 100644
--- a/elf/tst-ldconfig-ld_so_conf-update.c
+++ b/elf/tst-ldconfig-ld_so_conf-update.c
@@ -33,7 +33,6 @@
#define DSO "libldconfig-ld-mod.so"
#define DSO_DIR "/tmp/tst-ldconfig"
-#define CONF "/etc/ld.so.conf"
static void
@@ -64,6 +63,8 @@ do_test (void)
{
struct support_capture_subprocess result;
+ char *conf_path = xasprintf ("%s/ld.so.conf", support_sysconfdir_prefix);
+
/* Create the needed directories. */
xmkdirp ("/var/cache/ldconfig", 0777);
xmkdirp (DSO_DIR, 0777);
@@ -82,9 +83,9 @@ do_test (void)
is not searched. */
TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL);
- FILE *fp = xfopen (CONF, "a+");
+ FILE *fp = xfopen (conf_path, "a+");
if (!fp)
- FAIL_EXIT1 ("creating /etc/ld.so.conf failed: %m");
+ FAIL_EXIT1 ("creating %s failed: %m", conf_path);
xfclose (fp);
/* Run ldconfig. */
@@ -95,9 +96,9 @@ do_test (void)
TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL);
/* Add tst-ldconfig directory to /etc/ld.so.conf. */
- fp = xfopen (CONF, "w");
+ fp = xfopen (conf_path, "w");
if (!(fwrite (DSO_DIR, 1, sizeof (DSO_DIR), fp)))
- FAIL_EXIT1 ("updating /etc/ld.so.conf failed: %m");
+ FAIL_EXIT1 ("updating %s failed: %m", conf_path);
xfclose (fp);
/* Try to dlopen the same DSO again, we expect this to still fail. */
@@ -111,6 +112,8 @@ do_test (void)
/* Finally, we expect dlopen to pass now. */
TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) != NULL);
+ free (conf_path);
+
return 0;
}
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache with custom configure prefix value
2023-03-26 20:00 [PATCH 0/3] Fix tst-ldconfig-ld_so_conf-update and tst-glibc-hwcaps-prepend-cache with custom configure prefix value Romain Geissler
2023-03-26 20:00 ` [PATCH 1/3] support: introduce support_sysconfdir_prefix Romain Geissler
2023-03-26 20:00 ` [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value Romain Geissler
@ 2023-03-26 20:00 ` Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
2 siblings, 1 reply; 7+ messages in thread
From: Romain Geissler @ 2023-03-26 20:00 UTC (permalink / raw)
To: libc-alpha; +Cc: romain.geissler
---
elf/tst-glibc-hwcaps-prepend-cache.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/elf/tst-glibc-hwcaps-prepend-cache.c b/elf/tst-glibc-hwcaps-prepend-cache.c
index 2a448423495..fe074b28028 100644
--- a/elf/tst-glibc-hwcaps-prepend-cache.c
+++ b/elf/tst-glibc-hwcaps-prepend-cache.c
@@ -44,9 +44,13 @@ do_test (void)
if (dlopen (SONAME, RTLD_NOW) != NULL)
FAIL_EXIT1 (SONAME " is already on the search path");
- /* Install the default implementation of libmarkermod1.so. */
- xmkdirp ("/etc", 0777);
- support_write_file_string ("/etc/ld.so.conf", "/glibc-test/lib\n");
+ {
+ /* Install the default implementation of libmarkermod1.so. */
+ char *conf_path = xasprintf ("%s/ld.so.conf", support_sysconfdir_prefix);
+ xmkdirp (support_sysconfdir_prefix, 0777);
+ support_write_file_string (conf_path, "/glibc-test/lib\n");
+ free (conf_path);
+ }
xmkdirp ("/glibc-test/lib/glibc-hwcaps/prepend2", 0777);
xmkdirp ("/glibc-test/lib/glibc-hwcaps/prepend3", 0777);
{
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] support: introduce support_sysconfdir_prefix
2023-03-26 20:00 ` [PATCH 1/3] support: introduce support_sysconfdir_prefix Romain Geissler
@ 2023-03-27 17:24 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-27 17:24 UTC (permalink / raw)
To: Romain Geissler, libc-alpha; +Cc: romain.geissler
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
On 26/03/23 17:00, Romain Geissler via Libc-alpha wrote:
> ---
> support/Makefile | 3 ++-
> support/support.h | 2 ++
> support/support_paths.c | 7 +++++++
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/support/Makefile b/support/Makefile
> index 05b31159ea5..71d51485132 100644
> --- a/support/Makefile
> +++ b/support/Makefile
> @@ -231,7 +231,8 @@ CFLAGS-support_paths.c = \
> -DSBINDIR_PATH=\"$(sbindir)\" \
> -DSLIBDIR_PATH=\"$(slibdir)\" \
> -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
> - -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
> + -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" \
> + -DSYSCONFDIR_PATH=\"$(sysconfdir)\"
>
> # In support_timespec_check_in_range we may be passed a very tight
> # range for which we should produce a correct result for expected
> diff --git a/support/support.h b/support/support.h
> index 525ff1ebcec..b7f76bf0809 100644
> --- a/support/support.h
> +++ b/support/support.h
> @@ -144,6 +144,8 @@ extern const char support_slibdir_prefix[];
> extern const char support_install_rootsbindir[];
> /* Corresponds to the install's compiled locale directory. */
> extern const char support_complocaledir_prefix[];
> +/* Corresponds to the install's etc/ directory. */
> +extern const char support_sysconfdir_prefix[];
>
> /* Copies the file at the path FROM to TO. If TO does not exist, it
> is created. If TO is a regular file, it is truncated before
> diff --git a/support/support_paths.c b/support/support_paths.c
> index f9d75998cf2..0710bcd4122 100644
> --- a/support/support_paths.c
> +++ b/support/support_paths.c
> @@ -92,3 +92,10 @@ const char support_complocaledir_prefix[] = COMPLOCALEDIR_PATH;
> #else
> # error please -DCOMPLOCALEDIR_PATH=something in the Makefile
> #endif
> +
> +#ifdef SYSCONFDIR_PATH
> +/* Corresponds to the install's etc/ directory. */
> +const char support_sysconfdir_prefix[] = SYSCONFDIR_PATH;
> +#else
> +# error please -DSYSCONFDIR_PATH=something in the Makefile
> +#endif
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache with custom configure prefix value
2023-03-26 20:00 ` [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache " Romain Geissler
@ 2023-03-27 17:24 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-27 17:24 UTC (permalink / raw)
To: libc-alpha
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
On 26/03/23 17:00, Romain Geissler via Libc-alpha wrote:
> ---
> elf/tst-glibc-hwcaps-prepend-cache.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/elf/tst-glibc-hwcaps-prepend-cache.c b/elf/tst-glibc-hwcaps-prepend-cache.c
> index 2a448423495..fe074b28028 100644
> --- a/elf/tst-glibc-hwcaps-prepend-cache.c
> +++ b/elf/tst-glibc-hwcaps-prepend-cache.c
> @@ -44,9 +44,13 @@ do_test (void)
> if (dlopen (SONAME, RTLD_NOW) != NULL)
> FAIL_EXIT1 (SONAME " is already on the search path");
>
> - /* Install the default implementation of libmarkermod1.so. */
> - xmkdirp ("/etc", 0777);
> - support_write_file_string ("/etc/ld.so.conf", "/glibc-test/lib\n");
> + {
> + /* Install the default implementation of libmarkermod1.so. */
> + char *conf_path = xasprintf ("%s/ld.so.conf", support_sysconfdir_prefix);
> + xmkdirp (support_sysconfdir_prefix, 0777);
> + support_write_file_string (conf_path, "/glibc-test/lib\n");
> + free (conf_path);
> + }
> xmkdirp ("/glibc-test/lib/glibc-hwcaps/prepend2", 0777);
> xmkdirp ("/glibc-test/lib/glibc-hwcaps/prepend3", 0777);
> {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value
2023-03-26 20:00 ` [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value Romain Geissler
@ 2023-03-27 17:24 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-27 17:24 UTC (permalink / raw)
To: libc-alpha
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
On 26/03/23 17:00, Romain Geissler via Libc-alpha wrote:
> ---
> elf/tst-ldconfig-ld_so_conf-update.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/elf/tst-ldconfig-ld_so_conf-update.c b/elf/tst-ldconfig-ld_so_conf-update.c
> index 503afb3211e..2c5c48615d8 100644
> --- a/elf/tst-ldconfig-ld_so_conf-update.c
> +++ b/elf/tst-ldconfig-ld_so_conf-update.c
> @@ -33,7 +33,6 @@
>
> #define DSO "libldconfig-ld-mod.so"
> #define DSO_DIR "/tmp/tst-ldconfig"
> -#define CONF "/etc/ld.so.conf"
>
>
> static void
> @@ -64,6 +63,8 @@ do_test (void)
> {
> struct support_capture_subprocess result;
>
> + char *conf_path = xasprintf ("%s/ld.so.conf", support_sysconfdir_prefix);
> +
> /* Create the needed directories. */
> xmkdirp ("/var/cache/ldconfig", 0777);
> xmkdirp (DSO_DIR, 0777);
> @@ -82,9 +83,9 @@ do_test (void)
> is not searched. */
> TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL);
>
> - FILE *fp = xfopen (CONF, "a+");
> + FILE *fp = xfopen (conf_path, "a+");
> if (!fp)
> - FAIL_EXIT1 ("creating /etc/ld.so.conf failed: %m");
> + FAIL_EXIT1 ("creating %s failed: %m", conf_path);
> xfclose (fp);
>
> /* Run ldconfig. */
> @@ -95,9 +96,9 @@ do_test (void)
> TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL);
>
> /* Add tst-ldconfig directory to /etc/ld.so.conf. */
> - fp = xfopen (CONF, "w");
> + fp = xfopen (conf_path, "w");
> if (!(fwrite (DSO_DIR, 1, sizeof (DSO_DIR), fp)))
> - FAIL_EXIT1 ("updating /etc/ld.so.conf failed: %m");
> + FAIL_EXIT1 ("updating %s failed: %m", conf_path);
> xfclose (fp);
>
> /* Try to dlopen the same DSO again, we expect this to still fail. */
> @@ -111,6 +112,8 @@ do_test (void)
> /* Finally, we expect dlopen to pass now. */
> TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) != NULL);
>
> + free (conf_path);
> +
> return 0;
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-03-27 17:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 20:00 [PATCH 0/3] Fix tst-ldconfig-ld_so_conf-update and tst-glibc-hwcaps-prepend-cache with custom configure prefix value Romain Geissler
2023-03-26 20:00 ` [PATCH 1/3] support: introduce support_sysconfdir_prefix Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
2023-03-26 20:00 ` [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
2023-03-26 20:00 ` [PATCH 3/3] Fix tst-glibc-hwcaps-prepend-cache " Romain Geissler
2023-03-27 17:24 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).