Bug 129503 - sysutils/freebsd-snapshot [Maintainer Update]
Summary: sysutils/freebsd-snapshot [Maintainer Update]
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Wesley Shields
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-08 16:30 UTC by Graham Todd
Modified: 2008-12-10 20:55 UTC (History)
0 users

See Also:


Attachments
file.diff (126 bytes, patch)
2008-12-08 16:30 UTC, Graham Todd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Todd 2008-12-08 16:30:01 UTC

Report and patch from Wes Morgan.

The new version of ZFS in head defaults to not listing snapshots with "zfs list", which causes a problem with the "freebsd-snapshot" utility.

Fix: The new "zfs list" command requires "-t snapshot"
The fix  adds the correct zfs list command syntax to the existing /usr/local/sbin/snapshot and is backwards compatible.

Fix port by removing existing patch
/usr/ports/sysutils/freebsd-snapshot/files/patch-snapshot

and creating two separate patch files (patch-snapshot and patch-periodic-snapshot) which are attached:



#   make sure system tools are used first
-PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+PATH="/bin:/usr/bin:/sbin:/usr/sbin:%%PREFIX%%/sbin:$PATH"

 #   option defaults
 fs_subdir=".snap"
@@ -271,7 +271,7 @@
         i=19
         k=`expr $maxgen - 1`
         while [ $i -gt $k ]; do
-            if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
+            if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
                 system zfs destroy "$fs_name@$fs_tag.$i"
             fi
             i=`expr $i - 1`
@@ -280,12 +280,12 @@
         if [ $maxgen -gt 0 ]; then
             #   rotate remaining snapshots
             i=$k
-            if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
+            if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
                 system zfs destroy "$fs_name@$fs_tag.$i"
             fi
             i=`expr $i - 1`
             while [ $i -ge $fs_gen ]; do
-                if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
+                if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
                     j=`expr $i + 1`
                     system zfs rename "$fs_name@$fs_tag.$i" "$fs_name@$fs_tag.$j"
                 fi 

--- patch-snapshot ends here -----AO51mbzm6vDea1LQlYWNkVQ0WHq1RVPtkkeVRQfSUMwuoInr
Content-Type: text/plain; name="patch-periodic-snapshot"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="patch-periodic-snapshot"

--- periodic-snapshot.orig      Thu Sep 15 17:44:57 2005
+++ periodic-snapshot   Thu Sep 15 17:46:31 2005
@@ -29,7 +29,7 @@
 ##

 #   make sure system tools are used first
-PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+PATH="/bin:/usr/bin:/sbin:/usr/sbin:%%PREFIX%%/sbin:$PATH"

 #   configuration defaults
 snapshot_enable="NO"
How-To-Repeat: 

Use snapshot tools with new zfs version in current.
Comment 1 Wesley Shields freebsd_committer freebsd_triage 2008-12-08 17:08:52 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wxs

I'll take it.
Comment 2 Wesley Shields freebsd_committer freebsd_triage 2008-12-10 20:55:34 UTC
State Changed
From-To: open->closed

Committed. Thanks!