NetBSD Problem Report #55565
From www@netbsd.org Wed Aug 12 21:52:32 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 058E21A9239
for <gnats-bugs@gnats.NetBSD.org>; Wed, 12 Aug 2020 21:52:32 +0000 (UTC)
Message-Id: <20200812215231.0EC911A9246@mollari.NetBSD.org>
Date: Wed, 12 Aug 2020 21:52:31 +0000 (UTC)
From: bruce.lilly@gmail.com
Reply-To: bruce.lilly@gmail.com
To: gnats-bugs@NetBSD.org
Subject: pkgtools/mtree time= values wrong for tv_nsec<100000000
X-Send-Pr-Version: www-1.0
>Number: 55565
>Category: pkg
>Synopsis: pkgtools/mtree time= values wrong for tv_nsec<100000000
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 12 21:55:00 +0000 2020
>Last-Modified: Thu Aug 13 07:14:35 +0000 2020
>Originator: Bruce Lilly
>Release: $NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $
>Organization:
>Environment:
N/A (building from source for compatibility)
>Description:
spec.c uses %ld.%ld to print tv_sec, tv_nsec fields; the fractional
part for a file with 1 nanosecond offset prints as .1
and one with 100 milliseconds offset prints as .100000000
which appear as the same thing to a human reader, and may be
interpreted as the same thing e.g. by scanf.
The issue is alluded to in the FreeBSD mtree(8) man page:
"The netbsd6 flavor does not replicate the historical bug that reported
time as seconds.nanoseconds without zero padding nanosecond values less than 100000000." However, the source at
ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/files
still contains the problem format string.
>How-To-Repeat:
mtree -c -k time
compare timestamps to (e.g.)
stat -t %f
>Fix:
Source patch follows, maintainer should update the ident string;
(info:) the fractional part of the time format as modified matches
that in FreeBSD code at
https://github.com/freebsd/freebsd/blob/master/contrib/mtree/spec.c
(FreeBSD uses some oddball formats for the full seconds and some
other fields). The man page isn't changed, but it should probably
be updated to note the format details as listed in the FreeBSD mtree(5)
and mtree(8) man pages, viz. "The value should include a period character and exactly nine digits after the period."
*** spec.c.orig 2020-08-12 15:59:52.108501015 -0400
--- spec.c 2020-08-12 17:18:17.084301702 -0400
***************
*** 1,4 ****
! /* $NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1989, 1993
--- 1,4 ----
! /* FIXME: $NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1989, 1993
***************
*** 385,391 ****
if (MATCHFLAG(F_SIZE))
printf("size=%lld ", (long long)cur->st_size);
if (MATCHFLAG(F_TIME))
! printf("time=%ld.%ld ", (long)cur->st_mtimespec.tv_sec,
cur->st_mtimespec.tv_nsec);
if (MATCHFLAG(F_CKSUM))
printf("cksum=%lu ", cur->cksum);
--- 385,391 ----
if (MATCHFLAG(F_SIZE))
printf("size=%lld ", (long long)cur->st_size);
if (MATCHFLAG(F_TIME))
! printf("time=%ld.%09ld ", (long)cur->st_mtimespec.tv_sec,
cur->st_mtimespec.tv_nsec);
if (MATCHFLAG(F_CKSUM))
printf("cksum=%lu ", cur->cksum);
>Release-Note:
>Audit-Trail:
From: Bruce Lilly <bruce.lilly@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/55565: mtree time= values wrong for tv_nsec<100000000
Date: Wed, 12 Aug 2020 18:00:35 -0400
Additional issues in create.c; patch:
*** create.c.orig 2020-08-12 17:55:53.016206136 -0400
--- create.c 2020-08-12 17:55:00.540208359 -0400
***************
*** 230,240 ****
output(&indent, "size=%lld", (long long)p->fts_statp->st_size);
#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
if (keys & F_TIME)
! output(&indent, "time=%ld.%ld",
(long)p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
#else
! output(&indent, "time=%ld.%ld",
p->fts_statp->st_mtime, 0);
#endif
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
--- 230,240 ----
output(&indent, "size=%lld", (long long)p->fts_statp->st_size);
#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
if (keys & F_TIME)
! output(&indent, "time=%ld.%09ld",
(long)p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
#else
! output(&indent, "time=%ld.%09ld",
p->fts_statp->st_mtime, 0);
#endif
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
On Wed, Aug 12, 2020 at 5:55 PM <gnats-admin@netbsd.org> wrote:
>
> Thank you very much for your problem report.
> It has the internal identification `bin/55565'.
> The individual assigned to look at your
> report is: bin-bug-people.
>
> >Category: bin
> >Responsible: bin-bug-people
> >Synopsis: mtree time= values wrong for tv_nsec<100000000
> >Arrival-Date: Wed Aug 12 21:55:00 +0000 2020
>
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
bruce.lilly@gmail.com
Subject: Re: bin/55565: mtree time= values wrong for tv_nsec<100000000
Date: Wed, 12 Aug 2020 19:02:49 -0400
--Apple-Mail=_067B9783-BA16-4FC2-8464-382D72A93523
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
What version is that against? It appears to all be correct in HEAD...
christos
--Apple-Mail=_067B9783-BA16-4FC2-8464-382D72A93523
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXzR1GQAKCRBxESqxbLM7
OprRAKDns0w5MlyAV8QKf85FxNemFm1FPgCg0nZYVT76fgPHte93LQI9Kv2ViVE=
=Q9Js
-----END PGP SIGNATURE-----
--Apple-Mail=_067B9783-BA16-4FC2-8464-382D72A93523--
From: Bruce Lilly <bruce.lilly@gmail.com>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/55565: mtree time= values wrong for tv_nsec<100000000
Date: Wed, 12 Aug 2020 19:17:55 -0400
The pkgsrc tree at
ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/files
On Wed, Aug 12, 2020 at 7:03 PM Christos Zoulas <christos@zoulas.com> wrote:
>
> What version is that against? It appears to all be correct in HEAD...
>
> christos
Responsible-Changed-From-To: bin-bug-people->pkg-manager
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 13 Aug 2020 07:14:35 +0000
Responsible-Changed-Why:
pkgtools/mtree bug
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.