From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Feb 10 10:20:15 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 568E116A4D0 for ; Tue, 10 Feb 2004 10:20:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3601343D39 for ; Tue, 10 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1AIKFbv011575 for ; Tue, 10 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1AIKF4x011574; Tue, 10 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats) Resent-Date: Tue, 10 Feb 2004 10:20:15 -0800 (PST) Resent-Message-Id: <200402101820.i1AIKF4x011574@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Ion-Mihai Tetcu" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B06416A4D1 for ; Tue, 10 Feb 2004 10:13:34 -0800 (PST) Received: from rdsnet.ro (smtp.rdsnet.ro [62.231.74.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F8F843D2F for ; Tue, 10 Feb 2004 10:13:33 -0800 (PST) (envelope-from itetcu@apropo.ro) Received: (qmail 21238 invoked from network); 10 Feb 2004 18:12:25 -0000 Received: from unknown (HELO it.buh.cameradicommercio.ro) (81.196.25.19) by mail.rdsnet.ro with SMTP; 10 Feb 2004 18:12:25 -0000 Received: from it.buh.cameradicommercio.ro (localhost.buh.cameradicommercio.ro [127.0.0.1]) by it.buh.cameradicommercio.ro (Postfix) with ESMTP id 30FF121; Tue, 10 Feb 2004 20:14:08 +0200 (EET) Message-Id: <1076436848.0@it.buh.cameradicommercio.ro> Date: Tue, 10 Feb 2004 20:14:08 +0200 From: "Ion-Mihai Tetcu" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.3.2 cc: eik@FreeBSD.org Subject: ports/62655: [patch] Preserve and reinstall the old database file if fetching the new one fails X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2004 18:20:15 -0000 >Number: 62655 >Category: ports >Synopsis: [patch] Preserve and reinstall the old database file if fetching the new one fails >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 10 10:20:14 PST 2004 >Closed-Date: >Last-Modified: >Originator: Ion-Mihai Tetcu >Release: FreeBSD 5.2-CURRENT i386 >Organization: Tecnik'93 >Environment: System: FreeBSD it.buh.cameradicommercio.ro 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Mon Jan 26 14:24:42 EET 2004 itetcu@it.buh.cameradicommercio.ro:/usr/obj/usr/src/sys/ULE1 i386 >Description: People seems to trust fetch(1) but it can fail for various reasons. This patch preservers the old audit database and restores it if fetch fails, as having an old file is better that none. >How-To-Repeat: >Fix: --- fetchaudit.sh.diff begins here --- --- files/fetchaudit.sh.orig Tue Feb 10 19:43:31 2004 +++ files/fetchaudit.sh Tue Feb 10 20:08:40 2004 @@ -52,15 +52,23 @@ echo "" echo "Updating audit database." cd "${portaudit_dir}" + cp "${portaudit_file}" "${portaudit_file}.old" \ + || echo "Could not back-up ${portaudit_file}" fetch -1am ${LOCATIONS} if [ ! $? ]; then echo "Couldn't fetch database." + echo "Restoring old database file ..." + cp "${portaudit_file}.old" "${portaudit_file}" rc=2 elif [ ! -f "${portaudit_file}" ] ; then echo "no database." + echo "Trying to restore the old database file ..." + cp "${portaudit_file}.old" "${portaudit_file}" rc=2 elif checksum_auditfile; then echo "database corrupt." + echo "Restoring old database file ..." + cp "${portaudit_file}.old" "${portaudit_file}" rc=2 elif checkexpiry_auditfile 7; then echo "database too old." @@ -71,6 +79,7 @@ fi else rc=0 + rm "${portaudit_file}.old" 2>/dev/null fi ;; *) --- fetchaudit.sh.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: