]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- allow to disable all-time unique snapshot numbers 1147/head
authorArvin Schnell <aschnell@suse.de>
Tue, 16 Jun 2026 09:30:37 +0000 (11:30 +0200)
committerArvin Schnell <aschnell@suse.de>
Tue, 16 Jun 2026 09:30:37 +0000 (11:30 +0200)
data/default-config
doc/snapper-configs.xml.in
doc/unique-numbers.txt
package/snapper.changes
snapper/Snapshot.cc

index 5c9585b7e01204853cef993ae15047cb7bf27289..11f331e2417bd2d43b45fff0740072793a0da930 100644 (file)
@@ -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=""
index ac03241ba00ccce54826d4651c5d245e72ab4be5..60c6a3ed085e10a4d3e3dbeaf92b0afbeee031a6 100644 (file)
@@ -2,13 +2,13 @@
 <refentry id='snapper-configs5'>
 
   <refentryinfo>
-    <date>2022-07-12</date>
+    <date>2026-06-16</date>
   </refentryinfo>
 
   <refmeta>
     <refentrytitle>snapper-configs</refentrytitle>
     <manvolnum>5</manvolnum>
-    <refmiscinfo class='date'>2022-07-12</refmiscinfo>
+    <refmiscinfo class='date'>2026-06-16</refmiscinfo>
     <refmiscinfo class='version'>@VERSION@</refmiscinfo>
     <refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
   </refmeta>
        </listitem>
       </varlistentry>
 
+      <varlistentry>
+       <term><option>UNIQUE_NUMBERS=<replaceable>boolean</replaceable></option></term>
+       <listitem>
+         <para>Whether snapshot numbers should be all-time unique. If set to
+         yes, snapshot numbers are not reused even after snapshots are deleted.</para>
+         <para>Default value is &quot;yes&quot;.</para>
+         <para>New in version 0.13.2.</para>
+       </listitem>
+      </varlistentry>
+
       <varlistentry>
        <term><option>ALLOW_USERS=<replaceable>users</replaceable></option></term>
        <listitem>
index 0cd12ea96f918f03ef967c412a956e7f0398087b..640bef1183c5a9537460603a8c7e87a70d3520e6 100644 (file)
@@ -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.
index de378f0e14a16d26efa567770f2df889652150a6..5a6fdfb6703a134266f741100864d0fd5bd085c8 100644 (file)
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Tue Jun 16 10:40:03 CEST 2026 - Arvin Schnell <aschnell@suse.com>
+
+- allow to disable all-time unique snapshot numbers (see
+  bsc#1268225)
+
 -------------------------------------------------------------------
 Fri Jun 12 09:47:19 CEST 2026 - Arvin Schnell <aschnell@suse.com>
 
index 71b8ea67bc62faaa4acb08398be88e925c70c6ef..17fd27f6fee2cd364befbcfe892647062a4f2121 100644 (file)
@@ -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)