NetBSD Problem Report #60801

From www@netbsd.org  Sat Sep 26 15:06:00 2026
Return-Path: <www@netbsd.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 AAB611A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Sep 2026 15:06:00 +0000 (UTC)
Message-Id: <20260926150559.5F5491A923E@mollari.NetBSD.org>
Date: Sat, 26 Sep 2026 15:05:59 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: confusion of ctime with birthtime
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60801
>Category:       kern
>Synopsis:       confusion of ctime with birthtime
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 26 15:10:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Fri Oct 02 03:43:04 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, ...
>Organization:
The NetHFS+ Foundabug, Inctime.
>Environment:
>Description:

	[x] hfs
	[x] msdosfs
	[ ] ...others?

	hfs reports `date_created' as ctime, and doesn't report
	birthtime:

    612 		hfs_time_to_timespec(f->date_created, &vap->va_ctime);
    613 		hfs_time_to_timespec(f->date_content_mod, &vap->va_mtime);
    614 		hfs_time_to_timespec(f->date_accessed, &vap->va_atime);

	https://nxr.netbsd.org/xref/src/sys/fs/hfs/hfs_vnops.c?r=1.40#612

	(Likewise for directories.)

	But presumably `date_created' is supposed to mean birthtime,
	not file attribute change time, i.e., ctime.  These appear to
	be recorded separately in HFS:

    363 	uint32_t		date_created;
    364 	uint32_t		date_content_mod;
    365 	uint32_t		date_attrib_mod;
    366 	uint32_t		date_accessed;
    367 	uint32_t		date_backedup;

	https://nxr.netbsd.org/xref/src/sys/fs/hfs/libhfs.h?r=1.9#363

	msdosfs reports `deCTime' (`create time') as ctime, and doesn't
	report birthtime:

    295 		msdosfs_dos2unixtime(dep->de_CDate, dep->de_CTime, dep->de_CHun,
    296 		    pmp->pm_gmtoff, &vap->va_ctime);

	https://nxr.netbsd.org/xref/src/sys/fs/msdosfs/msdosfs_vnops.c?r=1.113#295

     71 	uint8_t		deCTime[2];	/* create time */
     72 	uint8_t		deCDate[2];	/* create date */
     73 	uint8_t		deADate[2];	/* access date */

	https://nxr.netbsd.org/xref/src/sys/fs/msdosfs/direntry.h?r=1.12#71

>How-To-Repeat:

	code inspection

>Fix:

	Yes, please!

>Release-Note:

>Audit-Trail:

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60801 CVS commit: src/tests/fs/vfs
Date: Sat, 26 Sep 2026 22:02:30 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat Sep 26 22:02:30 UTC 2026

 Modified Files:
 	src/tests/fs/vfs: t_vnops.c

 Log Message:
 t_vnops: Verify ctime changes but birthtime doesn't.

 PR kern/60800: missing ctime updates
 PR kern/60801: confusion of ctime with birthtime


 To generate a diff of this commit:
 cvs rdiff -u -r1.68 -r1.69 src/tests/fs/vfs/t_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60801 CVS commit: src/sys/fs/hfs
Date: Sat, 26 Sep 2026 22:04:34 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat Sep 26 22:04:34 UTC 2026

 Modified Files:
 	src/sys/fs/hfs: hfs_vnops.c

 Log Message:
 hfs: Stop confusing birthtime and ctime.

 XXX Need some automatic tests for hfs!

 PR kern/60801: confusion of ctime with birthtime


 To generate a diff of this commit:
 cvs rdiff -u -r1.40 -r1.41 src/sys/fs/hfs/hfs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60801 CVS commit: src/sys/fs/msdosfs
Date: Sat, 26 Sep 2026 22:04:55 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat Sep 26 22:04:55 UTC 2026

 Modified Files:
 	src/sys/fs/msdosfs: msdosfs_vnops.c

 Log Message:
 msdosfs: Stop confusing birthtime and ctime.

 PR kern/60801: confusion of ctime with birthtime


 To generate a diff of this commit:
 cvs rdiff -u -r1.113 -r1.114 src/sys/fs/msdosfs/msdosfs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 02 Oct 2026 03:43:04 +0000
State-Changed-Why:
msdos and hfs fixed in HEAD, needs pullup-11 and pullup-10

...then back to open if we want to audit other file systems

...and while I'm sympathetic to the proposition that birthtime was a
mistake, perhaps we should have a separate PR for removing it


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.