NetBSD Problem Report #57752
From tsutsui@ceres.dti.ne.jp Tue Dec 5 13:04:37 2023
Return-Path: <tsutsui@ceres.dti.ne.jp>
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))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 445191A9238
for <gnats-bugs@gnats.NetBSD.org>; Tue, 5 Dec 2023 13:04:37 +0000 (UTC)
Message-Id: <202312051304.3B5D4TJv021214@ceres.dti.ne.jp>
Date: Tue, 5 Dec 2023 22:04:29 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: makefs(8) -t msdos doesn't return EXIT_FAILUER on some errors
X-Send-Pr-Version: 3.95
>Number: 57752
>Category: bin
>Synopsis: makefs(8) -t msdos doesn't return EXIT_FAILUER on some errors
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 05 13:05:01 +0000 2023
>Closed-Date: Sun Dec 31 19:44:30 +0000 2023
>Last-Modified: Sun Dec 31 19:44:30 +0000 2023
>Originator: Izumi Tsutsui
>Release: NetBSD 10.0_RC1
>Organization:
>Environment:
System: NetBSD mirage 10.0_RC1 NetBSD 10.0_RC1 (GENERIC) #0: Sun Nov 5 18:30:08 UTC 2023 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386, but maybe all
Machine: i386
>Description:
makefs(8) -t msdos returns EXIT_SUCESS even on some errors
so script cannot handle error case.
>How-To-Repeat:
---
% makefs -t msdos -M 16384 -m 16384 test.fs test || echo failed
Creating `test.fs'
makefs: meta data exceeds file system size
% makefs -t msdos -M 16384 -m 16384 test.fs test && echo success
Creating `test.fs'
makefs: meta data exceeds file system size
success
% makefs -t msdos -M 32768 -m 32768 -o fat_type=32 test.fs test || echo failed
Creating `test.fs'
makefs: 15 clusters too few clusters for FAT32, need 65525
% makefs -t msdos -M 32768 -m 32768 -o fat_type=32 test.fs test && echo success
Creating `test.fs'
makefs: 15 clusters too few clusters for FAT32, need 65525
success
%
---
>Fix:
Replace "return;" after mkfs_msdos() in src/usr.sbin/makefs/msdos.c
with err(3) etc?
https://github.com/NetBSD/src/blob/3bcce0b/usr.sbin/makefs/msdos.c#L179-L180
---
printf("Creating `%s'\n", image);
TIMER_START(start);
if (mkfs_msdos(image, NULL, &msdos_opt->options) == -1)
return;
TIMER_RESULTS(start, "mkfs_msdos");
---
Izumi Tsutsui
>Release-Note:
>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: bin/57752: makefs(8) -t msdos doesn't return EXIT_FAILUER on some
errors
Date: Sat, 9 Dec 2023 02:10:31 +0900
> >Synopsis: makefs(8) -t msdos doesn't return EXIT_FAILUER on some errors
:
> >Fix:
> Replace "return;" after mkfs_msdos() in src/usr.sbin/makefs/msdos.c
> with err(3) etc?
Here is a quick patch (messages are taken from ffs.c):
Index: msdos.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/msdos.c,v
retrieving revision 1.21
diff -u -p -d -r1.21 msdos.c
--- msdos.c 9 Apr 2022 10:05:35 -0000 1.21
+++ msdos.c 8 Dec 2023 16:30:06 -0000
@@ -177,7 +177,7 @@ msdos_makefs(const char *image, const ch
printf("Creating `%s'\n", image);
TIMER_START(start);
if (mkfs_msdos(image, NULL, &msdos_opt->options) == -1)
- return;
+ errx(1, "Image file `%s' not created.", image);
TIMER_RESULTS(start, "mkfs_msdos");
fsopts->fd = open(image, O_RDWR);
@@ -201,7 +201,7 @@ msdos_makefs(const char *image, const ch
printf("Populating `%s'\n", image);
TIMER_START(start);
if (msdos_populate_dir(dir, VTODE(&rootvp), root, root, fsopts) == -1)
- errx(1, "Image file `%s' not created.", image);
+ errx(1, "Image file `%s' not populated.", image);
TIMER_RESULTS(start, "msdos_populate_dir");
if (debug & DEBUG_FS_MAKEFS)
---
Izumi Tsutsui
From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57752 CVS commit: src/usr.sbin/makefs
Date: Wed, 20 Dec 2023 15:07:16 +0000
Module Name: src
Committed By: tsutsui
Date: Wed Dec 20 15:07:16 UTC 2023
Modified Files:
src/usr.sbin/makefs: msdos.c
Log Message:
Return a proper exit status on failure on creating msdosfs.
No particular comment in PR bin/57752.
Should be pulled up to netbsd-10 and netbsd-9.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/msdos.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57752 CVS commit: [netbsd-10] src/usr.sbin/makefs
Date: Sat, 30 Dec 2023 19:16:00 +0000
Module Name: src
Committed By: martin
Date: Sat Dec 30 19:15:59 UTC 2023
Modified Files:
src/usr.sbin/makefs [netbsd-10]: msdos.c
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #522):
usr.sbin/makefs/msdos.c: revision 1.22
Return a proper exit status on failure on creating msdosfs.
No particular comment in PR bin/57752.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.2.1 src/usr.sbin/makefs/msdos.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57752 CVS commit: [netbsd-9] src/usr.sbin/makefs
Date: Sat, 30 Dec 2023 19:17:07 +0000
Module Name: src
Committed By: martin
Date: Sat Dec 30 19:17:07 UTC 2023
Modified Files:
src/usr.sbin/makefs [netbsd-9]: msdos.c
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1783):
usr.sbin/makefs/msdos.c: revision 1.22
Return a proper exit status on failure on creating msdosfs.
No particular comment in PR bin/57752.
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.14.1 src/usr.sbin/makefs/msdos.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->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 31 Dec 2023 19:44:30 +0000
State-Changed-Why:
Fixed and pulled up to netbsd-10 and netbsd-9.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.