Message ID | 20120523125711.783be240@doriath.home |
---|---|
State | New |
Headers | show |
On 05/23/2012 09:57 AM, Luiz Capitulino wrote: > > Anyone knows what I did wrong? Or, if anybody could test the attached fix... Sorry, I'm not in a position to test the patch, but I can at least review it. > > > 0001-qemu-ga-Fix-missing-environ-declarion.patch > > >>From 4a3f4cff8aa27fe3810d621d20bf90f18ca8e2d5 Mon Sep 17 00:00:00 2001 > From: Luiz Capitulino <lcapitulino@redhat.com> > Date: Wed, 23 May 2012 11:33:51 -0300 > Subject: [PATCH] qemu-ga: Fix missing environ declarion s/declarion/declaration/ > > Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ > global variable, but is relying on it to be declared somewhere else. > > This works for Linux because _GNU_SOURCE declares it, but it brakes s/brakes/breaks/ > for system where _GNU_SOURCE is not declared, such as OpenBSD. > > Fix it by declaring environ when _GNU_SOURCE is not defined. > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > qga/commands-posix.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index 7664be1..304ffa8 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -12,6 +12,7 @@ > */ > > #include <glib.h> > +#include <unistd.h> > #include <sys/types.h> > #include <sys/ioctl.h> > #include "qga/guest-agent-core.h" > @@ -20,6 +21,10 @@ > #include "qemu-queue.h" > #include "host-utils.h" > > +#ifndef _GNU_SOURCE > +extern char **environ; > +#endif Looks reasonable.
Il 23/05/2012 17:57, Luiz Capitulino ha scritto: > On Wed, 23 May 2012 11:35:49 -0300 > Luiz Capitulino <lcapitulino@redhat.com> wrote: > >>> Maybe we need a patch to declare environ for openbsd >> >> Yes, I have the patch already but am installing openbsd on a VM to test it. > > I'm getting lots of make errors on openbsd 4.9: > > "Makefile", line 7: Missing dependency operator > "/root/qemu.a/rules.mak", line 20: Missing dependency operator > "/root/qemu.a/rules.mak", line 23: Need an operator > "/root/qemu.a/rules.mak", line 26: Need an operator > "Makefile", line 15: Need an operator > "Makefile", line 19: Need an operator > "Makefile", line 22: Missing dependency operator > "Makefile", line 24: Need an operator > Bad modifier: $(SRC_PATH)/hw) > > Bad modifier: $(SRC_PATH)/hw) > > "Makefile", line 36: Need an operator > > Anyone knows what I did wrong? Or, if anybody could test the attached fix... Probably you need to install gnumake. Paolo
On Wed, 23 May 2012 18:06:18 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 23/05/2012 17:57, Luiz Capitulino ha scritto: > > On Wed, 23 May 2012 11:35:49 -0300 > > Luiz Capitulino <lcapitulino@redhat.com> wrote: > > > >>> Maybe we need a patch to declare environ for openbsd > >> > >> Yes, I have the patch already but am installing openbsd on a VM to test it. > > > > I'm getting lots of make errors on openbsd 4.9: > > > > "Makefile", line 7: Missing dependency operator > > "/root/qemu.a/rules.mak", line 20: Missing dependency operator > > "/root/qemu.a/rules.mak", line 23: Need an operator > > "/root/qemu.a/rules.mak", line 26: Need an operator > > "Makefile", line 15: Need an operator > > "Makefile", line 19: Need an operator > > "Makefile", line 22: Missing dependency operator > > "Makefile", line 24: Need an operator > > Bad modifier: $(SRC_PATH)/hw) > > > > Bad modifier: $(SRC_PATH)/hw) > > > > "Makefile", line 36: Need an operator > > > > Anyone knows what I did wrong? Or, if anybody could test the attached fix... > > Probably you need to install gnumake. Yeah, Andreas helped by irc, but now I get zillions of -Wno-redundant-decls errors: In file included from /root/qemu.a/qemu-common.h:33, from /root/qemu.a/module.c:16: /usr//include/unistd.h:99: warning: redundant redeclaration of 'lseek' /usr//include/sys/types.h:210: warning: previous declaration of 'lseek' was here /usr//include/unistd.h:138: warning: redundant redeclaration of 'ftruncate' /usr//include/sys/types.h:211: warning: previous declaration of 'ftruncate' was here I've removed -Wno-redundant-decls and I finally get the environ build error, but I wonder why build bot doesn't get it.
On Wed, May 23, 2012 at 12:57:11PM -0300, Luiz Capitulino wrote: > On Wed, 23 May 2012 11:35:49 -0300 > Luiz Capitulino <lcapitulino@redhat.com> wrote: > > > > Maybe we need a patch to declare environ for openbsd > > > > Yes, I have the patch already but am installing openbsd on a VM to test it. > > I'm getting lots of make errors on openbsd 4.9: > > "Makefile", line 7: Missing dependency operator > "/root/qemu.a/rules.mak", line 20: Missing dependency operator > "/root/qemu.a/rules.mak", line 23: Need an operator > "/root/qemu.a/rules.mak", line 26: Need an operator > "Makefile", line 15: Need an operator > "Makefile", line 19: Need an operator > "Makefile", line 22: Missing dependency operator > "Makefile", line 24: Need an operator > Bad modifier: $(SRC_PATH)/hw) > > Bad modifier: $(SRC_PATH)/hw) > > "Makefile", line 36: Need an operator > > Anyone knows what I did wrong? Or, if anybody could test the attached fix... Had to nuke my openbsd VM a while back to free up space, but I vagulely recall the fix for this being to use `gmake` instead of `make` > From 4a3f4cff8aa27fe3810d621d20bf90f18ca8e2d5 Mon Sep 17 00:00:00 2001 > From: Luiz Capitulino <lcapitulino@redhat.com> > Date: Wed, 23 May 2012 11:33:51 -0300 > Subject: [PATCH] qemu-ga: Fix missing environ declarion > > Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ > global variable, but is relying on it to be declared somewhere else. > > This works for Linux because _GNU_SOURCE declares it, but it brakes > for system where _GNU_SOURCE is not declared, such as OpenBSD. > > Fix it by declaring environ when _GNU_SOURCE is not defined. > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> > --- > qga/commands-posix.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index 7664be1..304ffa8 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -12,6 +12,7 @@ > */ > > #include <glib.h> > +#include <unistd.h> > #include <sys/types.h> > #include <sys/ioctl.h> > #include "qga/guest-agent-core.h" > @@ -20,6 +21,10 @@ > #include "qemu-queue.h" > #include "host-utils.h" > > +#ifndef _GNU_SOURCE > +extern char **environ; > +#endif > + > #if defined(__linux__) > #include <mntent.h> > #include <linux/fs.h> > -- > 1.7.9.2.384.g4a92a >
On Wed, 23 May 2012 10:01:02 -0600 Eric Blake <eblake@redhat.com> wrote: > > #include <glib.h> > > +#include <unistd.h> > > #include <sys/types.h> > > #include <sys/ioctl.h> > > #include "qga/guest-agent-core.h" > > @@ -20,6 +21,10 @@ > > #include "qemu-queue.h" > > #include "host-utils.h" > > > > +#ifndef _GNU_SOURCE > > +extern char **environ; > > +#endif > > Looks reasonable. But that's not the cause of problem. What's happening is that on F16 environ is declared automatically in <unistd.h>. I'll post a different fix right now.
From 4a3f4cff8aa27fe3810d621d20bf90f18ca8e2d5 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino <lcapitulino@redhat.com> Date: Wed, 23 May 2012 11:33:51 -0300 Subject: [PATCH] qemu-ga: Fix missing environ declarion Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global variable, but is relying on it to be declared somewhere else. This works for Linux because _GNU_SOURCE declares it, but it brakes for system where _GNU_SOURCE is not declared, such as OpenBSD. Fix it by declaring environ when _GNU_SOURCE is not defined. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- qga/commands-posix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 7664be1..304ffa8 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -12,6 +12,7 @@ */ #include <glib.h> +#include <unistd.h> #include <sys/types.h> #include <sys/ioctl.h> #include "qga/guest-agent-core.h" @@ -20,6 +21,10 @@ #include "qemu-queue.h" #include "host-utils.h" +#ifndef _GNU_SOURCE +extern char **environ; +#endif + #if defined(__linux__) #include <mntent.h> #include <linux/fs.h> -- 1.7.9.2.384.g4a92a