Date: Tue, 10 Feb 2004 20:14:08 +0200 From: "Ion-Mihai Tetcu" <itetcu@apropo.ro> To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org> Cc: eik@FreeBSD.org Subject: ports/62655: [patch] Preserve and reinstall the old database file if fetching the new one fails Message-ID: <1076436848.0@it.buh.cameradicommercio.ro> Resent-Message-ID: <200402101820.i1AIKF4x011574@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1076436848.0>