Bug 203115 - sysutils/zfstools Divide-by-zero in zfs-auto-snapshot when no snapshots exist.
Summary: sysutils/zfstools Divide-by-zero in zfs-auto-snapshot when no snapshots exist.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Bryan Drewery
Depends on:
Reported: 2015-09-15 04:01 UTC by Adrian Waters
Modified: 2015-09-15 15:56 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (bdrewery)


Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Waters 2015-09-15 04:01:12 UTC
When running zfs-auto-snapshot:

$ sudo /usr/local/sbin/zfs-auto-snapshot weekly 4
/usr/local/lib/ruby/site_ruby/2.1/zfstools/snapshot.rb:118:in `/': divided by 0 (ZeroDivisionError)
	from /usr/local/lib/ruby/site_ruby/2.1/zfstools/snapshot.rb:118:in `create_many'
	from /usr/local/lib/ruby/site_ruby/2.1/zfstools.rb:152:in `do_new_snapshots'
	from /usr/local/sbin/zfs-auto-snapshot:68:in `<main>'

Initially I thought that this was because I was running it on a test system, however I also tried creating some snapshots ("zfs snapshot -r zroot@zfs-auto-snap_weekly-2015-09-13-00h00") and "zfs-auto-snapshot weekly 4" still failed with the above error.
Comment 1 Bryan Drewery freebsd_committer 2015-09-15 15:24:31 UTC
Thanks. I ran into it as well during development but thought it may be limited to test code I had. Will have it fixed soon.
Comment 2 commit-hook freebsd_committer 2015-09-15 15:56:44 UTC
A commit references this bug:

Author: bdrewery
Date: Tue Sep 15 15:56:17 UTC 2015
New revision: 396993
URL: https://svnweb.freebsd.org/changeset/ports/396993

  - Update to 0.3.5

   - Optimize coalescing of snapshots on a system with a DB.
   - Avoid division by zero when creating snapshots. [1]

  PR:		203115