NetBSD Problem Report #61077
From zakinko@snowrabbit.org Wed Nov 25 17:50:43 2026
Return-Path: <zakinko@snowrabbit.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 40A151A923B
for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Nov 2026 17:50:43 +0000 (UTC)
Message-Id: <20261125175039.B5D92C9300@bambi.snowrabbit.org>
Date: Thu, 26 Nov 2026 02:50:39 +0900 (JST)
From: Showta Ishizaki <zakinko@snowrabbit.org>
To: gnats-bugs@NetBSD.org
Cc: zakinko@snowrabbit.org
Subject: bin/: incremental dump of a byte-swapped FFS leaves out changed files
X-Send-Pr-Version: 3.95
X-From4GNATS: "Showta Ishizaki via gnats" <gnats-admin@NetBSD.org>
>Number: 61077
>Category: bin
>Synopsis: incremental dump of a byte-swapped FFS leaves out changed files
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 25 17:55:00 +0000 2026
>Originator: Showta Ishizaki
>Release: NetBSD 11.1, also trunk of 2026-11-25
>Organization:
>Environment:
System: NetBSD 11.1 amd64
Architecture: x86_64
Machine: amd64
>Description:
An incremental dump of a file system of the other byte order does not
dump the files which have changed. c_date and c_ddate in the header are
64 bits wide, but main.c and itime.c swap them with iswap32().
traverse.c compares the times of the files with the 64-bit swap of the
result, which is far in the future. The dates on the tape are wrong too,
restore prints (null) for them.
>How-To-Repeat:
On NetBSD 11.1 amd64:
# vnconfig vnd0 be.img
# newfs -I -O 1 -B be /dev/rvnd0d
# mount /dev/vnd0d /mnt; echo x > /mnt/new; umount /mnt
# dump -1 -a -T "Wed Jan 1 00:00:00 2025" -f d1 /dev/rvnd0d
# restore -tf d1
Level 1 dump of an unlisted file system on techne.fml.org:/dev/rvnd0d
Label: none
Dump date: (null)Dumped from: (null) 2 .
With -B le the same gives
Dump date: Wed Nov 25 17:48:31 2026
Dumped from: Wed Jan 1 00:00:00 2025
2 .
3 ./new
>Fix:
The change below has dump treat the dates as 64 bits throughout. On
trunk of 2026-11-25, in a VM with its clock at 2030, the file is dumped
with it and not without it, and nothing changes for a file system of the
native byte order.
--- sbin/dump/itime.c
+++ sbin/dump/itime.c
@@ -156,9 +156,9 @@ getdumptime(void)
(trueinc && (ddp->dd_level > level))) */
if (!trueinc && (ddp->dd_level >= level))
continue;
- if (ddp->dd_ddate <= iswap32(spcl.c_ddate))
+ if (ddp->dd_ddate <= (time_t)iswap64(spcl.c_ddate))
continue;
- spcl.c_ddate = iswap32(ddp->dd_ddate);
+ spcl.c_ddate = iswap64(ddp->dd_ddate);
lastlevel = ddp->dd_level;
}
}
@@ -204,7 +204,7 @@ putdumptime(void)
found:
(void) strlcpy(dtwalk->dd_name, fname, sizeof(dtwalk->dd_name));
dtwalk->dd_level = level;
- dtwalk->dd_ddate = iswap32(spcl.c_date);
+ dtwalk->dd_ddate = iswap64(spcl.c_date);
dtfound = dtwalk;
ITITERATE(i, dtwalk) {
--- sbin/dump/main.c
+++ sbin/dump/main.c
@@ -528,15 +528,15 @@ main(int argc, char *argv[])
/* true incremental is always a level 10 dump */
spcl.c_level = trueinc? iswap32(10): iswap32(level - '0');
spcl.c_type = iswap32(TS_TAPE);
- spcl.c_date = iswap32(spcl.c_date);
- spcl.c_ddate = iswap32(spcl.c_ddate);
+ spcl.c_date = iswap64(spcl.c_date);
+ spcl.c_ddate = iswap64(spcl.c_ddate);
if (!Tflag)
getdumptime(); /* /etc/dumpdates snarfed */
- date = iswap32(spcl.c_date);
+ date = iswap64(spcl.c_date);
msg("Date of this level %c dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&date));
- date = iswap32(spcl.c_ddate);
+ date = iswap64(spcl.c_ddate);
msg("Date of last level %c dump: %s", lastlevel,
spcl.c_ddate == 0 ? "the epoch\n" : ctime(&date));
msg("Dumping ");
@@ -694,7 +694,7 @@ main(int argc, char *argv[])
(long long)iswap64(spcl.c_tapea), iswap32(spcl.c_volume),
(iswap32(spcl.c_volume) == 1) ? "" : "s");
tnow = do_stats();
- date = iswap32(spcl.c_date);
+ date = iswap64(spcl.c_date);
msg("Date of this level %c dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&date));
msg("Date this dump completed: %s", ctime(&tnow));
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.