From 083d39ea807da11888c31a1325a7d30ac7d40381 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 22 Dec 2023 18:01:29 +0100 Subject: [PATCH 1/8] decoder/plugins/meson.build: add missing dependency to libid3tag --- src/decoder/plugins/meson.build | 4 ++++ test/meson.build | 1 + 2 files changed, 5 insertions(+) diff --git a/src/decoder/plugins/meson.build b/src/decoder/plugins/meson.build index cd6740494..251454ee3 100644 --- a/src/decoder/plugins/meson.build +++ b/src/decoder/plugins/meson.build @@ -1,6 +1,7 @@ decoder_plugins_sources = [ 'PcmDecoderPlugin.cxx', ] +decoder_plugins_dependencies = [] if get_option('dsd') decoder_plugins_sources += [ @@ -9,6 +10,7 @@ if get_option('dsd') 'DsfDecoderPlugin.cxx', 'DsdLib.cxx', ] + decoder_plugins_dependencies += libid3tag_dep endif if ffmpeg_dep.found() @@ -91,6 +93,7 @@ libmad_dep = c_compiler.find_library('mad', required: get_option('mad')) decoder_features.set('ENABLE_MAD', libmad_dep.found()) if libmad_dep.found() decoder_plugins_sources += 'MadDecoderPlugin.cxx' + decoder_plugins_dependencies += libid3tag_dep endif libmikmod_dep = dependency('libmikmod', version: '>= 3.2', required: get_option('mikmod')) @@ -188,6 +191,7 @@ decoder_plugins = static_library( decoder_plugins_sources, include_directories: inc, dependencies: [ + decoder_plugins_dependencies, adplug_dep, ffmpeg_dep, flac_dep, diff --git a/test/meson.build b/test/meson.build index c4746407a..f098527d8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -483,6 +483,7 @@ if libid3tag_dep.found() tag_dep, input_glue_dep, archive_glue_dep, + libid3tag_dep, ], ) endif From 074a041760d8b77cc435ad55493904394e9ec8ca Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 28 Jan 2025 19:47:35 +0100 Subject: [PATCH 2/8] test/meson.build: add missing dependencies on libevent.a --- test/meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/meson.build b/test/meson.build index f098527d8..90c0b56f9 100644 --- a/test/meson.build +++ b/test/meson.build @@ -123,6 +123,7 @@ if zeroconf_dep.found() include_directories: inc, dependencies: [ zeroconf_dep, + event_dep, util_dep, ], ) @@ -238,6 +239,7 @@ if neighbor_glue_dep.found() include_directories: inc, dependencies: [ neighbor_glue_dep, + event_dep, ], ) endif @@ -321,6 +323,7 @@ if curl_dep.found() include_directories: inc, dependencies: [ curl_dep, + event_dep, ], ) From 83c2d9c964ad6962b0c88bf9b4992ef227bef309 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 28 Jan 2025 19:52:13 +0100 Subject: [PATCH 3/8] test/meson.build: add another missing dependency on libevent.a Necessary for including Client.hxx. --- test/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/test/meson.build b/test/meson.build index 90c0b56f9..1e87678c6 100644 --- a/test/meson.build +++ b/test/meson.build @@ -288,6 +288,7 @@ if enable_database '../src/LocateUri.cxx', include_directories: inc, dependencies: [ + event_dep, log_dep, tag_dep, fs_dep, From cdcee16738973b1cdc17231fd633e19d97a287cb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Jan 2025 08:24:41 +0100 Subject: [PATCH 4/8] client/File: improve error message Users are confused by "Access denied". Let's write an error message that is more clear. Closes https://github.com/MusicPlayerDaemon/MPD/issues/2184 --- src/client/File.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/File.cxx b/src/client/File.cxx index 04f2df817..2688494cb 100644 --- a/src/client/File.cxx +++ b/src/client/File.cxx @@ -28,7 +28,7 @@ Client::AllowFile(Path path_fs) const #ifdef _WIN32 (void)path_fs; - throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied"); + throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files not implemented on Windows"); #else if (uid >= 0 && (uid_t)uid == geteuid()) /* always allow access if user runs his own MPD @@ -37,12 +37,12 @@ Client::AllowFile(Path path_fs) const if (uid < 0) /* unauthenticated client */ - throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied"); + throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files via TCP is not allowed"); const FileInfo fi(path_fs); if (fi.GetUid() != (uid_t)uid && (fi.GetMode() & 0444) != 0444) /* client is not owner */ - throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied"); + throw ProtocolError(ACK_ERROR_PERMISSION, "Access to this local file denied due to file permissions"); #endif } From 18495fbb4e9d202ec7a882768bead6f41bff2b54 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 May 2024 14:53:41 +0200 Subject: [PATCH 5/8] lib/nfs/meson.build: require libnfs 4.0 All Linux distributions have at least version 4, and thus I cannot test with older versions. --- NEWS | 2 ++ src/lib/nfs/meson.build | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2d22a1fac..e14bc2c01 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.23.17 (not yet released) +* storage + - nfs: require libnfs 4.0 or later * support libfmt 11.1 ver 0.23.16 (2024/12/03) diff --git a/src/lib/nfs/meson.build b/src/lib/nfs/meson.build index 5788e6bb7..655a930f7 100644 --- a/src/lib/nfs/meson.build +++ b/src/lib/nfs/meson.build @@ -1,4 +1,4 @@ -nfs_dep = dependency('libnfs', version: '>= 1.11', required: get_option('nfs')) +nfs_dep = dependency('libnfs', version: '>= 4', required: get_option('nfs')) conf.set('ENABLE_NFS', nfs_dep.found()) if not nfs_dep.found() subdir_done() From 37049aab365a15fb513c6daa79dba5cd183946d7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 14 May 2024 19:50:44 +0200 Subject: [PATCH 6/8] lib/nfs/Connection: remove EnableCloseOnExec() call SOCK_CLOEXEC has been added to libnfs version 2, and since we require at least version 4, we can safely remove this call. --- src/lib/nfs/Connection.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index fd733387a..c9d7985f7 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -447,7 +447,6 @@ NfsConnection::ScheduleSocket() noexcept if (!_fd.IsDefined()) return; - _fd.EnableCloseOnExec(); socket_event.Open(_fd); } From c48dbd5dd43506842e4f1478f386e9a744663d5a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Jan 2025 09:03:48 +0100 Subject: [PATCH 7/8] lib/nfs/meson.build: reject libnfs 6 libnfs version 6 has major API changes and MPD 0.23 has never been adapted to these. This additional configure-time check fixes potential compile-time failures. --- src/lib/nfs/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/nfs/meson.build b/src/lib/nfs/meson.build index 655a930f7..274ee7b47 100644 --- a/src/lib/nfs/meson.build +++ b/src/lib/nfs/meson.build @@ -1,4 +1,4 @@ -nfs_dep = dependency('libnfs', version: '>= 4', required: get_option('nfs')) +nfs_dep = dependency('libnfs', version: ['>= 4', '< 6'], required: get_option('nfs')) conf.set('ENABLE_NFS', nfs_dep.found()) if not nfs_dep.found() subdir_done() From 687475cf3cd0654bdd4b6d266561ffa57bc8b676 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Jan 2025 09:40:28 +0100 Subject: [PATCH 8/8] db/update/InotifyUpdate: handle IN_CREATE without IN_ISDIR A new symlink causes `IN_CREATE`. Usually, we catch `IN_CREATE` only with IN_ISDIR to watch the new directory, but otherwise `IN_CREATE` is not handled. Regular files are "created" but they have usable content only with `IN_CLOSE_WRITE`. Yet symlinks have only `IN_CREATE` and they are immediately usable. Closes https://github.com/MusicPlayerDaemon/MPD/issues/2192 --- NEWS | 2 ++ src/db/update/InotifyUpdate.cxx | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index e14bc2c01..f39025288 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ver 0.23.17 (not yet released) * storage - nfs: require libnfs 4.0 or later +* database + - inotify: trigger update after symlink was created * support libfmt 11.1 ver 0.23.16 (2024/12/03) diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx index 888682df9..40a60c9d0 100644 --- a/src/db/update/InotifyUpdate.cxx +++ b/src/db/update/InotifyUpdate.cxx @@ -293,6 +293,10 @@ InotifyUpdate::InotifyCallback(int wd, unsigned mask, } if ((mask & (IN_CLOSE_WRITE|IN_MOVE|IN_DELETE)) != 0 || + /* regular file or symlink was created; this check is only + interesting for symlinks because regular files have + usable content only after IN_CLOSE_WRITE */ + (mask & (IN_CREATE|IN_ISDIR)) == IN_CREATE || /* at the maximum depth, we watch out for newly created directories */ (directory.GetDepth() == max_depth &&