Andre Noll [Thu, 12 Jun 2025 23:17:06 +0000 (01:17 +0200)]
Merge topic branch t/misc into pu
The stuff in here is too small to get its own topic branch. The
commits are generally regarded as safe enough to be applied directly to
"master" without cooking in "next" first. However, if a commit induces
a merge conflict or is important enough to get mentioned in an item
of the NEWS file, the commit should get a dedicated topic branch.
Unlike most other topic branches, this branch never promotes to
"next". When a set of commits is ready to graduate to "master", the
branch is rebased onto "master" and its commits are re-ordered so that
the graduating commits appear at the beginning. The last such commit
is merged to "master". This always results in a fast-forward merge,
so no merge message needs to be supplied.
<!-- No merge message -->
* refs/heads/t/misc:
Move FOR_EACH_RECEIVER from recv.h to recv_common.c.
send_common.c does not need afs.h.
Speed up blob operations.
vss: Make vss_next() and vss_repos() static.
vss: Change vss_playing() and friends to return bool.
wma: Use unsigned byte arrays.
sched.h: Remove an unnecessary declaration.
server: Delay vss shutdown in command handler context.
Andre Noll [Thu, 12 Jun 2025 23:16:38 +0000 (01:16 +0200)]
Merge topic branch t/doxygen into pu
This revamps the doxygen part of the documentation web page, adding a couple
of entry points for users to get started with the code base. We provide links
to header files which descripe the API of central subsystems and links to
the main file of each paraslash executable.
The \file comment of the source files reachable through these links have been
extended to contain a detailed description of the API or executable. Unlike
the introductory text of the manual pages, these comments focus on the code,
particularly the interaction between the various subsystems.
This also reactivates the source browser, since it is actually quite useful
to quickly check for some detail.
<!--
- Major revamp of the source code documention and the documentation web page.
-->
* refs/heads/t/doxygen: (38 commits)
crypt
gui
doc-page
f
filter api
recv
afs
afs
afs
fec
doc-site
send.h
senders
send/source-browser
write
afh
afh.h
f
afh
Move detailed desc to top
...
Andre Noll [Mon, 9 Jun 2025 19:23:59 +0000 (21:23 +0200)]
server: Delay vss shutdown in command handler context.
The sender status subcommand invoked via ->handle_connect() accesses memory
that has been freed in vss_shutdown(), resulting in garbage output. This
use-after-free bug is correctly reported by valgrind. It can easily be fixed
by moving the vss_shutdown() call down.
Andre Noll [Tue, 10 Jun 2025 14:06:03 +0000 (16:06 +0200)]
Make struct sched private.
This moves the declaration of the structure from sched.h to sched.c because
the information stored in this structure has almost no users outside of the
scheduler core.
As a result, the size of the structure is no longer known outside of sched.c.
Applications now must call the new sched_new() to obtain a pointer to an
initialized scheduler structure, passing an alternative poll function if
needed. We don't let applications set the default timeout anymore because
the value is kind of arbitrary anyway and most applications simply specified
one second. So hardcode this as the default.
Andre Noll [Mon, 2 Jun 2025 20:48:41 +0000 (22:48 +0200)]
Prefer __func__ to __FUNCTION__.
The former is part of the C99 standard, while the latter is only provided
for backward compatibility. This change also silences many gcc warnings when
compiling with -Wpendantic (disabled in the default build).
Andre Noll [Mon, 2 Jun 2025 22:36:31 +0000 (00:36 +0200)]
Doxgen: Do not omit brief descriptions.
Commit 3107d2411a7a was a bit overzealous because with BRIEF_MEMBER_DESC
and REPEAT_BRIEF both set to NO the short text does not even make it into
the detailed description. This was unintended, so partially revert this change.
Andre Noll [Mon, 2 Jun 2025 19:42:21 +0000 (21:42 +0200)]
Merge topic branch t/wmadec into master
A few patches which remove unused code from the wma decoder and audio
format handler. Notably, noise coding was removed completely since
it was only used for unusual bit rates. Most likely, it never worked
in the first place.
* refs/heads/t/wmadec:
wmadec: Fix typo in comment.
wmadec: Remove a stale comment in wma_init().
wmadec: Kill pointless start/end computations.
wmadec: Remove noise coding.
wmadec: Simplify wma_init().
wmadec: Remove fft().
Andre Noll [Mon, 26 May 2025 18:38:37 +0000 (20:38 +0200)]
Shrink struct rmatt_event_data.
The aft event handler needs to know the bit number of the attribute which is
being removed in order to clear the bit in the afs info structure of each row
of the audio file table. The handler does not need to know the attribute's
name, though, and remove_attribute() already prints it, so remove this field
from the event data structure.
Andre Noll [Sun, 25 May 2025 17:29:57 +0000 (19:29 +0200)]
INSTALL: Remove installation instructions of lopsub.
These days, people should just install the Debian package. If lopsub is not
installed, the configure script prints detailed instructions about how to
obtain lopsub with and without apt.
Andre Noll [Wed, 19 Mar 2025 21:05:16 +0000 (22:05 +0100)]
Introduce VSS_NEW_AUDIO_FILE to fix playlist updates.
The playlist event handler handles afsi change events by moving the affected
entry to the end of the playlist. This is the right thing to do if the
event was triggered by virtual streaming system streaming a new file. It is
incorrect, however, if the event was triggered by a subcommand such as touch.
This commit introduces the new afs event type VSS_NEW_AUDIO_FILE to distinguish
between the two different use cases. The audio file table event handler
ignores the VSS_NEW_AUDIO_FILE event while the playlist event handler ignores
the AFSI_CHANGE event. The moods event handler treats both events equally,
Get rid of a pointless static one-liner function in playlist.c while at it.
Andre Noll [Sat, 24 May 2025 17:41:41 +0000 (19:41 +0200)]
Merge topic branch t/wmadec into next
Started on 2025-01-22
A few patches which remove unused code from the wma decoder and audio
format handler. Notably, noise coding was removed completely since
it was only used for unusual bit rates. Most likely, it never worked
in the first place.
* refs/heads/t/wmadec:
wmadec: Fix typo in comment.
wmadec: Remove a stale comment in wma_init().
wmadec: Kill pointless start/end computations.
Andre Noll [Sat, 24 May 2025 17:41:33 +0000 (19:41 +0200)]
Merge topic branch t/deprecate_setatt into next
A single patch which deprecates the setatt server subcommand. This subcommand
fails, for example, if the name of an audio file happens to end in '+'
or '-'. The replacement for setatt are the two new options to the touch
subcommand to set or unset attributes.
* refs/heads/t/deprecate_setatt:
server: Deprecate setatt in favor of touch.
Andre Noll [Thu, 22 May 2025 17:13:09 +0000 (19:13 +0200)]
Merge topic branch t/rm_sha1 into next
The series first drops the para_upgrade_db executable because it is no longer
needed. This removes the penultimate user of the sha1 infrastructure. The
remaining user is the handshake between para_client and para_server.
Since paraslash-0.7.0, client and server employ sha256 by default, but fall
back to sha1 in order to stay compatible to old 0.6.x versions. This series
instructs server and client to always employ sha256 as the hash algorithm,
breaking compatibility with 0.6.x clients. As a result, the sha1 hash algorithm
is no longer used anywhere, so the corresponding infrastructure is no longer
needed. This gets rid of a fair amount of code.
<!--
- The para_upgrade_db executable to convert old paraslash databases has
been removed. paraslash-0.7.0 was released more than three years ago, so
everybody should have upgraded by now.
- Authentication now rejects the weak sha1 hash algorithm, breaking
compatibility with 0.6.x versions. Older 0.7.x clients are still compatible
to current server versions and current clients can still talk to servers
running older 0.7.x versions.
-->
* refs/heads/t/rm_sha1:
Rename hash2 -> hash.
Remove sha1.
Remove para_upgrade_db.
aft: Compare the full hash, not just the first 20 bytes.
Andre Noll [Sun, 18 May 2025 18:17:12 +0000 (20:17 +0200)]
Remove sha1.
Server and client prefer sha256 in the authentication protocol since
paraslash-0.7.0, while 0.6.x clients and servers only know about sha1. This
patch drops the compatibility code which enabled old clients to connect to
new servers and vice versa.
Now the client code no longer checks whether the sha256 feature is supported,
but requests and uses the feature unconditionally. The server still announces
the sha256 feature and accepts the corresponding feature request, but uses
sha256 unconditionally.
With this approach older 0.7.x clients are still compatible to current
server versions and current clients can still talk to servers running older
0.7.x versions.
Andre Noll [Thu, 22 May 2025 16:47:09 +0000 (18:47 +0200)]
Merge branch 'master' into next
* master:
Improve documentation of set_max_chunk_size().
Warn about old (0.5.x or earlier) on-disk afhi.
doxyen: Completely suppress brief descriptions.
buffer_tree: Assert that we don't pass NULL to memcpy().
mp.c: Remove a dead store.
mood.c: Remove a dead store and fix the documentation of mood_load().
flac_afh: Check for possible integer overflows.
gcc-compat.h: Drop inline #define.
Andre Noll [Sun, 18 May 2025 18:12:24 +0000 (20:12 +0200)]
aft: Compare the full hash, not just the first 20 bytes.
In 0.7.0 the hash algorithm for the hash column of the audio file table
changed from the 20 byte sha1 to the 32 byte sha256. However, the audio file
selector kept calling hash_compare() as the comparator, which looks only at
the first 20 bytes of the buffers passed.
This omission is clearly a bug, but given that we still accept old clients
which only know about sha1, it's benign because the truncated sha256 should
not be worse than sha1. Fix the bug anyway.
Andre Noll [Wed, 14 May 2025 22:27:47 +0000 (00:27 +0200)]
aft: Pass correct afsi argument to AFSI_CHANGE event handlers.
Each time a new audio file is opened for streaming, we update the numplayed
and lastplayed fields of its afs info entry of the audio file table, then
update the global afsi and ahfi structures, then trigger an AFSI_CHANGE event,
which calls all table event handlers. The event handlers receive as arguments
a pointer to the old afsi and a pointer to the already modified aft row.
The AFSI_CHANGE event handler of the audio file table gets called in the
situation described above, and also via the touch and cpsi subcommands,
because these also change the afsi info structure and therefore trigger
AFSI_CHANGE events as well. The handler checks whether the affected audio
file is the current audio file, and if it is, extracts the modified afsi
from the audio file table into the global afsi structure.
The problem is that in case of the above "next audio file" scenario, the
old afsi pointer points to the global afsi structure, which gets updated
by the aft event handler. Therefore the event handlers which happen to run
after the event handler of the audio file table see the already updated afsi
through the old_afsi pointer.
Since the audio file table happens to be the first table of the 7-element
afs_tables[] array iterated by afs_event(), all six other event handlers see
the incorrect afsi. However, only the moods event handler looks at the old afsi
to update the mean and quadratic variation of the lastplayed and numplayed
values of the afs statistics. Due to the bug described above, the old and
new lastplayed and numplayed values coincide, and therefore the statistics
update is a no-op. In practice, at least for moods with many admissible files,
the values will only be slightly off, so the bug is rather benign.
Fix this by renaming the on-stack new_afsi to old_afsi, adjusting
initializations accordingly, and passing a pointer to this instance instead.
Andre Noll [Wed, 21 May 2025 18:36:52 +0000 (20:36 +0200)]
Improve documentation of set_max_chunk_size().
The old text implied that the function could be removed at some point, which
is not the case. Remove this part of the documentation and clarify what the
function actually does.
Andre Noll [Wed, 21 May 2025 18:23:23 +0000 (20:23 +0200)]
Warn about old (0.5.x or earlier) on-disk afhi.
Nine years ago, starting with commit 234647bb5, old on-disk entries are
reported with a notice to re-add the file in order to update the audio file
table. Bump the loglevel for now, and add a comment to turn the check into
a hard error eventually.
Andre Noll [Tue, 20 May 2025 20:47:46 +0000 (22:47 +0200)]
buffer_tree: Assert that we don't pass NULL to memcpy().
The buffer pointer cannot be NULL here because this only happens when the
buffer tree area is full, which is not the case thanks to the previous n <=
btr_pool_unused(btrp) check.