From e7697512218b461d0fd3df1d01f77d0dfd984c47 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 21 Dec 2017 10:15:16 +0100 Subject: [PATCH 1/4] increment version number to 0.20.14 --- NEWS | 2 ++ configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4f73e39a4..0b824cdd1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.20.14 (not yet released) + ver 0.20.13 (2017/12/18) * output - osx: set up ring buffer to hold at least 100ms diff --git a/configure.ac b/configure.ac index 26a53813d..d9190dc3a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.20.13, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.20.14, musicpd-dev-team@lists.sourceforge.net) VERSION_MAJOR=0 VERSION_MINOR=20 -VERSION_REVISION=13 +VERSION_REVISION=14 VERSION_EXTRA=0 AC_CONFIG_SRCDIR([src/Main.cxx]) From c88056ba83183bfbdd0f8ed67aaa4ff02802ab11 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 21 Dec 2017 10:16:52 +0100 Subject: [PATCH 2/4] db/simple: fix file corruption in the presence of mount points If a directory is a mount point, omit the "directory: " as well. This bug is years old, but has become more visible now that mount points are persistent in the state file. --- NEWS | 2 ++ src/db/plugins/simple/DirectorySave.cxx | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 0b824cdd1..7ae86d430 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.14 (not yet released) +* database + - simple: fix file corruption in the presence of mount points ver 0.20.13 (2017/12/18) * output diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx index e1f83bf5b..033d90f4a 100644 --- a/src/db/plugins/simple/DirectorySave.cxx +++ b/src/db/plugins/simple/DirectorySave.cxx @@ -82,10 +82,11 @@ directory_save(BufferedOutputStream &os, const Directory &directory) } for (const auto &child : directory.children) { - os.Format(DIRECTORY_DIR "%s\n", child.GetName()); + if (child.IsMount()) + continue; - if (!child.IsMount()) - directory_save(os, child); + os.Format(DIRECTORY_DIR "%s\n", child.GetName()); + directory_save(os, child); } for (const auto &song : directory.songs) From 3d1d779da7112ea3d08217f37cac8fcba78a9808 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 18 Dec 2017 23:50:31 +0100 Subject: [PATCH 3/4] storage/State: use std::set instead of sorting a std::list --- src/storage/StorageState.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/storage/StorageState.cxx b/src/storage/StorageState.cxx index beeb4eebb..721a0ce37 100644 --- a/src/storage/StorageState.cxx +++ b/src/storage/StorageState.cxx @@ -35,7 +35,7 @@ #include "IOThread.hxx" #include "Log.hxx" -#include +#include #include #define MOUNT_STATE_BEGIN "mount_begin" @@ -118,16 +118,14 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance) unsigned storage_state_get_hash(const Instance &instance) { - std::list mounts; + std::set mounts; const auto visitor = [&mounts](const char *mount_uri, const Storage &storage) { - mounts.push_back(std::string(mount_uri) + ":" + storage.MapUTF8("")); + mounts.emplace(std::string(mount_uri) + ":" + storage.MapUTF8("")); }; ((CompositeStorage*)instance.storage)->VisitMounts(visitor); - mounts.sort(); - boost::crc_32_type result; for (auto mount: mounts) { From 43ec96d4a0b90179b60cf92698ea90f9248124c5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Dec 2017 10:54:49 +0100 Subject: [PATCH 4/4] command/Error: translate std::{length_error,out_of_range} to ACK_ERROR_ARG --- src/command/CommandError.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command/CommandError.cxx b/src/command/CommandError.cxx index 8f5badb4d..d12d4a4ec 100644 --- a/src/command/CommandError.cxx +++ b/src/command/CommandError.cxx @@ -123,6 +123,10 @@ ToAck(std::exception_ptr ep) noexcept return ACK_ERROR_SYSTEM; } catch (const std::invalid_argument &e) { return ACK_ERROR_ARG; + } catch (const std::length_error &e) { + return ACK_ERROR_ARG; + } catch (const std::out_of_range &e) { + return ACK_ERROR_ARG; #ifdef GLIBCXX_49X } catch (const std::exception &e) { #else