From: Arvin Schnell Date: Tue, 26 Mar 2019 09:34:33 +0000 (+0100) Subject: - fixed seg.fault during rollback if the previous default subvolume X-Git-Tag: v0.8.3~1^2~2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=78ee6317045bc8a6a4dada9c3df9b22074047fac;p=thirdparty%2Fsnapper.git - fixed seg.fault during rollback if the previous default subvolume is missing in the snapshot list (bsc#1130273) --- diff --git a/LIBVERSION b/LIBVERSION index a84947d6..6016e8ad 100644 --- a/LIBVERSION +++ b/LIBVERSION @@ -1 +1 @@ -4.5.0 +4.6.0 diff --git a/VERSION b/VERSION index 100435be..ee94dd83 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/client/proxy-dbus.cc b/client/proxy-dbus.cc index c829c185..928da45b 100644 --- a/client/proxy-dbus.cc +++ b/client/proxy-dbus.cc @@ -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 tmp = command_get_default_snapshot(conn(), configName()); + + return tmp.first ? find(tmp.second) : end(); +} + + ProxySnapshots::const_iterator ProxySnapshotsDbus::getActive() const { diff --git a/client/proxy-dbus.h b/client/proxy-dbus.h index b2b6cd33..a2888be8 100644 --- a/client/proxy-dbus.h +++ b/client/proxy-dbus.h @@ -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; diff --git a/client/proxy-lib.cc b/client/proxy-lib.cc index b941607d..c5bf341a 100644 --- a/client/proxy-lib.cc +++ b/client/proxy-lib.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) [2016,2018] SUSE LLC + * Copyright (c) [2016-2019] SUSE LLC * * All Rights Reserved. * @@ -26,10 +26,21 @@ 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(); diff --git a/client/proxy-lib.h b/client/proxy-lib.h index 5d3db5ad..d9427f57 100644 --- a/client/proxy-lib.h +++ b/client/proxy-lib.h @@ -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; diff --git a/client/proxy.h b/client/proxy.h index d841963d..606105ec 100644 --- a/client/proxy.h +++ b/client/proxy.h @@ -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; diff --git a/client/snapper.cc b/client/snapper.cc index 842bf6c9..0d81036e 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -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 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) diff --git a/package/snapper.changes b/package/snapper.changes index 7d80dfbe..919ef5a9 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -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) ------------------------------------------------------------------- diff --git a/snapper/Filesystem.h b/snapper/Filesystem.h index 63b4dd2a..fb8f0203 100644 --- a/snapper/Filesystem.h +++ b/snapper/Filesystem.h @@ -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 getDefault() const; diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 900e4ef2..7218423b 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -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 tmp = snapper->getFilesystem()->getDefault(); + + return tmp.first ? find(tmp.second) : end(); + } + + Snapshots::const_iterator Snapshots::getDefault() const { diff --git a/snapper/Snapshot.h b/snapper/Snapshot.h index dc976456..b23532ed 100644 --- a/snapper/Snapshot.h +++ b/snapper/Snapshot.h @@ -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; /**