🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3185

Bug#1152980: fsck.cpm: an SFCB's first slot's date stamps are read crosswise

#3185
From: Jefferson Hunt
Date: Tue, 03 Nov 2026 23:40
157 lines
10168 bytes
--Apple-Mail=_E2FF1CE8-802F-4B46-A268-F76F98134EC7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Package: cpmtools
Version: 2.23-4

Hello,

fsck.cpm 2.23 reads the date stamps of the first file entry in each =
four-entry group (an SFCB's first slot) with the low bytes of the two =
day counts swapped. So an entry there that was created on one day and =
updated on a later day gets a false warning:

  Warning: Modification date earlier than creation date (extent=3D7/4)

And an entry whose stamps really are in the wrong order gets no warning =
at all. The second and third slots, and the directory label, are read =
correctly.

The cause, in fsck.cpm.c (lines 313-314 in 2.23):

  =
created=3D(dir->name[4]+(dir->name[1]<<8))*(0x60*0x60)+dir->name[2]*0x60+d=
ir->name[3];
  =
modified=3D(dir->name[0]+(dir->name[5]<<8))*(0x60*0x60)+dir->name[6]*0x60+=
dir->name[7];

The first slot's creation stamp is bytes 1-4 of the SFCB (name[0..3]), =
and its update stamp is bytes 5-8 (name[4..7]), each one a two-byte day =
count with the low byte first, then the hour and the minute. The day=E2=80=
=99s low byte is taken from the other stamp: name[4] where name[0] =
belongs, and name[0] where name[4] belongs. The second and third slots' =
lines, just below, read their bytes in order.

The fix:

     --- a/fsck.cpm.c
     +++ b/fsck.cpm.c
     @@ -310,8 +310,8 @@
              bcdCheck(dir->name[3],60,sb->cnotatime ? "creation date" : =
"access date","minute",extent,extent2);
              bcdCheck(dir->name[6],24,"modification =
date","hour",extent,extent2);
              bcdCheck(dir->name[7],60,"modification =
date","minute",extent,extent2);
     -        =
created=3D(dir->name[4]+(dir->name[1]<<8))*(0x60*0x60)+dir->name[2]*0x60+d=
ir->name[3];
     -        =
modified=3D(dir->name[0]+(dir->name[5]<<8))*(0x60*0x60)+dir->name[6]*0x60+=
dir->name[7];
     +        =
created=3D(dir->name[0]+(dir->name[1]<<8))*(0x60*0x60)+dir->name[2]*0x60+d=
ir->name[3];
     +        =
modified=3D(dir->name[4]+(dir->name[5]<<8))*(0x60*0x60)+dir->name[6]*0x60+=
dir->name[7];
              if (sb->cnotatime && modified<created)
              {
                printf("Warning: Modification date earlier than creation =
date (extent=3D%d/%d)\n",extent,extent2);

What it prints, and what it should print:

   updated later:  warns of entry 4 (the first slot)   should be clean
   updated backwards:  warns of entry 5 (the second slot) only  should =
warn of 4 and 5

With the patch, it does what it should.

Thank you for cpmtools: we use it to check that our CP/M 3 file system =
reads and writes the same disks Linux does.

Jefferson Hunt=

--Apple-Mail=_E2FF1CE8-802F-4B46-A268-F76F98134EC7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" =
content=3D"text/html; charset=3Dutf-8"></head><body =
style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;"><div>Package: =
cpmtools</div><div>Version: =
2.23-4</div><div><br></div><div>Hello,</div><div><br></div><div>fsck.cpm =
2.23 reads the date stamps of the first file entry in each four-entry =
group (an SFCB's first slot) with the low bytes of the two day counts =
swapped. So an entry there that was created on one day and updated on a =
later day gets a false warning:</div><div><br></div><div><font =
face=3D"Menlo">&nbsp; Warning: Modification date earlier than creation =
date (extent=3D7/4)</font></div><div><br></div><div>And an entry whose =
stamps really are in the wrong order gets no warning at all. The second =
and third slots, and the directory label, are read =
correctly.</div><div><br></div><div>The cause, in fsck.cpm.c (lines =
313-314 in 2.23):</div><div><br></div><div><font face=3D"Menlo">&nbsp; =
created=3D(dir-&gt;name[4]+(dir-&gt;name[1]&lt;&lt;8))*(0x60*0x60)+dir-&gt=
;name[2]*0x60+dir-&gt;name[3];</font></div><div><font =
face=3D"Menlo">&nbsp; =
modified=3D(dir-&gt;name[0]+(dir-&gt;name[5]&lt;&lt;8))*(0x60*0x60)+dir-&g=
t;name[6]*0x60+dir-&gt;name[7];</font></div><div><br></div><div>The =
first slot's creation stamp is bytes 1-4 of the SFCB (name[0..3]), and =
its update stamp is bytes 5-8 (name[4..7]), each one a two-byte day =
count with the low byte first, then the hour and the minute. The day=E2=80=
=99s low byte is taken from the other stamp: name[4] where name[0] =
belongs, and name[0] where name[4] belongs. The second and third slots' =
lines, just below, read their bytes in =
order.</div><div><br></div><div>The fix:</div><div><font =
face=3D"Menlo"><br></font></div><div><div><div><font face=3D"Menlo">&nbsp;=
 &nbsp; &nbsp;--- a/fsck.cpm.c</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp;+++ =
b/fsck.cpm.c</font></div><div><font face=3D"Menlo">&nbsp; &nbsp; =
&nbsp;@@ -310,8 +310,8 @@</font></div><div><font face=3D"Menlo">&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
bcdCheck(dir-&gt;name[3],60,sb-&gt;cnotatime ? "creation date" : "access =
date","minute",extent,extent2);</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
bcdCheck(dir-&gt;name[6],24,"modification =
date","hour",extent,extent2);</font></div><div><font face=3D"Menlo">&nbsp;=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
bcdCheck(dir-&gt;name[7],60,"modification =
date","minute",extent,extent2);</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; &nbsp; =
&nbsp;created=3D(dir-&gt;name[4]+(dir-&gt;name[1]&lt;&lt;8))*(0x60*0x60)+d=
ir-&gt;name[2]*0x60+dir-&gt;name[3];</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; &nbsp; =
&nbsp;modified=3D(dir-&gt;name[0]+(dir-&gt;name[5]&lt;&lt;8))*(0x60*0x60)+=
dir-&gt;name[6]*0x60+dir-&gt;name[7];</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp;+ &nbsp; &nbsp; &nbsp; =
&nbsp;created=3D(dir-&gt;name[0]+(dir-&gt;name[1]&lt;&lt;8))*(0x60*0x60)+d=
ir-&gt;name[2]*0x60+dir-&gt;name[3];</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp;+ &nbsp; &nbsp; &nbsp; =
&nbsp;modified=3D(dir-&gt;name[4]+(dir-&gt;name[5]&lt;&lt;8))*(0x60*0x60)+=
dir-&gt;name[6]*0x60+dir-&gt;name[7];</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if =
(sb-&gt;cnotatime &amp;&amp; modified&lt;created)</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
{</font></div><div><font face=3D"Menlo">&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; printf("Warning: Modification date earlier =
than creation date =
(extent=3D%d/%d)\n",extent,extent2);</font></div></div><div><br></div></di=
v><div><div>What it prints, and what it should =
print:</div><div><br></div><div><font face=3D"Menlo">&nbsp; =
&nbsp;updated later:&nbsp;&nbsp;warns of entry 4 (the first =
slot)&nbsp;&nbsp; should be clean</font></div><div><font =
face=3D"Menlo">&nbsp; &nbsp;updated backwards: &nbsp;warns of entry 5 =
(the second slot) only &nbsp;should warn of 4 and =
5</font></div><div><br></div><div>With the patch, it does what it =
should.</div><div><br></div><div>Thank you for cpmtools: we use it to =
check that our CP/M 3 file system reads and writes the same disks Linux =
does.</div><div><br></div><div>Jefferson Hunt</div></div></body></html>=

--Apple-Mail=_E2FF1CE8-802F-4B46-A268-F76F98134EC7--
Technical Details
Message-ID: <NVwgF-9H0e-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Jefferson Hunt <jeffersonjhunt@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1152980: fsck.cpm: an SFCB's first slot's date stamps are read crosswise
Date: Wed, 04 Nov 2026 00:40:01 +0100
Message-ID: <NVwgF-9H0e-5@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Tue Nov  3 23:31:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.546
Reply-To: Jefferson Hunt <jeffersonjhunt@gmail.com>, 1152980@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: bdale@gag.com
X-Debian-Pr-Message: report 1152980
X-Debian-Pr-Package: cpmtools
X-Debian-Pr-Source: cpmtools
X-Gm-Message-State: APuU4Z8awg0eP/btQxSxX0ySWx+83ruWgqQgA+K1eDuAKyd/SU7XskDy
	mucpJD+G2/yATNsvPX2xzWY8HAUfodxrBa+WZtwUky2u0qDrdlUrdJa/GmqLRQ==
X-Gm-Gg: AYBFou3LsJDVCQHQedczaibEWMYb7RU2m8rGzKSBJOrN5JpQRyG2XUpEVnlhtcXmyWm
	ywJPHc3rpC0TGTd0cJiruTXDtZoizXKa4tKOl/uU+RpvkK8V5Drc5sFHTCMODnlKj2yksSIJd9e
	99OAF4k14oXQNRIGPpnJHI3g+d0sqIJGDkMTc4S+PFBpFckMHQp0yTZIzuF2+Wp/HTYG3rY6YqQ
	pJL+LjGguMgaXyIWBUSDvNp32iQ6d35t8dQ3Byf4+9+pztzG7CzvJD9QlVHfpcaBVtspNAMR40x
	bu45mnO08QHX52sClcbvLc2bMWJHnNO8vii6vyXpeB8Chl1ES/16sfG5gzHmJ08bm0FASco7ZTu
	nk4EUHnrhgq+/RcVP0dwpfeXu9Qmt2IrBdsnZ+TqlQ1jV6qA1wpRSGoqVDFXSKUu4BUyvsC61gk
	Lilkam8N6f07p6DJTu8DwzaJ83AmTrPmCtiByD9VRe2MqX9SLkVrbVZqHm8grK4Ct7QnbUnXisZ
	X3lppDyU6nurLi7ljANMcfNibZBluMXBHa1T0ecAChOqnIGb6Y4s1ikw0Xb2fVTOG0vNitrskdr
	soing2NX9NsJQOTjYMffiv6J5PlTAUcA/+gi06xK3yo0dJ55pPQuKt84VOIBsWetBHvY33ybZIu
	KEHc=
X-Received: by 2002:a05:6808:c410:b0:53a:2f73:29ff with SMTP id 5614622812f47-5640db02050mr9858170b6e.6.1793748561471;
        Tue, 03 Nov 2026 15:29:21 -0800 (PST)
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_E2FF1CE8-802F-4B46-A268-F76F98134EC7"
MIME-Version: 1.0 (Mac OS X Mail 16.0 \(3901.200.71.1.16\))
X-Mailer: Apple Mail (2.3901.200.71.1.16)
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2000532
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 157
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: submit@bugs.debian.org
X-Original-Date: Tue, 3 Nov 2026 17:29:10 -0600
X-Original-Message-ID: <15BB1756-0ED2-4402-A793-9F3F204B1A45@gmail.com>