From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael Roth" <michael.roth@amd.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Mads Ynddal" <mads@ynddal.dk>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
oleg.tolmatcev@gmail.com
Subject: Re: [PATCH v3 5/8] tracetool: support "-" as a shorthand for stdout
Date: Tue, 19 Aug 2025 16:58:45 +0100 [thread overview]
Message-ID: <aKSfNansKsbP2-Lz@redhat.com> (raw)
In-Reply-To: <20250818175548.GA16685@fedora>
On Mon, Aug 18, 2025 at 01:55:48PM -0400, Stefan Hajnoczi wrote:
> On Mon, Aug 18, 2025 at 04:07:28PM +0100, Daniel P. Berrangé wrote:
> > On Thu, Aug 07, 2025 at 03:46:08PM -0400, Stefan Hajnoczi wrote:
> > > On Wed, Aug 06, 2025 at 05:48:29PM +0100, Daniel P. Berrangé wrote:
> > > > This avoids callers needing to use the UNIX-only /dev/stdout
> > > > workaround.
> > > >
> > > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > > ---
> > > > scripts/tracetool/__init__.py | 8 ++++++--
> > > > 1 file changed, 6 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> > > > index 0f33758870..c8fd3a7ddc 100644
> > > > --- a/scripts/tracetool/__init__.py
> > > > +++ b/scripts/tracetool/__init__.py
> > > > @@ -38,8 +38,12 @@ def error(*lines):
> > > >
> > > > def out_open(filename):
> > > > global out_filename, out_fobj
> > > > - out_filename = posix_relpath(filename)
> > > > - out_fobj = open(filename, 'wt')
> > > > + if filename == "-":
> > > > + out_filename = "[stdout]"
> > >
> > > A few lines above:
> > >
> > > out_filename = '<none>'
> > > out_fobj = sys.stdout
> > >
> > > Stick to '<none>' here for consistency?
> >
> > Curious - that suggests that it was intended to be able to write to
> > stdout by default, but tracetool.py unconditionally calls out_open()
> > so those default assignments are effectively dead code, unless this
> > internal code is called by something other than the tracetool.py main
> > entrypoint ?
> >
> > I guess I'd be inclined to change the global initialization to just
> > be 'None' to make it explicit that out_open is expected to always be
> > called ?
>
> Originally the script wrote to stdout, but I added an explicit output
> filename argument in commit c05012a365c2 ("tracetool: add output
> filename command-line argument") because #line directives emitted by
> tracetool need to know the output filename.
>
> Your next patch tests/tracetool/tracetool-test.py uses "-" as the
> output filename but leaves the existing meson.build files unchanged.
> They will still specify an output filename.
>
> This commit doesn't break anything, at least not in how this patch
> series uses "-", but I see a contradiction with commit c05012a365c2
> since we're now allowing the output filename to be effectively empty.
>
> Could you avoid special casing stdout and instead pass a relative path
> to the output file? The relative path is important so the test reference
> output is portable across machines. Then you don't need this commit.
If I copy the 'trace-events' file into the build-dir, then I can rely
on relative files for both the input & output, and avoid need to
support '-'.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-08-19 16:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 16:48 [PATCH v3 0/8] tracetool: add test suite to improve reviewability Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 1/8] checkpatch: cull trailing '*/' in SPDX check Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 2/8] tracetool: eliminate trailing whitespace in C format Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 3/8] tracetool: avoid space after "*" in arg types Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 4/8] tracetool: include SPDX-License-Identifier in generated files Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 5/8] tracetool: support "-" as a shorthand for stdout Daniel P. Berrangé
2025-08-07 19:46 ` Stefan Hajnoczi
2025-08-18 15:07 ` Daniel P. Berrangé
2025-08-18 17:55 ` Stefan Hajnoczi
2025-08-19 15:58 ` Daniel P. Berrangé [this message]
2025-08-06 16:48 ` [PATCH v3 6/8] tracetool: add test suite for tracetool with reference output Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 7/8] tracetool: drop the probe "__nocheck__" wrapping Daniel P. Berrangé
2025-08-06 16:48 ` [PATCH v3 8/8] qapi: switch to use QEMU_TEST_REGENERATE env var Daniel P. Berrangé
2025-08-08 6:46 ` Markus Armbruster
2025-08-18 15:09 ` Daniel P. Berrangé
2025-08-25 12:01 ` Markus Armbruster
2025-08-27 14:11 ` Daniel P. Berrangé
2025-08-07 20:06 ` [PATCH v3 0/8] tracetool: add test suite to improve reviewability Stefan Hajnoczi
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=aKSfNansKsbP2-Lz@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=mads@ynddal.dk \
--cc=michael.roth@amd.com \
--cc=oleg.tolmatcev@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.