]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fixed seg.fault during rollback if the previous default subvolume
authorArvin Schnell <aschnell@suse.de>
Tue, 26 Mar 2019 09:34:33 +0000 (10:34 +0100)
committerArvin Schnell <aschnell@suse.de>
Tue, 26 Mar 2019 09:34:33 +0000 (10:34 +0100)
  is missing in the snapshot list (bsc#1130273)

12 files changed:
LIBVERSION
VERSION
client/proxy-dbus.cc
client/proxy-dbus.h
client/proxy-lib.cc
client/proxy-lib.h
client/proxy.h
client/snapper.cc
package/snapper.changes
snapper/Filesystem.h
snapper/Snapshot.cc
snapper/Snapshot.h

index a84947d6ffe7bdf361dfd679a8e931b44f0e9001..6016e8addc4d0ea9fab0f803ecb49f93541fd44f 100644 (file)
@@ -1 +1 @@
-4.5.0
+4.6.0
diff --git a/VERSION b/VERSION
index 100435be135a32ae8974fe4dd281c4d3a9d62e02..ee94dd834b5395f973d3c7992f661d306320aec2 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.8.2
+0.8.3
index c829c185a1d943ee312572f3e524d14dba946ab6..928da45ba39cd001a77911d1d0dc188373184c32 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -115,6 +115,15 @@ ProxySnapshotsDbus::getDefault() const
 }
 
 
+ProxySnapshots::iterator
+ProxySnapshotsDbus::getDefault()
+{
+    pair<bool, unsigned int> tmp = command_get_default_snapshot(conn(), configName());
+
+    return tmp.first ? find(tmp.second) : end();
+}
+
+
 ProxySnapshots::const_iterator
 ProxySnapshotsDbus::getActive() const
 {
index b2b6cd33cd3cda6ba2d77c92d3049281cad0dbce..a2888be8bf4581d86cf1176eb2c6542ad58067c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -93,6 +93,7 @@ public:
 
     ProxySnapshotsDbus(ProxySnapperDbus* backref);
 
+    virtual iterator getDefault();
     virtual const_iterator getDefault() const;
 
     virtual const_iterator getActive() const;
index b941607d477eedd1b01e52d65ad871349bcb3f90..c5bf341a34bf776c03313d1a776bd23b96479c75 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
 using namespace std;
 
 
+ProxySnapshots::iterator
+ProxySnapshotsLib::getDefault()
+{
+    Snapshots& snapshots = backref->snapper->getSnapshots();
+
+    Snapshots::iterator tmp = snapshots.getDefault();
+
+    return tmp != snapshots.end() ? find(tmp->getNum()) : end();
+}
+
+
 ProxySnapshots::const_iterator
 ProxySnapshotsLib::getDefault() const
 {
-    Snapshots& snapshots = backref->snapper->getSnapshots();
+    const Snapshots& snapshots = backref->snapper->getSnapshots();
 
     Snapshots::const_iterator tmp = snapshots.getDefault();
 
index 5d3db5ad150ab297b81d69b6ee578eeef59a706a..d9427f5756a278eceed6adcb35707e630bd19488 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -79,6 +79,7 @@ class ProxySnapshotsLib : public ProxySnapshots
 
 public:
 
+    virtual iterator getDefault();
     virtual const_iterator getDefault() const;
 
     virtual const_iterator getActive() const;
index d841963d7f220e52a5fc0b358b63cd074cc2e9d5..606105ecc52f674a8c0b488216443d5e4ef77a59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2016-2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -172,6 +172,7 @@ public:
 
     const_iterator getCurrent() const { return proxy_snapshots.begin(); }
 
+    virtual iterator getDefault() = 0;
     virtual const_iterator getDefault() const = 0;
 
     virtual const_iterator getActive() const = 0;
index 842bf6c9853f99e71bcb2aff3b9bb257d7ce998c..0d81036e56d7c472ac7ddcb8c80a6dff9760b50c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2016-2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -1318,12 +1318,12 @@ command_rollback(ProxySnappers* snappers, ProxySnapper* snapper)
        exit(EXIT_FAILURE);
     }
 
-    pair<bool, unsigned int> previous_default = filesystem->getDefault();
+    ProxySnapshots& snapshots = snapper->getSnapshots();
 
-    if (previous_default.first && scd1.description == "rollback backup")
-       scd1.description += sformat(" of #%d", previous_default.second);
+    ProxySnapshots::iterator previous_default = snapshots.getDefault();
 
-    ProxySnapshots& snapshots = snapper->getSnapshots();
+    if (previous_default != snapshots.end() && scd1.description == "rollback backup")
+        scd1.description += sformat(" of #%d", previous_default->getNum());
 
     ProxySnapshots::const_iterator snapshot1 = snapshots.end();
     ProxySnapshots::const_iterator snapshot2 = snapshots.end();
@@ -1370,15 +1370,11 @@ command_rollback(ProxySnappers* snappers, ProxySnapper* snapper)
            cout << " " << sformat(_("(Snapshot %d.)"), snapshot2->getNum()) << endl;
     }
 
-    if (previous_default.first)
+    if (previous_default != snapshots.end() && previous_default->getCleanup().empty())
     {
-       ProxySnapshots::iterator it = snapshots.find(previous_default.second);
-       if (it->getCleanup().empty())
-       {
-           SMD smd = it->getSmd();
-           smd.cleanup = "number";
-           snapper->modifySnapshot(it, smd);
-       }
+       SMD smd = previous_default->getSmd();
+       smd.cleanup = "number";
+       snapper->modifySnapshot(previous_default, smd);
     }
 
     if (!quiet)
index 7d80dfbe7cafaad93347adf699ca31e18ee2eb50..919ef5a91981eacd46f3e30ce995815ea46babcc 100644 (file)
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Tue Mar 26 10:15:55 CET 2019 - aschnell@suse.com
+
+- fixed seg.fault during rollback if the previous default subvolume
+  is missing in the snapshot list (bsc#1130273)
+- version 0.8.3
+
 -------------------------------------------------------------------
 Tue Jan 22 11:05:01 CET 2019 - aschnell@suse.com
 
@@ -118,7 +125,7 @@ Wed Dec  6 16:49:06 CET 2017 - kukuk@suse.de
 -------------------------------------------------------------------
 Thu Nov 23 13:51:45 UTC 2017 - rbrown@suse.com
 
-- Replace references to /var/adm/fillup-templates with new 
+- Replace references to /var/adm/fillup-templates with new
   %_fillupdir macro (boo#1069468)
 
 -------------------------------------------------------------------
index 63b4dd2a1a4709eed65cc188b70cb96124687274..fb8f0203eb71317e88bf17215cefb77eb2569258 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2016-2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -87,7 +87,8 @@ namespace snapper
 
        /**
         * Query the number of the default snapshot. The first entry of the
-        * pair indicates whether the default snapshot is a snapper snapshot.
+        * pair indicates whether the default snapshot is a snapper snapshot
+        * (not necessarily in the list of snapshots known to snapper).
         * Currently only available for btrfs.
         */
        virtual std::pair<bool, unsigned int> getDefault() const;
index 900e4ef2e89bedb53c4ebf22fa930396dccf4d0b..7218423b9b59887536327884caabddc1fd557c36 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -765,6 +765,15 @@ namespace snapper
     }
 
 
+    Snapshots::iterator
+    Snapshots::getDefault()
+    {
+       std::pair<bool, unsigned int> tmp = snapper->getFilesystem()->getDefault();
+
+       return tmp.first ? find(tmp.second) : end();
+    }
+
+
     Snapshots::const_iterator
     Snapshots::getDefault() const
     {
index dc9764560fc86a0963614405d5c5a5eb8d3bf5b5..b23532edd38a72f7d99bfd46405c786c001cd764 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2016,2018] SUSE LLC
+ * Copyright (c) [2016-2019] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -244,6 +244,8 @@ namespace snapper
         * The default btrfs snapshot may not be controlled by snapper
         * in which this function returns end().
         */
+       iterator getDefault();
+
        const_iterator getDefault() const;
 
        /**