From: Arvin Schnell Date: Tue, 16 Jun 2026 09:30:37 +0000 (+0200) Subject: - allow to disable all-time unique snapshot numbers X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1147%2Fhead;p=thirdparty%2Fsnapper.git - allow to disable all-time unique snapshot numbers --- diff --git a/data/default-config b/data/default-config index 5c9585b7..11f331e2 100644 --- a/data/default-config +++ b/data/default-config @@ -17,6 +17,11 @@ SPACE_LIMIT="0.5" FREE_LIMIT="0.2" +# Whether snapshot numbers should be all-time unique. If set to yes, snapshot +# numbers are not reused even after snapshots are deleted. +UNIQUE_NUMBERS="yes" + + # users and groups allowed to work with config ALLOW_USERS="" ALLOW_GROUPS="" diff --git a/doc/snapper-configs.xml.in b/doc/snapper-configs.xml.in index ac03241b..60c6a3ed 100644 --- a/doc/snapper-configs.xml.in +++ b/doc/snapper-configs.xml.in @@ -2,13 +2,13 @@ - 2022-07-12 + 2026-06-16 snapper-configs 5 - 2022-07-12 + 2026-06-16 @VERSION@ Filesystem Snapshot Management @@ -81,6 +81,16 @@ + + + + Whether snapshot numbers should be all-time unique. If set to + yes, snapshot numbers are not reused even after snapshots are deleted. + Default value is "yes". + New in version 0.13.2. + + + diff --git a/doc/unique-numbers.txt b/doc/unique-numbers.txt index 0cd12ea9..640bef11 100644 --- a/doc/unique-numbers.txt +++ b/doc/unique-numbers.txt @@ -8,3 +8,6 @@ directories when finding the number for the next snapshot. As a consequence there can temporarily be empty directories in the infos directories. + +This behavior can be disabled by setting UNIQUE_NUMBERS="no" in the +configuration. diff --git a/package/snapper.changes b/package/snapper.changes index de378f0e..5a6fdfb6 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jun 16 10:40:03 CEST 2026 - Arvin Schnell + +- allow to disable all-time unique snapshot numbers (see + bsc#1268225) + ------------------------------------------------------------------- Fri Jun 12 09:47:19 CEST 2026 - Arvin Schnell diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 71b8ea67..17fd27f6 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -859,10 +859,13 @@ namespace snapper if (info_dir.unlink("info.xml") < 0) y2err("unlink 'info.xml' failed errno: " << errno << " (" << stringerror(errno) << ")"); - // We want all-time unique snapshot numbers. So keep directory of snapshot with + // If want all-time unique snapshot numbers keep directory of snapshot with // highest number. - if (snapshot->num != entries.rbegin()->num) + bool unique_numbers = true; + snapper->getConfigInfo().get_value("UNIQUE_NUMBERS", unique_numbers); + + if (!unique_numbers || snapshot->num != entries.rbegin()->num) { SDir infos_dir = snapper->openInfosDir(); if (infos_dir.rmdir(decString(snapshot->getNum())) < 0)