ports/62655: [patch] Preserve and reinstall the old database file if fetching the new one fails
Ion-Mihai Tetcu
itetcu at apropo.ro
Tue Feb 10 18:20:15 UTC 2004
>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 at 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:
More information about the freebsd-ports-bugs
mailing list