Skip to contentSkip to conversation

Xen 4.2.2 release patch

PATCH [email protected] 4 participants 5 messages Apr 25, 2013

lore
Share & tools
lore
#0 lore raw

I tried to build Xen from the git repository, cloning the RELEASE-4.2.2 tag, on a NetBSD 6.0.1 system installed on an i386 host.

I got 4 warnings, causing the compilation to fail, due to the -Werror flag.

Rather than removing the flag, I did prefer to patch the source, since the fix was really trivial.

Please find the patch attached.

Regards,
7heo.

tools/libxl/libxl_create.c +4 -4
index 12c2047..66e2806 100644
@@ -355,7 +355,7 @@ int libxl__domain_build(libxl__gc *gc,
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
-        vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[5] = libxl__sprintf(gc, "%lu.%02d", (long unsigned int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
 
         localents = libxl__calloc(gc, 7, sizeof(char *));
         localents[0] = "platform/acpi";
@@ -378,7 +378,7 @@ int libxl__domain_build(libxl__gc *gc,
         vments[i++] = "image/kernel";
         vments[i++] = (char *) state->pv_kernel.path;
         vments[i++] = "start_time";
-        vments[i++] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[i++] = libxl__sprintf(gc, "%lu.%02d", (long unsigned int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
         if (state->pv_ramdisk.path) {
             vments[i++] = "image/ramdisk";
             vments[i++] = (char *) state->pv_ramdisk.path;
@@ -849,7 +849,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
-        vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[5] = libxl__sprintf(gc, "%lu.%02d", (long unsigned int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         vments = libxl__calloc(gc, 11, sizeof(char *));
@@ -859,7 +859,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,
         vments[i++] = "image/kernel";
         vments[i++] = (char *) state->pv_kernel.path;
         vments[i++] = "start_time";
-        vments[i++] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[i++] = libxl__sprintf(gc, "%lu.%02d", (long unsigned int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
         if (state->pv_ramdisk.path) {
             vments[i++] = "image/ramdisk";
             vments[i++] = (char *) state->pv_ramdisk.path;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 4 lines · On Thu, 2013-04-25 at 15:48 +0100, [email protected] wrote:

I tried to build Xen from the git repository, cloning the RELEASE-4.2.2 tag, on a NetBSD 6.0.1 system installed on an i386 host.

Quoted 8 lines

I got 4 warnings, causing the compilation to fail, due to the -Werror flag.

Rather than removing the flag, I did prefer to patch the source, since the fix was really trivial.

Please find the patch attached.

Thanks. It really seems like casting is the only reliable way to print a time_t :-/

Please could you resubmit with a Signed-off-by as described in:
http://wiki.xen.org/wiki/Submitting_Xen_Patches

Also, patches need to be applied to xen-unstable before being backported to the stable branches (otherwise 4.3 will simply regress again,
http://wiki.xen.org/wiki/Xen_Maintenance_Releases has some more on the topic). So, please could you send a patch against unstable, this particular piece of code doesn't seem to have changed all that much.

THanks,
Ian.

#2 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 7 lines · On Thu, 2013-04-25 at 15:48 +0100, [email protected] wrote:

I tried to build Xen from the git repository, cloning the RELEASE-4.2.2 tag, on a NetBSD 6.0.1 system installed on an i386 host.

I got 4 warnings, causing the compilation to fail, due to the -Werror flag.

Quoted 8 lines
Quoted 5 lines

Rather than removing the flag, I did prefer to patch the source, since the fix was really trivial.

Please find the patch attached.

Thanks. It really seems like casting is the only reliable way to print a time_t :-/

Except that a cast to "long" here can turn out to be a truncation, so you'd really want to cast up to "long long".

Jan

#3 lore raw
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 11 lines · On Thu, 2013-04-25 at 15:48 +0100, [email protected] wrote:

I tried to build Xen from the git repository, cloning the RELEASE-4.2.2 tag, on a NetBSD 6.0.1 system installed on an i386 host.

I got 4 warnings, causing the compilation to fail, due to the -Werror flag.

Rather than removing the flag, I did prefer to patch the source, since the fix was really trivial.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Please find the patch attached.

Thanks. It really seems like casting is the only reliable way to print a time_t :-/

Except that a cast to "long" here can turn out to be a truncation, so you'd really want to cast up to "long long".

Maybe an
AC_CHECK_SIZEOF(time_t, [], [#include <time.h>])
#if SIZEOF_TIME_T == 8
#elif SIZEOF_TIME_T == 4
is also necessary?

The OPs system will have a 64-bit time_t but that isn't a given...

Cheers,

Patrick

#4 lore raw
Quoted 22 lines · Patrick Welche
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 11 lines · On Thu, 2013-04-25 at 15:48 +0100, [email protected] wrote:

I tried to build Xen from the git repository, cloning the RELEASE-4.2.2 tag, on a NetBSD 6.0.1 system installed on an i386 host.

I got 4 warnings, causing the compilation to fail, due to the -Werror flag.

Rather than removing the flag, I did prefer to patch the source, since the fix was really trivial.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Please find the patch attached.

Thanks. It really seems like casting is the only reliable way to print a time_t :-/

Except that a cast to "long" here can turn out to be a truncation, so you'd really want to cast up to "long long".

Quoted 7 lines

Maybe an
AC_CHECK_SIZEOF(time_t, [], [#include <time.h>])
#if SIZEOF_TIME_T == 8
#elif SIZEOF_TIME_T == 4
is also necessary?

The OPs system will have a 64-bit time_t but that isn't a given...

As long as the case is to a larger type and the printf format matches I think that is fine.

I don't think any system has a >64 bit time_t?

Ian.