Skip to contentSkip to conversation

TIME_MAX not set correctly for OpenBSD in qemu-common.h

Qemu-devel Brad Smith 3 participants 8 messages Dec 11, 2011 – Apr 13, 2018

lore
Share & tools
lore

Brad Smith

author
#0 lore raw

Public bug reported:

Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code. OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

CC i386-softmmu/monitor.o
/buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
/buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

qemu-common.h has...

#ifndef TIME_MAX
#define TIME_MAX LONG_MAX
#endif

for OpenBSD this should be INT_MAX.

** Affects: qemu
Importance: Undecided
Status: New

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  New

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
#1 lore raw

Am 11.12.2011 07:47, schrieb Brad Smith:

Quoted 15 lines

Public bug reported:

Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code. OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

CC i386-softmmu/monitor.o
/buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
/buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

qemu-common.h has...

#ifndef TIME_MAX
#define TIME_MAX LONG_MAX
#endif

Quoted 5 lines

for OpenBSD this should be INT_MAX.

** Affects: qemu
Importance: Undecided
Status: New

This needs special handling for w32 / w64, too. Looking at the code where TIME_MAX is used, I assume that more fixes are needed. The following code for example won't work:

  if (lifetime > INT_MAX) {

What about using

  #define TIME_FOREVER -1

instead of TIME_MAX? Of course this would need additional code changes.

Regards,
Stefan Weil

author
#2 lore raw
In reply to Brad Smith
Quoted 35 lines · Stefan Weil

Am 11.12.2011 07:47, schrieb Brad Smith:

Quoted 19 lines

Public bug reported:

Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

CC i386-softmmu/monitor.o /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
/buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning:
overflow in implicit constant conversion

qemu-common.h has...

#ifndef TIME_MAX
#define TIME_MAX LONG_MAX
#endif

Quoted 5 lines

for OpenBSD this should be INT_MAX.

** Affects: qemu
Importance: Undecided
Status: New

This needs special handling for w32 / w64, too. Looking at the code where TIME_MAX is used, I assume that more fixes are needed. The following code for example won't work:

if (lifetime > INT_MAX) {

What about using

Quoted 7 lines

#define TIME_FOREVER -1

instead of TIME_MAX? Of course this would need additional code changes.

Regards,
Stefan Weil

Gerd?

Still looking for comment on this since you added the initial code which has this bug in it.

Signature · 33 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  New

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
#3 lore raw

Hi,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

Ouch. Adding 64bit arch with 32bit time_t is pretty lame IMHO. There are a bunch of years left to fix that that though.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

#ifndef TIME_MAX
#define TIME_MAX LONG_MAX
#endif

for OpenBSD this should be INT_MAX.

Guess we'll need an #ifdef then.

Quoted 6 lines
Quoted 6 lines

This needs special handling for w32 / w64, too. Looking at the code where TIME_MAX is used, I assume that more fixes are needed. The following code for example won't work:

if (lifetime > INT_MAX) {

With 32bit time_t lifetime wouldn't become larger than INT_MAX anyway, so it doesn't matter ;)

Quoted 2 lines

Still looking for comment on this since you added the initial code which has this bug in it.

cheers,
Gerd

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  New

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
#4 lore raw
In reply to Brad Smith

Triaging old bug tickets... can you still reproduce this issue with the latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
Status: New => Incomplete

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  Incomplete

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
author
#5 lore raw
In reply to Brad Smith

Since this bug report was filed OpenBSD has switched from 32-bit time_t to 64-bit time_t on all archs (yes, including 32-bit archs like i386, arm, powerpc). So instead of INT_MAX TIME_MAX should now be set to LLONG_MAX.

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  Incomplete

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
#6 lore raw
In reply to Brad Smith

** Changed in: qemu
Status: Incomplete => Triaged

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  Triaged

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions
#7 lore raw
In reply to Brad Smith

This was fixed in commit e7b47c22e2df14d, which was in the 2.11.0 release.

** Changed in: qemu
Status: Triaged => Fix Released

Signature · 28 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/902720

Title:
  TIME_MAX not set correctly for OpenBSD in qemu-common.h

Status in QEMU:
  Fix Released

Bug description:
  Looking at the OpenBSD buildbot logs I noticed a warning that appears to be a bug in the code.
  OpenBSD has a 32-bit time_t on all archs at the moment (32-bit and 64-bit).

    CC    i386-softmmu/monitor.o
  /buildbot-qemu/default_openbsd_current/build/monitor.c: In function 'expire_password':
  /buildbot-qemu/default_openbsd_current/build/monitor.c:944: warning: overflow in implicit constant conversion

  qemu-common.h has...

  #ifndef TIME_MAX
  #define TIME_MAX LONG_MAX
  #endif

  for OpenBSD this should be INT_MAX.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/902720/+subscriptions