From: Patrick Steinhardt <ps@pks.im>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH v2 1/6] tests: remove reliance on buffer behaviour of stderr/stdout streams
Date: Tue, 27 Aug 2019 13:55:12 +0200 [thread overview]
Message-ID: <20190827115512.GB131601@ncase> (raw)
In-Reply-To: <20190827111748.g4o375ya2shfrivs@10.255.255.10>
[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]
On Tue, Aug 27, 2019 at 01:17:48PM +0200, Karel Zak wrote:
> On Fri, Aug 23, 2019 at 03:32:53PM +0200, Patrick Steinhardt wrote:
> > + if [ "$TS_ENABLE_ASAN" == "yes" ]; then
> > + args+=(ASAN_OPTIONS='detect_leaks=1')
> > + fi
> > +
> > #
> > - # ASAN mode
> > + # Disable buffering of stdout
> > #
> > - elif [ "$TS_ENABLE_ASAN" == "yes" ]; then
> > - ASAN_OPTIONS='detect_leaks=1' "$@"
> > + if [ -n "$UNBUFFERED" ]; then
> > + if type stdbuf >/dev/null 2>&1; then
> > + args+=(stdbuf --output=0)
> > + fi
> > + fi
> >
> > #
> > - # Default mode
> > + # valgrind mode
> > #
> > - else
> > - "$@"
> > + if [ -n "$TS_VALGRIND_CMD" ]; then
> > + args+=(libtool --mode=execute "$TS_VALGRIND_CMD" --tool=memcheck --leak-check=full)
> > + args+=(--leak-resolution=high --num-callers=20 --log-file="$TS_VGDUMP")
> > fi
> > +
> > + "${args[@]}" "$@"
> > }
>
> Unfortunately, it seems "${args[@]}" does not work when environment
> variable used:
>
> ASAN_OPTIONS=detect_leaks=1 stdbuf --output=0 /home/projects/util-linux/util-linux/mkswap --label 1234567890abcdef --uuid 12345678-abcd-abcd-abcd-1234567890ab /dev/sdc
>
> ends with
>
> ./tests/ts/misc/../../functions.sh: line 465: ASAN_OPTIONS=detect_leaks=1: command not found
>
>
> And it's more tricky, it seems ASAN binary cannot be executed by stdbuf
>
> # stdbuf --output=0 /home/projects/util-linux/util-linux/mkswap --label 1234567890abcdef --uuid 12345678-abcd-abcd-abcd-1234567890ab /dev/sdc
> ==28469==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
>
> it's because stdbuf is hack based on LD_PRELOAD which makes it
> difficult to use with ASAN...
>
> I have tried to fix it by
> https://github.com/karelzak/util-linux/commit/f612c4c674e8e07fc40644432d8147a05c62058e
Noticed one more thing. In the parameter parsing step, we check
`type stdbuf` while we actually use unbuffer later. I guess the
first check should now be `type unbuffer`, right?
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-08-27 11:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 10:16 [PATCH 0/6] Test suite fixes for musl libc Patrick Steinhardt
2019-08-23 10:16 ` [PATCH 1/6] tests: remove reliance on buffer behaviour of stderr/stdout streams Patrick Steinhardt
2019-08-23 10:16 ` [PATCH 2/6] tests: colcrt: fix reliance on EILSEQ in POSIX locale Patrick Steinhardt
2019-08-23 10:17 ` [PATCH 3/6] tests: column: use actually invalid multibytes to test encoding Patrick Steinhardt
2019-08-23 10:17 ` [PATCH 4/6] tests: col: avoid hardcoding of errno string Patrick Steinhardt
2019-08-23 10:17 ` [PATCH 5/6] tests: fdisk: " Patrick Steinhardt
2019-08-23 10:17 ` [PATCH 6/6] tests: libfdisk: remove reliance on buffer behaviour of standard streams Patrick Steinhardt
2019-08-23 12:15 ` Karel Zak
2019-08-23 13:32 ` [PATCH v2 0/6] Test suite fixes for musl libc Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 1/6] tests: remove reliance on buffer behaviour of stderr/stdout streams Patrick Steinhardt
2019-08-27 11:17 ` Karel Zak
2019-08-27 11:49 ` Patrick Steinhardt
2019-08-27 12:32 ` Karel Zak
2019-08-27 11:55 ` Patrick Steinhardt [this message]
2019-08-27 12:31 ` Karel Zak
2019-08-27 12:26 ` [PATCH] tests: use env and support both unbuffer/stdbuf Patrick Steinhardt
2019-08-27 12:46 ` Karel Zak
2019-08-28 10:51 ` Karel Zak
2019-08-30 19:08 ` Karel Zak
2019-08-31 7:41 ` Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 2/6] tests: libfdisk: remove reliance on buffer behaviour of standard streams Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 3/6] tests: colcrt: fix reliance on EILSEQ in POSIX locale Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 4/6] tests: column: use actually invalid multibytes to test encoding Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 5/6] tests: col: avoid hardcoding of errno string Patrick Steinhardt
2019-08-23 13:32 ` [PATCH v2 6/6] tests: fdisk: " Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190827115512.GB131601@ncase \
--to=ps@pks.im \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).