18897 Commits

Author SHA1 Message Date
Max Kellermann
35dc1fc589 io/UniqueFileDescriptor: use AdoptTag in the constructors that adopt ownership 2025-01-23 16:57:39 +01:00
Max Kellermann
765a6a2f20 net/UniqueSocketDescriptor: use AdoptTag in the constructors that adopt ownership
This makes it a little bit harder to use the ownershop-adopting
constructors accidently.
2025-01-23 16:56:57 +01:00
Max Kellermann
131263cbe3 util/TagStructs: add struct AdoptTag 2025-01-23 16:56:00 +01:00
Max Kellermann
936611b47c util/ShallowCopy: rename header to TagStructs.hxx
This new header will be a collection of more structs like ShallowCopy.
2025-01-23 16:55:51 +01:00
gd
266eb393eb fix: output of command status broken by a misplaced comma in the format arguments 2025-01-21 14:03:41 +02:00
Michael Herstine
194ecd69e0 lib/fmt: remove even more now-broken uses of FMT_STRING
MPD stopped building since fmt 11.1.0; see
<https://github.com/fmtlib/fmt/issues/4304>. The first commit
fixing this was 9db7144, followed by 5de0909 (both on the
unstable branch).

This commit removes what the author believes to be the remaining
uses in the MPD codebase.
2025-01-20 19:54:41 -08:00
Michael Herstine
b24b3c1054 Merge remote-tracking branch 'upstream/v0.23.x' 2025-01-20 09:44:07 -08:00
Alfred Wingate
5de0909ae5
lib/fmt: remove the rest of the broken use of FMT_STRING
Fixes: 9db7144d0fa4512335070a984690f3f5034210a5
Signed-off-by: Alfred Wingate <parona@protonmail.com>
2025-01-18 03:29:14 +02:00
Rudi Heitbaum
da6efd6361 plugins/meson.build: revert unintentional static link change
Minor revert of 9db7144d0fa4512335070a984690f3f5034210a5
- no change was to be done to meson.build.
2025-01-13 22:39:12 +00:00
Rudi Heitbaum
9db7144d0f lib/fmt: drop use of FMT_STRING
When compiling with libfmt-11.1.0 and newer the following compile errors occur:

In file included from ../src/decoder/DecoderPrint.cxx:23:
../src/client/Response.hxx: In instantiation of 'bool Response::Fmt(const S&, Args&& ...) [with S = decoder_plugin_print(Response&, const DecoderPlugin&)::<lambda()>::FMT_COMPILE_STRING; Args = {const char* const&}]':
../src/decoder/DecoderPrint.cxx:38:7:   required from here
   38 |         r.Fmt(FMT_STRING("plugin: {}\n"), plugin.name);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/client/Response.hxx:86:28: error: cannot convert 'const decoder_plugin_print(Response&, const DecoderPlugin&)::<lambda()>::FMT_COMPILE_STRING' to 'fmt::v11::string_view' {aka 'fmt::v11::basic_string_view<char>'}
   86 |                 return VFmt(format_str,
      |                        ~~~~^~~~~~~~~~~~
   87 |                             fmt::make_format_args(args...));
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/client/Response.hxx:81:36: note: initializing argument 1 of 'bool Response::VFmt(fmt::v11::string_view, fmt::v11::format_args)'
   81 |         bool VFmt(fmt::string_view format_str, fmt::format_args args) noexcept;
      |                   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../src/client/Response.hxx: In instantiation of 'bool Response::Fmt(const S&, Args&& ...) [with S = decoder_plugin_print(Response&, const DecoderPlugin&)::<lambda()>::FMT_COMPILE_STRING; Args = {const char* const&}]':

The error is due to the use of FMT_STRING. The libfmt team shared the following:

    The correct way of using FMT_STRING is to wrap a format string when passing to a
    function with compile-time checks (i.e. that takes format_string) as documented
    in https://fmt.dev/11.1/api/#legacy-compile-time-checks.

    Noting that FMT_STRING is a legacy API and has been superseded by consteval-based
    API starting from version 8: https://github.com/fmtlib/fmt/releases/tag/8.0.0. It
    looks like MPD is trying to emulate {fmt}'s old way of implementing compile-time
    checks which was never properly documented because it was basically a hack. So the
    correct fix is to switch to format_string and, possibly, remove usage of FMT_STRING.

    The old way of doing compile-time checks (fmt::make_args_checked) was documented
    in https://fmt.dev/7.1/api.html#argument-lists but it looks like MPD is not using
    that API so the problematic uses of FMT_STRING have no effect and can just be removed.

The FMT_STRING has been removed in this change based on the fmt-7.1 API and now MPD is
successfully compile against the current libfmt-11.1.0 which highlighted the issue that
had been present in the codebase as it is now triggering the error, is legacy and was
not using the API for which FMT_STRING was aligned with.
2025-01-13 06:17:01 +00:00
jcorporation
bd36b5e310 Response with error for sticker set,inc,dec and add missing asserts 2024-12-12 19:40:06 +01:00
jcorporation
015870ac71 Replace STICKER_SQL_INSERT and STICKER_SQL_UPDATE with STICKER_SQL_SET that lets handle sqlite insertion or update of the sticker value. 2024-12-12 19:15:22 +01:00
Max Kellermann
b1677bf79c Merge branch 'sticker_inc_dec' of https://github.com/jcorporation/MPD 2024-12-12 08:38:58 +01:00
jcorporation
1078c1c1bf Add sticker sub-commands inc and dec
Let sqlite do the work for incrementing or decrementing a sticker value.
This sub-commands are usefull to track playcounts with sticker values and
saves us one roundtrip.
2024-12-11 21:41:24 +01:00
Max Kellermann
9a8579d956 event/ServerSocket: do not close all listeners before rethrowing
If binding one address fails, we don't need to close all listeners.
For fatal errors, this will be done automatically and implicitly; and
for non-fatal errors (e.g. binding to the default port failed, but
there is an XDG listener), this closes the good listeners which are
supposed to be used.

Closes https://github.com/MusicPlayerDaemon/MPD/pull/2157
2024-12-04 14:25:42 +01:00
Max Kellermann
b6e187efd8 release v0.23.16
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmdO8gkNHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFEgdSEACRi/mJGq9at6GAlyBDuemzAo/UyyAa2fR8xTxf
 V7qGMlWfyylSFp9J1SwPvl56J5s28VpoFL4sfW9TYb9U3bl/eTTlyEvxZBgCbYq8
 fSDzVY7ReWxr1u/Fv7GuR9Nbu/tN0NItlBRB23FkNIYmdRxxH0h/fKbgXRD9TUiG
 qs4w97AqeWvxDuEyaoX0Y/l2tdlLyUENi7G7Np34giSFKpq9ldD28nKl18ORSuby
 +tK124wW1s/p7ncrzhzd9NyrEvmCMKB951H95H7+sfgojAY1LuVWGtiJSfMYw+w0
 LqCd23l78kwOfDYPwvB8sp4lUpVdxv4u9YhGwgNfzwavCrOWfzYMVg+hub3V0N//
 Xx79wGSkR1NQcbfUD05U6c4+jfDGARDRx9dUQWpeJGOF3LHFFFIyAPGW5T0DZrDY
 aPdoaLKbtK7F36QdBPZryhv49lXdsbd1OKhFV54QMR04bM3a150t6CiFk53nQIk0
 akIKCDt0Gi3GrLRkSwOeOwVuWsI/Y0SQC8dp8cIzCa9toIzfn42hG14SKM2FWAP1
 4BmekNkfqsG6xY8xcRwq6+HF1aq3dDHoPqIfE0r71/hadlIX9OjSNlepP2VIyzY/
 Gl5jvkf9el2MfI4JeCXafsZCyqlV6mx4HVPXrtiLgSdY3odTA1aShFI6/jfEjxXM
 Yo/ngQ==
 =640n
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.16'

release v0.23.16
2024-12-03 13:01:15 +01:00
Max Kellermann
b5bd294e5c release v0.23.16 v0.23.16 2024-12-03 12:56:57 +01:00
Max Kellermann
ac60bd47f0 thread/WindowsFuture: add missing include for std::error_category 2024-12-03 12:54:12 +01:00
Max Kellermann
b7248f0333 filter/ffmpeg: fill AVFrame::pts
Some libavfilter plugins don't produce any output if `pts` is never
set, e.g. the `lowpass` plugin.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2114
2024-12-03 12:52:15 +01:00
Marius Feraru
8a5b5378e6 db/update/Walk:FindAncestorLoop: uint64_t inode & device
Previously, inode numbers were truncated to 32 bits, which could lead
to problems on XFS where inodes are 64 bit; this could lead to bogus
"recursive directory found" errors during database update.

[mk: added commit description and NEWS line]

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2000
2024-12-03 12:49:02 +01:00
Michael Cho
4a49f75799 meson.build: support building with ICU 76
ICU 76 decided to reduce overlinking[^1] thus `icu-i18n` will no longer
add `icu-uc` when linking to shared libraries. This results in failure:
```
src/lib/icu/libicu.a.p/Converter.cxx.o: undefined reference to symbol 'ucnv_fromUnicode_76'
```

[^1]: 199bc82702

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2151
2024-12-03 12:47:55 +01:00
Max Kellermann
9d2666f293 subprojects: update sqlite3 to 3.47.1-1 2024-12-03 12:46:33 +01:00
Max Kellermann
e63fcc5982 python/build/libs: update libnfs to 5.0.3 2024-12-03 12:45:05 +01:00
Max Kellermann
4c37c17f2e python/build/libs.py: update WildMidi to 0.4.6 2024-12-03 12:44:33 +01:00
Max Kellermann
722820a375 python/build/libs: update zlib to 1.3.1 2024-12-03 12:44:14 +01:00
Max Kellermann
688023eb9e python/build/libs.py: update libopenmpt to 0.7.9 2024-12-03 12:43:34 +01:00
Max Kellermann
5771aeaddd subprojects: update fmt to 11.0.2-1 2024-12-03 12:42:02 +01:00
Rudi Heitbaum
a42da90042 lib/fmt: support build with libfmt-11.0.0
Upstream libfmt commit fmtlib/fmt@d707292
now requires the format function to be const.

Adjust the function prototype so it is const and can compile.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2141
2024-12-03 12:42:02 +01:00
Max Kellermann
d7d32ed6fc meson.build: suppress -Wnan-infinity-disabled (clang 18) due to libfmt 2024-12-03 12:40:21 +01:00
Max Kellermann
4715acf27e Log: add missing include for std::back_inserter()
Closes https://github.com/MusicPlayerDaemon/MPD/issues/2071
2024-12-03 12:38:00 +01:00
Max Kellermann
8780db5ee8 increment version number to 0.23.16 2024-12-03 12:34:01 +01:00
Max Kellermann
30d2a31473 command/sticker: remove unreachable code 2024-12-03 12:32:33 +01:00
Max Kellermann
9a7a8ec137 io: always pass O_NONBLOCK to open()
Opening a FIFO may block indefinitely (until a writer connects).  This
is dangerous because it may be a DoS vulnerability in many programs
that do not expect open() to block.

This obsoletes the method FileDescriptor::OpenNonBlocking() which
wasn't used anyway.
2024-12-03 12:28:17 +01:00
Max Kellermann
88fa68f030 net/SocketDescriptor: add GetPeerPidfd() 2024-12-03 12:27:20 +01:00
borine
78e643150f output/Source: fix Close()
Close the filter before cancelling when closing a source.
Fixes 
2024-11-19 10:59:35 +00:00
Max Kellermann
eb1463fd7c test/util/TestIntrusiveTreeSet: add constant_time_size test 2024-11-13 10:44:28 +01:00
Max Kellermann
6dce8dcaa5 io/FileDescriptor: add readv()/writev() wrappers 2024-11-13 10:44:03 +01:00
Max Kellermann
fc4a579d83 io/FileDescriptor: remove Read()/Write() with void pointers
Obsolete and unsafe.
2024-11-13 10:43:34 +01:00
Max Kellermann
263b9916c2 unix/PidFile: pass std::span to FileDescriptor::Read() 2024-11-13 10:43:33 +01:00
Max Kellermann
16604997d6 system/{Event,Signal}FD: pass std::span to FileDescriptor::Read() 2024-11-13 10:43:08 +01:00
Max Kellermann
77226bc0d8 test/ReadFrames: pass std::span to FileDescriptor::Read() 2024-11-13 10:42:35 +01:00
Max Kellermann
7a6672b7ed util/IntrusiveTreeSet: update the counter, fixing constant_time_size 2024-11-13 10:36:57 +01:00
Max Kellermann
8db14c9cb3 Instance: add method FindOutput()
Move code from handle_moveoutput().
2024-11-11 19:08:45 +01:00
Max Kellermann
370df37596 io/uring/Ring: add more API documentation 2024-11-11 19:04:24 +01:00
Max Kellermann
84e3501084 io/uring/Queue: remove redundant include 2024-11-11 19:04:21 +01:00
Max Kellermann
a7d41a99a1 util/ForeignFifoBuffer: pass std::span to constructor 2024-11-11 19:03:31 +01:00
Max Kellermann
c9c5e84119 util/ForeignFifoBuffer: store buffer as std::span 2024-11-11 19:02:58 +01:00
Max Kellermann
8a3b48754e util/ForeignFifoBuffer: use Read() in MoveBuffer() and Shift() 2024-11-11 19:02:43 +01:00
Max Kellermann
849c4012c0 filter/Filter: add method ReadMore()
This allows FilterPCM() to return more data, which some
implementations may need to do (e.g. FFmpeg).
2024-11-08 19:31:16 +01:00
Max Kellermann
d8bb833ba3 output/Source: convert runtime check to assert()
Flush() may only be called if the source is open.
2024-11-08 19:09:31 +01:00