NetBSD Problem Report #241

From gnats  Mon May  2 06:59:09 1994
Received: from aie8.aie.nl (root@aie8.aie.nl [193.78.1.40]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id GAA04559 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 2 May 1994 06:59:02 -0700
Message-Id: <199405021358.PAA00818@aie8.aie.nl>
Date: Mon, 2 May 1994 15:58:42 +0200
From: Steven Reiz <sreiz@aie.nl>
Reply-To: sreiz@aie.nl
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: bug in /usr/bin/mail
X-Send-Pr-Version: 3.2

>Number:         241
>Category:       bin
>Synopsis:       using mail to delete a message may trash the box
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 02 08:35:09 +0000 1994
>Closed-Date:    Fri May 06 18:11:37 +0000 1994
>Last-Modified:  
>Originator:     Steven Reiz
>Release:        NetBSD-current of May, 1
>Organization:
AI Engineering, Amsterdam
>Environment:
486 running NetBSD-current, includefiles, libraries and 
	mail binary up to date, as well as the kernel.
System: NetBSD aie8.aie.nl 0.9a AIE_ALL#0 i386
>Description:
It seems that the routines which write out a mailbox to disk
	are broken, when 1 message out of a list of messages is deleted
	(using /usr/bin/mail), the mailbox that is written back is garbled.
>How-To-Repeat:
With empty /var/mail/sreiz:

$ foreach i ( 1 2 3 4 )
foreach? echo "hallo, body $i" | mail -s "subj $i" sreiz
foreach? end
$ cp /var/mail/sreiz ~/tmp/mbox
$ mail
& d 3
& q
$ diff -w -u ~/tmp/mbox /var/mail/sreiz

It shows that instead of deleting the third message, the mailbox is garbled.
In my case, grep -i subject /var/mail/sreiz gives:
Subject: subj 1
Subject: subj 2
Subject: subj 4
Subject: subj 4
so it seems the fourth message was copied over the third.

>Fix:
unknown. Bug has probably been in NetBSD for a while since a message
	of Apr, 12 (?) in the netbsd mailing list ``hints'' at it.


>Release-Note:
>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jtc
State-Changed-When: Fri May  6 18:11:37 1994
State-Changed-Why:
Added cast to off_t in a macro that used ftruncate.
I confirmed that the change fixes the problem.

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