NetBSD Problem Report #45741

From mlelstv@henery.1st.de  Sun Dec 25 10:05:39 2011
Return-Path: <mlelstv@henery.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D67EF63C2B0
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 25 Dec 2011 10:05:38 +0000 (UTC)
Message-Id: <20111225100522.BD0282818F@henery.1st.de>
Date: Sun, 25 Dec 2011 11:05:22 +0100 (CET)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@gnats.NetBSD.org
Subject: tcsh doesn't understand 64bit time_t
X-Send-Pr-Version: 3.95

>Number:         45741
>Category:       pkg
>Synopsis:       tcsh doesn't understand 64bit time_t
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kim
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 25 10:10:00 +0000 2011
>Last-Modified:  Sun Dec 25 15:45:01 +0000 2011
>Originator:     Michael van Elst
>Release:        NetBSD 5.99.58
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:


System: NetBSD dummy 5.99.58 NetBSD 5.99.58 (GENERIC) #3: Thu Dec 15 15:23:35 CET 2011 mlelstv@henery:/home/netbsd-current/obj.amiga/home/netbsd-current/src/sys/arch/amiga/compile/GENERIC amiga
Architecture: m68k
Machine: amiga
>Description:
tcsh 6.17 prints bad values for user and system time. This is caused
by the change to 64bit time_t values in NetBSD.

E.g.

% time /usr/tests/crypto/libcrypto/h_ecdsatest
0.425u 0.001s 7:10.95 99.2%   0+0k 0+0io 0pf+0w

Total CPU time is 427 seconds. The seconds seem to printed
as milliseconds.

>How-To-Repeat:
Use the builtint time command of tcsh.

>Fix:
--- sh.time.c.orig	2009-03-23 19:08:52.000000000 +0100
+++ sh.time.c	2009-03-23 19:09:22.000000000 +0100
@@ -687,7 +687,7 @@
     timeval_t td;

     tvsub(&td, t1, t0);
-    xprintf("%ld.%03ld", td.tv_sec, td.tv_usec / 1000L);
+    xprintf("%ld.%03ld", (long)td.tv_sec, (long)td.tv_usec / 1000L);
 }

 static void

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 12:10:57 +0000

 On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv@serpens.de wrote:
  > tcsh 6.17 prints bad values for user and system time. This is caused
  > by the change to 64bit time_t values in NetBSD.

 Is that a compat problem or a native problem? (that is, did you build
 the tcsh before or after the time_t switch?)

 -- 
 David A. Holland
 dholland@netbsd.org

From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@NetBSD.org, gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 13:34:51 +0100

 On Sun, Dec 25, 2011 at 12:15:04PM +0000, David Holland wrote:
 >  On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv@serpens.de wrote:
 >   > tcsh 6.17 prints bad values for user and system time. This is caused
 >   > by the change to 64bit time_t values in NetBSD.
 >  
 >  Is that a compat problem or a native problem? (that is, did you build
 >  the tcsh before or after the time_t switch?)

 Of course after.

 The problem is that printf is called with a format string
 denoting a 'long' value, but gets passed a parameter that is
 'time_t'. This works fine unless 'time_t' is larger than 'long'.

 Casting the parameters to 'long' helps unless the value
 printed doesn't fit into a 'long' (i.e. rusage is more than
 2^31 seconds == 68 years CPU time).

 If you want to support larger rusage values, the format string
 needs to be adapted. But that might have portability issues for
 tcsh.


 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 12:46:05 +0000

 On Sun, Dec 25, 2011 at 12:40:05PM +0000, Michael van Elst wrote:
  >  On Sun, Dec 25, 2011 at 12:15:04PM +0000, David Holland wrote:
  >  >  On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv@serpens.de wrote:
  >  >   > tcsh 6.17 prints bad values for user and system time. This is caused
  >  >   > by the change to 64bit time_t values in NetBSD.
  >  >  
  >  >  Is that a compat problem or a native problem? (that is, did you build
  >  >  the tcsh before or after the time_t switch?)
  >  
  >  Of course after.

 It wasn't obvious, a still-undiscovered compat problem is hardly
 impossible.

  >  The problem is that printf is called with a format string
  >  denoting a 'long' value, but gets passed a parameter that is
  >  'time_t'. This works fine unless 'time_t' is larger than 'long'.
  >  
  >  Casting the parameters to 'long' helps unless the value
  >  printed doesn't fit into a 'long' (i.e. rusage is more than
  >  2^31 seconds == 68 years CPU time).
  >  
  >  If you want to support larger rusage values, the format string
  >  needs to be adapted. But that might have portability issues for
  >  tcsh.

 ah.

 Well, I don't think there's any need to worry about 68 years CPU time
 for at least the near future. Maybe when 1024-way machines become
 common...

 -- 
 David A. Holland
 dholland@netbsd.org

Responsible-Changed-From-To: pkg-manager->kim
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Sun, 25 Dec 2011 13:54:06 +0000
Responsible-Changed-Why:
Over to maintainer (are you there?)


From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, 
	pkgsrc-bugs@netbsd.org, mlelstv@serpens.de
Cc: 
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 10:18:20 -0500

 On Dec 25, 12:15pm, dholland-pbugs@netbsd.org (David Holland) wrote:
 -- Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t

 | The following reply was made to PR pkg/45741; it has been noted by GNATS.
 | 
 | From: David Holland <dholland-pbugs@netbsd.org>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
 | Date: Sun, 25 Dec 2011 12:10:57 +0000
 | 
 |  On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv@serpens.de wrote:
 |   > tcsh 6.17 prints bad values for user and system time. This is caused
 |   > by the change to 64bit time_t values in NetBSD.
 |  
 |  Is that a compat problem or a native problem? (that is, did you build
 |  the tcsh before or after the time_t switch?)

 I guess I need to release a new tcsh. This has been fixed for more than a
 year ago.

 christos

From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 10:40:54 -0500

 On Sun, 25 Dec 2011 15:20:03 +0000 (UTC)
 christos@zoulas.com (Christos Zoulas) wrote:

 > The following reply was made to PR pkg/45741; it has been noted by GNATS.
 > 
 > From: christos@zoulas.com (Christos Zoulas)
 > To: gnats-bugs@NetBSD.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, 
 > 	pkgsrc-bugs@netbsd.org, mlelstv@serpens.de
 > Cc: 
 > Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
 > Date: Sun, 25 Dec 2011 10:18:20 -0500
 > 
 >  On Dec 25, 12:15pm, dholland-pbugs@netbsd.org (David Holland) wrote:
 >  -- Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
 >  
 >  | The following reply was made to PR pkg/45741; it has been noted by GNATS.
 >  | 
 >  | From: David Holland <dholland-pbugs@netbsd.org>
 >  | To: gnats-bugs@NetBSD.org
 >  | Cc: 
 >  | Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
 >  | Date: Sun, 25 Dec 2011 12:10:57 +0000
 >  | 
 >  |  On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv@serpens.de wrote:
 >  |   > tcsh 6.17 prints bad values for user and system time. This is caused
 >  |   > by the change to 64bit time_t values in NetBSD.
 >  |  
 >  |  Is that a compat problem or a native problem? (that is, did you build
 >  |  the tcsh before or after the time_t switch?)
 >  
 >  I guess I need to release a new tcsh. This has been fixed for more than a
 >  year ago.
 >  
 >  christos
 >  
 > 

 This makes me wonder, is there precedent for a definition similar to
 the ones in int_fmtio.h to have one matching time_t (or other BSD or
 POSIX specific typedefs)?  I.e. we have _BSD_TIME_T_ yet I see no
 _BSD_PRI_TIME_T_ or similar...

 Thanks,
 -- 
 Matt

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.