NetBSD Problem Report #58119

From www@netbsd.org  Sat Apr  6 12:29:53 2024
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2015E1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  6 Apr 2024 12:29:53 +0000 (UTC)
Message-Id: <20240406122952.158B91A923C@mollari.NetBSD.org>
Date: Sat,  6 Apr 2024 12:29:52 +0000 (UTC)
From: hashikaw@mail.ru
Reply-To: hashikaw@mail.ru
To: gnats-bugs@NetBSD.org
Subject: After system crash at running archiving libraries (ar) on -o log filesystem, remain libfoo.a at next reboot
X-Send-Pr-Version: www-1.0

>Number:         58119
>Category:       lib
>Synopsis:       After system crash at running archiving libraries (ar) on -o log filesystem, remain libfoo.a at next reboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 06 12:30:01 +0000 2024
>Originator:     Kouichi Hashikawa
>Release:        NetBSD-current, 10
>Organization:
>Environment:
>Description:
After system crash at running ar(1) on filesystem mounted -o log,
at next boot, remain libfoo.a on the filesystem,
then skip ar libfoo.a at next build.sh.
User must remove libfoo.a by hand before next build.sh.

% ls -alrt
...
-rw-r--r--  1 hashikaw  hashikaw        8 Apr  6 20:47 libdns.a <---
drwxr-xr-x  2 hashikaw  hashikaw     4096 Apr  6 20:47 .
-rw-------  1 hashikaw  hashikaw  2031624 Apr  6 20:47 stkUBdTp
% 

>How-To-Repeat:

>Fix:
I think run ar like gcc -shared.

--- bsd.lib.mk-138922	2023-12-01 12:32:41.509694122 +0900
+++ bsd.lib.mk	2024-04-06 21:19:15.174932221 +0900
@@ -542,7 +542,8 @@
 __archivebuild: .USE
 	${_MKTARGET_BUILD}
 	@rm -f ${.TARGET}
-	${AR} ${_ARFL} ${.TARGET} $$(NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT})
+	${AR} ${_ARFL} ${.TARGET}.tmp $$(NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}) && \
+		${MV} ${.TARGET}.tmp ${.TARGET}
 .endif

 .if !target(__archiveinstall)

NetBSD Home
NetBSD PR Database Search

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