NetBSD Problem Report #25439
Received: (qmail 24924 invoked by uid 605); 2 May 2004 22:44:50 -0000
Message-Id: <20040502210541.A9B75ABD1A@kurtz.klockrike.net>
Date: Sun, 2 May 2004 23:05:41 +0200 (CEST)
From: mer@klockrike.net
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: mer@klockrike.net
To: gnats-bugs@gnats.NetBSD.org
Cc: mer@klockrike.net
Subject: mtools creates malformed long file name directory entries
X-Send-Pr-Version: 3.95
>Number: 25439
>Category: pkg
>Synopsis: mtools creates malformed long file name directory entries
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: is
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 02 22:45:00 +0000 2004
>Closed-Date: Mon Oct 23 12:15:26 +0000 2006
>Last-Modified: Mon Oct 23 12:15:26 +0000 2006
>Originator: Michael Eriksson
>Release: NetBSD 1.6ZK
>Organization:
>Environment:
System: NetBSD kurtz 1.6ZK NetBSD 1.6ZK (KURTZ) #0: Sun Feb 22 12:53:04 CET 2004 mer@killy:/usr/src/sys/arch/i386/compile/KURTZ i386
Architecture: i386
Machine: i386
>Description:
There is a fencepost error in mtools's handling of long file names.
When the file name is 13 characters, or an even multiple thereof, an
extra (empty) directory entry is created. This isn't necessarily
completely incorrect (I haven't read the specification), but at least
it's unnecessary and it also confuses my iRiver iFP-390T flash-based
MP3 player enough that it won't find the file.
>How-To-Repeat:
Copy a music file to an iRiver iFP-390T, using a 13 character file
name:
datan$ mcopy foo.mp3 f:abcdefghi.mp3
Then watch the MP3 player fail to play the file. For closer
examination, hex dump the root directory and see that the long file
name looks strange, with an extra empty 32-byte directory entry.
>Fix:
Here's a patch that corrects the computation of the number of
directory entries needed:
--- vfat.c.orig 2002-11-05 00:02:00.000000000 +0100
+++ vfat.c 2004-04-30 15:58:30.000000000 +0200
@@ -238,7 +238,7 @@
printf("Wrote checksum=%d for shortname %s.\n",
vse->sum,shortname);
#endif
- num_vses = strlen(longname)/VSE_NAMELEN + 1;
+ num_vses = (strlen(longname) + VSE_NAMELEN - 1)/VSE_NAMELEN;
for (vse_id = num_vses; vse_id; --vse_id) {
int end = 0;
--- mk_direntry.c.orig 2002-05-01 12:17:50.000000000 +0200
+++ mk_direntry.c 2004-04-30 16:09:55.000000000 +0200
@@ -227,7 +227,8 @@
s->free_end = s->got_slots = s->free_start = 0;
if (use_longname & 1)
- s->size_needed = 2 + (strlen(longname)/VSE_NAMELEN);
+ s->size_needed = 1 +
+ (strlen(longname) + VSE_NAMELEN - 1)/VSE_NAMELEN;
else
s->size_needed = 1;
}
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->is
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Thu, 17 Mar 2005 15:42:22 +0000
Responsible-Changed-Why:
Over to maintainer.
From: Ignatios Souvatzis <is@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/25439 CVS commit: pkgsrc/sysutils/mtools
Date: Fri, 13 Oct 2006 13:04:31 +0000 (UTC)
Module Name: pkgsrc
Committed By: is
Date: Fri Oct 13 13:04:31 UTC 2006
Modified Files:
pkgsrc/sysutils/mtools: distinfo
Added Files:
pkgsrc/sysutils/mtools/patches: patch-ai patch-aj
Log Message:
Fix fencepost error when the filename length is N*13 characters.
Contributed by Michael Eriksson in PR 25439; reviewed by Joerg
Sonnenberger.
To generate a diff of this commit:
cvs rdiff -r1.10 -r1.11 pkgsrc/sysutils/mtools/distinfo
cvs rdiff -r0 -r1.1 pkgsrc/sysutils/mtools/patches/patch-ai \
pkgsrc/sysutils/mtools/patches/patch-aj
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: is@netbsd.org
State-Changed-When: Fri, 13 Oct 2006 13:06:59 +0000
State-Changed-Why:
Patch applied; please re-check that the package from pkgsrc-current works
with your device.
From: Michael Eriksson <mer@klockrike.net>
To: gnats-bugs@NetBSD.org
Cc: is@NetBSD.org
Subject: Re: pkg/25439 (mtools creates malformed long file name directory entries)
Date: Mon, 23 Oct 2006 14:00:11 +0200
On Fri, Oct 13, 2006 at 01:07:00PM +0000, is@netbsd.org wrote:
> Synopsis: mtools creates malformed long file name directory entries
>
> State-Changed-From-To: open->feedback
> State-Changed-By: is@netbsd.org
> State-Changed-When: Fri, 13 Oct 2006 13:06:59 +0000
> State-Changed-Why:
> Patch applied; please re-check that the package from pkgsrc-current works
> with your device.
It works perfectly, thanks!
/Micke
State-Changed-From-To: feedback->closed
State-Changed-By: is@netbsd.org
State-Changed-When: Mon, 23 Oct 2006 12:15:26 +0000
State-Changed-Why:
Fix verified by submitter.
>Unformatted:
(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.