ports/141188: freebsd-snapshot does not report all errors
Anselm Strauss
amsibamsi at gmail.com
Sat Dec 5 11:20:02 UTC 2009
>Number: 141188
>Category: ports
>Synopsis: freebsd-snapshot does not report all errors
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Dec 05 11:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Anselm Strauss
>Release: 8.0
>Organization:
-
>Environment:
FreeBSD hulk.l.ttyv0.net 8.0-RELEASE FreeBSD 8.0-RELEASE #1: Fri Dec 4 00:20:25 CET 2009 root at hulk.l.ttyv0.net:/usr/obj/usr/src/sys/CUSTOM amd64
>Description:
Port: freebsd-snapshot
The commands snapshot and periodic-snapshot both return 0 and very few to no error messages in some cases when there was clearly an error and the requested operation did not succeed.
>How-To-Repeat:
Do not have a concrete case, just looked at the code ...
>Fix:
Insert some checks of return codes and log messages.
One case I did not catch: When zfs_enable is set to NO but zfs file systems were configured by hand. "snapshot make" will run silently even though no snapshot was made.
Patch attached with submission follows:
*** snapshot.orig Fri Dec 4 19:24:06 2009
--- snapshot Sat Dec 5 10:54:53 2009
***************
*** 311,316 ****
--- 312,321 ----
# create new snapshot
system zfs snapshot "$fs_name@$fs_tag.$fs_gen"
+ if [ $? -ne 0 ]; then
+ echo "snapshot:ERROR: making ZFS snapshot failed" 1>&2
+ exit 1
+ fi
fi
else
# UFS filesystem
***************
*** 353,358 ****
--- 358,367 ----
# create new snapshot
system mount -u -o snapshot $fs_dir/.snap/$fs_tag.$fs_gen $fs_dir
+ if [ $? -ne 0 ]; then
+ echo "snapshot:ERROR: making UFS snapshot failed" 1>&2
+ exit 1
+ fi
fi
fi
***************
*** 537,542 ****
--- 546,555 ----
if [ ".`echo $src | fgrep /.zfs/snapshot/`" != . ]; then
# unmount implicitly mounted ZFS snapshot directory
umount $src
+ if [ $? -ne 0 ]; then
+ echo "snapshot:ERROR: unmounting snapshot failed" 1>&2
+ exit 1
+ fi
fi
return 0
*** periodic-snapshot.orig Fri Dec 4 20:13:06 2009
--- periodic-snapshot Sat Dec 5 10:45:35 2009
***************
*** 120,125 ****
--- 120,130 ----
lockf -s -t 0 $fs/.snapshot.lock \
snapshot make -g$when $fs:$time_tag.0
time_end=`date '+%s'`
+ if [ "$?" -ne 0 ]; then
+ logger -p daemon.error \
+ "snapshot: making snapshot on $fs failed"
+ exit 1
+ fi
duration=$((($time_end - $time_start) / 60))
logger -p daemon.notice \
"snapshot: $time_tag.0 snapshot on filesystem $fs made (duration: $duration min)"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list