* [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
@ 2014-08-18 11:41 Michael Tokarev
2014-08-18 11:45 ` Peter Maydell
2014-08-19 11:58 ` Kevin Wolf
0 siblings, 2 replies; 6+ messages in thread
From: Michael Tokarev @ 2014-08-18 11:41 UTC (permalink / raw)
To: qemu-devel, qemu-trivial; +Cc: Li Liu, Michael Tokarev, zhanghailiang
Just log to stderr unconditionally, like other similar code does.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
block/vvfat.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 70176b1..ea37023 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
vvv = s;
#endif
-DLOG(if (stderr == NULL) {
- stderr = fopen("vvfat.log", "a");
- setbuf(stderr, NULL);
-})
-
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err);
if (local_err) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-18 11:41 [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL Michael Tokarev
@ 2014-08-18 11:45 ` Peter Maydell
2014-08-19 11:58 ` Kevin Wolf
1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-08-18 11:45 UTC (permalink / raw)
To: Michael Tokarev; +Cc: QEMU Trivial, Li Liu, QEMU Developers, zhanghailiang
On 18 August 2014 12:41, Michael Tokarev <mjt@tls.msk.ru> wrote:
> Just log to stderr unconditionally, like other similar code does.
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
> block/vvfat.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/block/vvfat.c b/block/vvfat.c
> index 70176b1..ea37023 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
> vvv = s;
> #endif
>
> -DLOG(if (stderr == NULL) {
> - stderr = fopen("vvfat.log", "a");
> - setbuf(stderr, NULL);
> -})
> -
> opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
> qemu_opts_absorb_qdict(opts, options, &local_err);
> if (local_err) {
> --
> 1.7.10.4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-18 11:41 [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL Michael Tokarev
2014-08-18 11:45 ` Peter Maydell
@ 2014-08-19 11:58 ` Kevin Wolf
2014-08-19 12:02 ` Peter Maydell
2014-08-19 12:06 ` Eric Blake
1 sibling, 2 replies; 6+ messages in thread
From: Kevin Wolf @ 2014-08-19 11:58 UTC (permalink / raw)
To: Michael Tokarev; +Cc: qemu-trivial, Li Liu, qemu-devel, stefanha, zhanghailiang
Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
> Just log to stderr unconditionally, like other similar code does.
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
> block/vvfat.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/block/vvfat.c b/block/vvfat.c
> index 70176b1..ea37023 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
> vvv = s;
> #endif
>
> -DLOG(if (stderr == NULL) {
> - stderr = fopen("vvfat.log", "a");
> - setbuf(stderr, NULL);
> -})
> -
> opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
> qemu_opts_absorb_qdict(opts, options, &local_err);
> if (local_err) {
Michael, it's fine to merge trivial block patches through your tree, but
can you please keep Stefan and me CCed anyway?
This specific patch isn't as trivial as it might look at the first
sight (in other words: it's wrong). The part that you probably missed is
that stderr isn't the real one when DEBUG is set:
#undef stderr
#define stderr STDERR
FILE* stderr = NULL;
So now you have a lot of fprintf(NULL, ...), which obviously makes qemu
segfault as soon as you enable debugging for vvfat.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-19 11:58 ` Kevin Wolf
@ 2014-08-19 12:02 ` Peter Maydell
2014-08-19 12:06 ` Eric Blake
1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-08-19 12:02 UTC (permalink / raw)
To: Kevin Wolf
Cc: zhanghailiang, QEMU Trivial, Li Liu, Michael Tokarev,
QEMU Developers, Stefan Hajnoczi
On 19 August 2014 12:58, Kevin Wolf <kwolf@redhat.com> wrote:
> This specific patch isn't as trivial as it might look at the first
> sight (in other words: it's wrong). The part that you probably missed is
> that stderr isn't the real one when DEBUG is set:
>
> #undef stderr
> #define stderr STDERR
> FILE* stderr = NULL;
Yikes. Can we rip that out as well, then?
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-19 11:58 ` Kevin Wolf
2014-08-19 12:02 ` Peter Maydell
@ 2014-08-19 12:06 ` Eric Blake
2014-08-19 12:25 ` Kevin Wolf
1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2014-08-19 12:06 UTC (permalink / raw)
To: Kevin Wolf, Michael Tokarev
Cc: qemu-trivial, Li Liu, qemu-devel, stefanha, zhanghailiang
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
On 08/19/2014 05:58 AM, Kevin Wolf wrote:
> Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
>> Just log to stderr unconditionally, like other similar code does.
>>
>>
>> -DLOG(if (stderr == NULL) {
>> - stderr = fopen("vvfat.log", "a");
>> - setbuf(stderr, NULL);
>> -})
>> -
>
> This specific patch isn't as trivial as it might look at the first
> sight (in other words: it's wrong). The part that you probably missed is
> that stderr isn't the real one when DEBUG is set:
>
> #undef stderr
> #define stderr STDERR
> FILE* stderr = NULL;
Eeek, that's horrible. I'd rather see code doing freopen("vvfat.log",
"a", stderr) than the current horrid mess of redefining stderr away from
its normal meaning.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-19 12:06 ` Eric Blake
@ 2014-08-19 12:25 ` Kevin Wolf
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2014-08-19 12:25 UTC (permalink / raw)
To: Eric Blake
Cc: zhanghailiang, qemu-trivial, Li Liu, Michael Tokarev, qemu-devel,
stefanha
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
Am 19.08.2014 um 14:06 hat Eric Blake geschrieben:
> On 08/19/2014 05:58 AM, Kevin Wolf wrote:
> > Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
> >> Just log to stderr unconditionally, like other similar code does.
> >>
>
> >>
> >> -DLOG(if (stderr == NULL) {
> >> - stderr = fopen("vvfat.log", "a");
> >> - setbuf(stderr, NULL);
> >> -})
> >> -
>
> >
> > This specific patch isn't as trivial as it might look at the first
> > sight (in other words: it's wrong). The part that you probably missed is
> > that stderr isn't the real one when DEBUG is set:
> >
> > #undef stderr
> > #define stderr STDERR
> > FILE* stderr = NULL;
>
> Eeek, that's horrible. I'd rather see code doing freopen("vvfat.log",
> "a", stderr) than the current horrid mess of redefining stderr away from
> its normal meaning.
I'd vote for just removing this redefine in addition to removing the
above hunk, so that everything ends up on the real stderr. But you have
to do the whole thing and not just half of it.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-19 12:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18 11:41 [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL Michael Tokarev
2014-08-18 11:45 ` Peter Maydell
2014-08-19 11:58 ` Kevin Wolf
2014-08-19 12:02 ` Peter Maydell
2014-08-19 12:06 ` Eric Blake
2014-08-19 12:25 ` Kevin Wolf
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).