[PATCH] tst-freopen4: Remove temporary directory from warning message
Sam James
sam@gentoo.org
Tue Aug 5 23:55:15 GMT 2025
"H.J. Lu" <hjl.tools@gmail.com> writes:
> tst-freopen4-main.c issues a warning message:
>
> warning: could not remove temporary file: /tmp/tst-freopen4potgti: No such file or directory
>
> since chroot makes generated temporary directories inaccessible. Add
> special rules for tst-freopen4.out and tst-freopen64-4.out to remove
> the temporary directory in warning message from tst-freopen4 and
> tst-freopen64-4.
>
> This partially fixes BZ #33182.
>
I guess it's fine. I don't really see another way around it yet.
Reviewed-by: Sam James <sam@gentoo.org>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
> stdio-common/Makefile | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/stdio-common/Makefile b/stdio-common/Makefile
> index 64b3575acb..ae2b90c2ad 100644
> --- a/stdio-common/Makefile
> +++ b/stdio-common/Makefile
> @@ -759,6 +759,30 @@ CFLAGS-tst-scanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"
>
> CPPFLAGS += $(libio-mtsafe)
>
> +make-tst-freopen4-out = \
> + $(run-program-prefix-before-env) \
> + $(run-program-env) \
> + MALLOC_TRACE=$(@:.out=.mtrace) \
> + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so \
> + $(run-program-prefix-after-env) $<
> +
> +freopen4-temp-dir-before = warning: could not remove temporary file:
> +freopen4-temp-dir-after = : No such file or directory
> +
> +$(objpfx)tst-freopen4.out: $(objpfx)tst-freopen4
> + $(make-tst-freopen4-out) > $@ && \
> + grep "$(freopen4-temp-dir-before)" $@ \
> + | sed -e "s/$(freopen4-temp-dir-before)//; s/$(freopen4-temp-dir-after)//" \
> + | xargs rm -rf; \
> + $(evaluate-test)
> +
> +$(objpfx)tst-freopen64-4.out: $(objpfx)tst-freopen64-4
> + $(make-tst-freopen4-out) > $@ && \
> + grep "$(freopen4-temp-dir-before)" $@ \
> + | sed -e "s/$(freopen4-temp-dir-before)//; s/$(freopen4-temp-dir-after)//" \
> + | xargs rm -rf; \
> + $(evaluate-test)
> +
> $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
> $(test-program-cmd) > $@ 2>&1; \
> $(evaluate-test)
More information about the Libc-alpha
mailing list