From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adda Rathbone Subject: Compile error with Ubuntu 11.10 Date: Wed, 30 Nov 2011 22:19:57 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8650634902156781188==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============8650634902156781188== Content-Type: multipart/alternative; boundary=f46d04428ee239b4c704b2fa4c8d --f46d04428ee239b4c704b2fa4c8d Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, compilation of xen-unstable with a fresh Ubuntu 11.10 x86_64 fails with following error: cc1: warnings being treated as errors libxl_create.c: In function =91store_libxl_entry=92: libxl_create.c:465: error: format not a string literal and no format arguments Steps to reproduce: - Install Ubuntu 11.10 ( http://www.ubuntu.com/start-download?distro=3Ddesktop&bits=3D64&release=3Dl= atest) - sudo apt-get install mercurial libsdl-dev pciutils-dev ncurses-dev uuid-dev gettext libyajl-dev flex zlib1g-dev libssl-dev xorg-dev bcc bin86 iasl libc6-dev-i386 patch git - hg clone http://xenbits.xensource.com/xen-unstable.hg - cd xen-unstable.hg/tools - make Adda --f46d04428ee239b4c704b2fa4c8d Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi,
compilation of xen-unstable with a fresh Ubuntu 11.10 x86_64 fails w= ith following error:

cc1: warnings being treated as errors
libxl_= create.c: In function =91store_libxl_entry=92:
libxl_create.c:465: error= : format not a string literal and no format arguments

Steps to reproduce:

- Install Ubuntu 11.10 (http://www.ubuntu.com/start-download?distro=3Ddeskt= op&bits=3D64&release=3Dlatest)
- sudo apt-get install mercurial libsdl-dev pciutils-dev ncurses-dev uuid-d= ev gettext libyajl-dev flex zlib1g-dev libssl-dev xorg-dev bcc bin86 iasl l= ibc6-dev-i386 patch git
- hg clone http://xenbits.xensource.com/xen-unst= able.hg
- cd xen-unstable.hg/tools
- make

Adda
--f46d04428ee239b4c704b2fa4c8d-- --===============8650634902156781188== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============8650634902156781188==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: Compile error with Ubuntu 11.10 Date: Thu, 1 Dec 2011 10:47:02 +0000 Message-ID: <1322736422.31810.197.camel@zakaz.uk.xensource.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Adda Rathbone Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org T24gV2VkLCAyMDExLTExLTMwIGF0IDIxOjE5ICswMDAwLCBBZGRhIFJhdGhib25lIHdyb3RlOgo+ IEhpLAo+IGNvbXBpbGF0aW9uIG9mIHhlbi11bnN0YWJsZSB3aXRoIGEgZnJlc2ggVWJ1bnR1IDEx LjEwIHg4Nl82NCBmYWlscwo+IHdpdGggZm9sbG93aW5nIGVycm9yOgo+IAo+IGNjMTogd2Fybmlu Z3MgYmVpbmcgdHJlYXRlZCBhcyBlcnJvcnMKPiBsaWJ4bF9jcmVhdGUuYzogSW4gZnVuY3Rpb24g 4oCYc3RvcmVfbGlieGxfZW50cnnigJk6Cj4gbGlieGxfY3JlYXRlLmM6NDY1OiBlcnJvcjogZm9y bWF0IG5vdCBhIHN0cmluZyBsaXRlcmFsIGFuZCBubyBmb3JtYXQgCj4gYXJndW1lbnRzCgpMb29r cyBsaWtlIFVidW50dSBoYXMgZW5hYmxlZCAtV2Zvcm1hdC1ub25saXRlcmFsIGJ5IGRlZmF1bHQK CkkgZXhwZW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KCl9fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fClhlbi1kZXZlbCBtYWlsaW5n IGxpc3QKWGVuLWRldmVsQGxpc3RzLnhlbnNvdXJjZS5jb20KaHR0cDovL2xpc3RzLnhlbnNvdXJj ZS5jb20veGVuLWRldmVsCg== From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: Compile error with Ubuntu 11.10 Date: Thu, 1 Dec 2011 17:14:21 +0000 Message-ID: <20183.46573.894123.974575@mariner.uk.xensource.com> References: <1322736422.31810.197.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1322736422.31810.197.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Adda Rathbone List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] Compile error with Ubuntu 11.10"): > I expect that this needs to change to be > return libxl__xs_write(gc, XBT_NULL, path, "%s", libxl__strdup(gc, > libxl_device_model_version_to_string(dm_info->device_model_version))); > (note the additional "%s",) > > Can you try that? Here's a patch which I think should fix this. Adda, can you try it please ? libxl: Fix format string problem resulting in compile warning Fixes: libxl_create.c:465: error: format not a string literal and no format arguments (The warning does not relate to security problem in this case, because the string erroneously used as a format came from our enum conversion and is safe.) Also remove a redundant strdup. Signed-off-by: Ian Jackson diff -r 617b56ea3291 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Thu Dec 01 16:28:51 2011 +0000 +++ b/tools/libxl/libxl_create.c Thu Dec 01 16:52:30 2011 +0000 @@ -461,8 +461,8 @@ static int store_libxl_entry(libxl__gc * path = libxl__xs_libxl_path(gc, domid); path = libxl__sprintf(gc, "%s/dm-version", path); - return libxl__xs_write(gc, XBT_NULL, path, libxl__strdup(gc, - libxl_device_model_version_to_string(dm_info->device_model_version))); + return libxl__xs_write(gc, XBT_NULL, path, "%s", + libxl_device_model_version_to_string(dm_info->device_model_version)); } static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: Compile error with Ubuntu 11.10 Date: Thu, 1 Dec 2011 18:01:10 +0000 Message-ID: <1322762470.7376.27.camel@dagon.hellion.org.uk> References: <1322736422.31810.197.camel@zakaz.uk.xensource.com> <20183.46573.894123.974575@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20183.46573.894123.974575@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" , Adda Rathbone List-Id: xen-devel@lists.xenproject.org On Thu, 2011-12-01 at 17:14 +0000, Ian Jackson wrote: > Ian Campbell writes ("Re: [Xen-devel] Compile error with Ubuntu 11.10"): > > I expect that this needs to change to be > > return libxl__xs_write(gc, XBT_NULL, path, "%s", libxl__strdup(gc, > > libxl_device_model_version_to_string(dm_info->device_model_version))); > > (note the additional "%s",) > > > > Can you try that? > > Here's a patch which I think should fix this. Adda, can you try it > please ? > > libxl: Fix format string problem resulting in compile warning > > Fixes: > libxl_create.c:465: error: format not a string literal and no format > arguments > (The warning does not relate to security problem in this case, > because the string erroneously used as a format came from our enum > conversion and is safe.) If distros (or gcc) are starting to enable -Wformat-nonliteral (assuming that is what this is) by default perhaps we should preemptively set it ourselves? Setting it found one other instance of a weird strdup (actually a sprintf of a string we just sprintf'd). but otherwise it seems to work. 8<------------------------------- libxl: build with -Wformat-nonliteral Fix the remaining issue that this shows up. Signed-off-by: Ian Campbell diff -r 20c1c0ff9677 tools/libxl/Makefile --- a/tools/libxl/Makefile Thu Dec 01 12:24:06 2011 +0100 +++ b/tools/libxl/Makefile Thu Dec 01 17:59:25 2011 +0000 @@ -11,7 +11,7 @@ MINOR = 0 XLUMAJOR = 1.0 XLUMINOR = 0 -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations +CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations -Wformat-nonliteral CFLAGS += -I. -fPIC ifeq ($(CONFIG_Linux),y) static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, diff -r 20c1c0ff9677 tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Dec 01 12:24:06 2011 +0100 +++ b/tools/libxl/libxl_device.c Thu Dec 01 17:59:25 2011 +0000 @@ -516,7 +516,7 @@ int libxl__devices_destroy(libxl__gc *gc for (j = 0; j < num_devs; j++) { path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend", domid, kinds[i], devs[j]); - path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path)); + path = libxl__xs_read(gc, XBT_NULL, path); if (path && libxl__parse_backend_path(gc, path, &dev) == 0) { dev.domid = domid; dev.kind = kind; From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Pounce Subject: Re: Compile error with Ubuntu 11.10 Date: Fri, 2 Dec 2011 18:01:17 +0000 Message-ID: <20111202180117.GD6331@citrix.com> References: <1322736422.31810.197.camel@zakaz.uk.xensource.com> <20183.46573.894123.974575@mariner.uk.xensource.com> <1322762470.7376.27.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1322762470.7376.27.camel@dagon.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org IanC - I have tried the two patches that you provided and this appears to fix this problem in that I can now compile on my ubuntu 11.10 desktop. libxl: Fix format string problem resulting in compile warning libxl: build with -Wformat-nonliteral -Andrew The combined patch is (against http://xenbits.xen.org/xen-unstable.hg ):- diff -r 62ff6a318c5d tools/libxl/Makefile --- a/tools/libxl/Makefile Wed Nov 30 16:59:58 2011 -0800 +++ b/tools/libxl/Makefile Fri Dec 02 17:49:57 2011 +0000 @@ -11,7 +11,7 @@ XLUMAJOR = 1.0 XLUMINOR = 0 -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations +CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations -Wformat-nonliteral CFLAGS += -I. -fPIC ifeq ($(CONFIG_Linux),y) diff -r 62ff6a318c5d tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Wed Nov 30 16:59:58 2011 -0800 +++ b/tools/libxl/libxl_create.c Fri Dec 02 17:49:57 2011 +0000 @@ -461,8 +461,8 @@ path = libxl__xs_libxl_path(gc, domid); path = libxl__sprintf(gc, "%s/dm-version", path); - return libxl__xs_write(gc, XBT_NULL, path, libxl__strdup(gc, - libxl_device_model_version_to_string(dm_info->device_model_version))); + return libxl__xs_write(gc, XBT_NULL, path, "%s", + libxl_device_model_version_to_string(dm_info->device_model_version)); } static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, diff -r 62ff6a318c5d tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Wed Nov 30 16:59:58 2011 -0800 +++ b/tools/libxl/libxl_device.c Fri Dec 02 17:49:57 2011 +0000 @@ -516,7 +516,7 @@ for (j = 0; j < num_devs; j++) { path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend", domid, kinds[i], devs[j]); - path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path)); + path = libxl__xs_read(gc, XBT_NULL, path); if (path && libxl__parse_backend_path(gc, path, &dev) == 0) { dev.domid = domid; dev.kind = kind;