<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<title>zunzuncito - bugs</title>
	<subtitle>Wolf&#x27;s humming microblog</subtitle>
	<link href="https://zunzuncito.oriole.systems/tags/bugs/atom.xml" rel="self" type="application/atom+xml"/>
	<link href="https://zunzuncito.oriole.systems"/>
	<generator uri="https://www.getzola.org/">Zola</generator>
	<updated>2024-10-14T20:33:27+02:00</updated>
	<id>https://zunzuncito.oriole.systems/tags/bugs/atom.xml</id>
	<entry xml:lang="en">
		<author><name>wolf</name></author>
		<title>A plethora of bug fixes</title>
		<published>2024-10-14T20:33:27+02:00</published>
		<updated>2024-10-14T20:33:27+02:00</updated>
		<link href="https://zunzuncito.oriole.systems/24/" type="text/html"/>
		<id>https://zunzuncito.oriole.systems/24/</id>
		<content type="html">&lt;p&gt;For whatever reason I’ve been uncovering software bugs at an unprecedented rate
in the past 10 days. This is by no means a bad thing, I enjoy hunting down and
fixing bugs, but it does mean that the additional overhead of drafting a post
about each bug becomes a bit too much. So instead here’s a quick overview - the
linked patches and merge requests will have more information, if you are
interested.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;trash-size-calculation-in-kio&quot;&gt;Trash size calculation in KIO&lt;&#x2F;h3&gt;
&lt;p&gt;I noticed this one pretty much right after starting to use
&lt;a href=&quot;https:&#x2F;&#x2F;apps.kde.org&#x2F;dolphin&#x2F;&quot;&gt;Dolphin&lt;&#x2F;a&gt; but did not end up looking into it
until quite a bit later: when displaying the size of the items in the trash, the
application would always show 0 bytes. This would also cause the automated
cleanup of items to fail - Dolphin simply believed that the trash was empty.&lt;&#x2F;p&gt;
&lt;p&gt;KDE uses the &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;frameworks&#x2F;kio&quot;&gt;KIO&lt;&#x2F;a&gt; framework to provide
management of the trash. A &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;frameworks&#x2F;kio&#x2F;-&#x2F;commit&#x2F;0ab81b6bac953b12b454bef4874946bb7fc8db85&quot;&gt;recent
commit&lt;&#x2F;a&gt;
had changed the construction of a
&lt;a href=&quot;https:&#x2F;&#x2F;doc.qt.io&#x2F;qt-6&#x2F;qdiriterator.html&quot;&gt;QDirIterator&lt;&#x2F;a&gt; in a way that would
make it ignore all items when iterating over the trash directory. Thankfully the
fix was straightforward and it was &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;frameworks&#x2F;kio&#x2F;-&#x2F;merge_requests&#x2F;1729&quot;&gt;merged
quickly&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;git-shortlog-1-segfaults-outside-of-a-git-repository&quot;&gt;git-shortlog(1) segfaults outside of a git repository&lt;&#x2F;h3&gt;
&lt;p&gt;This one I uncovered as I was writing a small script to give me an overview of
commit authors in all the git repositories I had cloned locally. I was happily
scanning through my source directory using the
&lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-shortlog#Documentation&#x2F;git-shortlog.txt---authorltpatterngt&quot;&gt;&lt;code&gt;--author&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
flag for &lt;code&gt;git-shortlog(1)&lt;&#x2F;code&gt; to generate this, fully expecting git to complain
about the few non-git directories I had. Instead of complaints, however, I got a
segfault.&lt;&#x2F;p&gt;
&lt;p&gt;Turns out that a &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;git&#x2F;git&#x2F;commit&#x2F;ab274909d4&quot;&gt;change back in
May&lt;&#x2F;a&gt; stopped setting SHA1 as the
default object hash. This was done to progress the slow-moving &lt;a href=&quot;https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;hash-function-transition&quot;&gt;transition to
stronger hash functions&lt;&#x2F;a&gt; but
inadvertently broke &lt;code&gt;git-shortlog(1)&lt;&#x2F;code&gt; whose argument parsing machinery expected
a default hash algorithm to be set. I sent &lt;a href=&quot;https:&#x2F;&#x2F;public-inbox.org&#x2F;git&#x2F;20241011183445.229228-1-wolf@oriole.systems&#x2F;T&#x2F;#u&quot;&gt;a
patch&lt;&#x2F;a&gt;
upstream.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;an-infinite-loop-in-plasmashell&quot;&gt;An infinite loop in plasmashell&lt;&#x2F;h3&gt;
&lt;p&gt;I regularly use the
&lt;a href=&quot;https:&#x2F;&#x2F;docs.kde.org&#x2F;stable5&#x2F;en&#x2F;plasma-desktop&#x2F;plasma-desktop&#x2F;activities-interface.html&quot;&gt;Activities&lt;&#x2F;a&gt;
functionality in Plasma 6 and switch through my activities using Plasma’s
built-in activity manager. A couple of days ago I managed to make &lt;code&gt;plasmashell&lt;&#x2F;code&gt;,
the provider for Plasma’s desktop and task bar, freeze - I had hit the “up
arrow” key in the activity filter text box when there were no results visible.
This was perfectly reproducible, so I went to investigate.&lt;&#x2F;p&gt;
&lt;p&gt;The cause of the issue was a do-while construct not handling a specific sentinel
value, making it loop infinitely. For this one I also opened a &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;plasma&#x2F;plasma-desktop&#x2F;-&#x2F;merge_requests&#x2F;2574&quot;&gt;merge
request&lt;&#x2F;a&gt;
upstream.&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<author><name>wolf</name></author>
		<title>musl and a curious Rust segfault</title>
		<published>2024-10-02T18:42:07+02:00</published>
		<updated>2024-10-02T18:42:07+02:00</updated>
		<link href="https://zunzuncito.oriole.systems/23/" type="text/html"/>
		<id>https://zunzuncito.oriole.systems/23/</id>
		<content type="html">&lt;p&gt;About a week ago I noticed that &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;fd&quot;&gt;&lt;code&gt;fd(1)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, a
Rust-based alternative to &lt;a href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;findutils&#x2F;&quot;&gt;&lt;code&gt;find(1)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;,
would suddenly segfault on my &lt;a href=&quot;https:&#x2F;&#x2F;www.musl-libc.org&#x2F;&quot;&gt;musl&lt;&#x2F;a&gt;-based server
system. Usually a segfault is nothing particularly special to my eyes, but this
one was different. Even just having &lt;code&gt;fd(1)&lt;&#x2F;code&gt; attempt to print its help text was
enough to trigger it, and when I attempted to debug it with
&lt;a href=&quot;https:&#x2F;&#x2F;www.sourceware.org&#x2F;gdb&#x2F;&quot;&gt;&lt;code&gt;gdb(1)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, I saw the following:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;(gdb) run
Starting program: &amp;#x2F;usr&amp;#x2F;bin&amp;#x2F;fd

Program received signal SIGSEGV, Segmentation fault.
memcpy () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;string&amp;#x2F;x86_64&amp;#x2F;memcpy.s:18
warning: 18	..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;string&amp;#x2F;x86_64&amp;#x2F;memcpy.s: No such file or directory
(gdb) bt
#0  memcpy () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;string&amp;#x2F;x86_64&amp;#x2F;memcpy.s:18
#1  0x00007ffff7ab7177 in __copy_tls () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;env&amp;#x2F;__init_tls.c:66
#2  0x00007ffff7ab730d in static_init_tls () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;env&amp;#x2F;__init_tls.c:149
#3  0x00007ffff7aae89d in __init_libc () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;env&amp;#x2F;__libc_start_main.c:39
#4  0x00007ffff7aae9c0 in __libc_start_main () at ..&amp;#x2F;src_musl&amp;#x2F;src&amp;#x2F;env&amp;#x2F;__libc_start_main.c:80
#5  0x00007ffff74107f6 in _start ()
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So… the segfault is in musl, not in &lt;code&gt;fd&lt;&#x2F;code&gt;!?&lt;&#x2F;p&gt;
&lt;p&gt;I immediately checked whether other basic programs on the system worked. &lt;em&gt;They
did.&lt;&#x2F;em&gt; I checked when I last updated musl. &lt;em&gt;A couple of months ago, so that can’t
be it.&lt;&#x2F;em&gt; I checked specifically whether another Rust-based program worked. &lt;em&gt;It
did.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;fd(1)&lt;&#x2F;code&gt; had been updated pretty recently, and I remembered it working correctly
about a month ago, so maybe something specific to &lt;code&gt;fd(1)&lt;&#x2F;code&gt;’s usage of Rust
triggered this segfault in musl? I wanted to make sure I could reproduce this in
a development environment, so I cloned the &lt;code&gt;fd(1)&lt;&#x2F;code&gt; repository, built a debug
release, and ran it…&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;It worked.&lt;&#x2F;em&gt; Huh!?&lt;&#x2F;p&gt;
&lt;p&gt;I decided it was likely that &lt;a href=&quot;https:&#x2F;&#x2F;wiki.gentoo.org&#x2F;wiki&#x2F;Portage&quot;&gt;&lt;code&gt;portage&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;,
Gentoo’s package manager, was building the program differently, so I took care
to apply the same build flags to the development build. And what can I say:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;error: failed to run custom build command for `crossbeam-utils v0.8.20`

Caused by:
  process didn&amp;#x27;t exit successfully: `fd&amp;#x2F;target&amp;#x2F;[...]&amp;#x2F;build-script-build`
      (signal: 11, SIGSEGV: invalid memory reference)

&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;… it didn’t even get to build the &lt;code&gt;fd&lt;&#x2F;code&gt; binary proper. A segfault again, too.
What on earth was going on? Why didn’t this also happen in the &lt;code&gt;portage&lt;&#x2F;code&gt; build?&lt;&#x2F;p&gt;
&lt;p&gt;Thankfully I now had a reproducer, so I did the only sensible thing and started
removing random build flags until I got &lt;code&gt;fd&lt;&#x2F;code&gt; to build again. This was our
culprit:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;-Wl,-z,pack-relative-relocs
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Already pretty out of my depth considering the fact that I couldn’t fathom how
&lt;code&gt;fd(1)&lt;&#x2F;code&gt; got musl to segfault on &lt;code&gt;memcpy&lt;&#x2F;code&gt;, I now also found that a piece of the
puzzle required me to understand specific linker flags. &lt;em&gt;Oof.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Unsure what to do next I decided on a whim to compare the working and the
broken binary with &lt;code&gt;readelf(1)&lt;&#x2F;code&gt;. The most obvious difference was that the
working binary had its &lt;code&gt;.rela.dyn&lt;&#x2F;code&gt;
&lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Relocation_(computing)&quot;&gt;relocation&lt;&#x2F;a&gt; section
populated with entries whilst the broken one was missing &lt;code&gt;.rela.dyn&lt;&#x2F;code&gt; but had
&lt;code&gt;.relr.dyn&lt;&#x2F;code&gt; instead. At a loss, I stopped and went to do something else.&lt;&#x2F;p&gt;
&lt;p&gt;The story would probably have ended here had I not mentioned this conundrum to
&lt;a href=&quot;https:&#x2F;&#x2F;ahti.space&#x2F;~nortti&#x2F;&quot;&gt;my partner&lt;&#x2F;a&gt; later in the day. We decided to have
another look at the binaries. After some discussion we determined that the
working binary was dynamically linked whilst the broken one wasn’t. The other
working Rust-based program, &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep&quot;&gt;&lt;code&gt;rg(1)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;,
was also dynamically linked and had been built a while ago, so &lt;strong&gt;at some point
&lt;code&gt;portage&lt;&#x2F;code&gt; must have stopped producing Rust executables that were dynamically
linked&lt;&#x2F;strong&gt;. Finally some progress!&lt;&#x2F;p&gt;
&lt;p&gt;At this point we need some background. Early on, Rust decided to use the
&lt;code&gt;x86_64-unknown-linux-musl&lt;&#x2F;code&gt; target to provide statically-linked binaries that
would run on a wide range of systems. Whilst support for dynamically linked
executables on musl systems was &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;pull&#x2F;40113&quot;&gt;added back in
2017&lt;&#x2F;a&gt;, the default behaviour was
never changed, so Gentoo has to make sure to disable static linking by passing
the &lt;code&gt;target-feature=-crt-static&lt;&#x2F;code&gt; flag.&lt;&#x2F;p&gt;
&lt;p&gt;It does this in a system-wide fashion by setting an environment variable in
&lt;a href=&quot;https:&#x2F;&#x2F;wiki.gentoo.org&#x2F;wiki&#x2F;&#x2F;etc&#x2F;env.d&quot;&gt;&lt;code&gt;&#x2F;etc&#x2F;env.d&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;$ cat &amp;#x2F;etc&amp;#x2F;env.d&amp;#x2F;50rust-bin-1.80.1
LDPATH=&amp;quot;&amp;#x2F;usr&amp;#x2F;lib&amp;#x2F;rust&amp;#x2F;lib&amp;quot;
MANPATH=&amp;quot;&amp;#x2F;usr&amp;#x2F;lib&amp;#x2F;rust&amp;#x2F;man&amp;quot;
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=&amp;quot;-C target-feature=-crt-static&amp;quot;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This setting should therefore be picked up by &lt;code&gt;portage&lt;&#x2F;code&gt; as well, but when I
examined its build environment it was simply not there. So finally we come to
the last piece of the puzzle: a &lt;a href=&quot;https:&#x2F;&#x2F;gitweb.gentoo.org&#x2F;repo&#x2F;gentoo.git&#x2F;commit&#x2F;eclass&#x2F;cargo.eclass?id=27d469a2114b4ad0b3e682854c50c806753eb472&quot;&gt;recent
change&lt;&#x2F;a&gt;
in how &lt;code&gt;RUSTFLAGS&lt;&#x2F;code&gt; are set within &lt;code&gt;portage&lt;&#x2F;code&gt;. Here’s the important part:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;local -x CARGO_TARGET_&amp;quot;${TRIPLE}&amp;quot;_RUSTFLAGS=&amp;quot;-C strip=none -C linker=${LD_A[0]}&amp;quot;
[[ ${#LD_A[@]} -gt 1 ]] &amp;amp;&amp;amp; local CARGO_TARGET_&amp;quot;${TRIPLE}&amp;quot;_RUSTFLAGS+=&amp;quot;$(printf -- &amp;#x27; -C link-arg=%s&amp;#x27; &amp;quot;${LD_A[@]:1}&amp;quot;)&amp;quot;
local CARGO_TARGET_&amp;quot;${TRIPLE}&amp;quot;_RUSTFLAGS+=&amp;quot; ${RUSTFLAGS}&amp;quot;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Quoth the &lt;code&gt;bash(1)&lt;&#x2F;code&gt; manual:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Local variables “shadow” variables with the same name declared at previous
scopes.  For instance, a local variable declared in a function hides a global
variable of the same name: references and assignments refer to the local
variable, leaving the global variable unmodified.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;When previously the &lt;code&gt;RUSTFLAGS&lt;&#x2F;code&gt; environment variable was only touched when
cross-compiling, it was now overridden. To confirm, I edited the file in
question to include the previous value, and both &lt;code&gt;fd(1)&lt;&#x2F;code&gt; and &lt;code&gt;rg(1)&lt;&#x2F;code&gt; worked
again. Success!&lt;&#x2F;p&gt;
&lt;p&gt;This whole saga was also &lt;a href=&quot;https:&#x2F;&#x2F;bugs.gentoo.org&#x2F;940197&quot;&gt;reported&lt;&#x2F;a&gt; to the
Gentoo bug tracker and promptly fixed. A project for another day is figuring out
exactly how a change from static linking to dynamic linking causes segfaults
like this, because I sure would love to know the details.&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<author><name>wolf</name></author>
		<title>KDE Plasma 6 and two bugs</title>
		<published>2024-09-18T21:16:12+02:00</published>
		<updated>2024-09-18T21:16:12+02:00</updated>
		<link href="https://zunzuncito.oriole.systems/19/" type="text/html"/>
		<id>https://zunzuncito.oriole.systems/19/</id>
		<content type="html">&lt;p&gt;For the last couple of months I have been running &lt;a href=&quot;https:&#x2F;&#x2F;swaywm.org&#x2F;&quot;&gt;sway&lt;&#x2F;a&gt; on
my main desktop system after having been forced away from
&lt;a href=&quot;https:&#x2F;&#x2F;hub.darcs.net&#x2F;raichoo&#x2F;hikari&quot;&gt;hikari&lt;&#x2F;a&gt; because of its practically halted
development and incompatibility with newer
&lt;a href=&quot;https:&#x2F;&#x2F;gitlab.freedesktop.org&#x2F;wlroots&#x2F;wlroots&#x2F;&quot;&gt;wlroots&lt;&#x2F;a&gt; versions.&lt;&#x2F;p&gt;
&lt;p&gt;I never felt completely satisfied with it and the whole experience was rather
joyless, so about a week ago I decided to give &lt;a href=&quot;https:&#x2F;&#x2F;kde.org&#x2F;announcements&#x2F;megarelease&#x2F;6&#x2F;&quot;&gt;KDE Plasma
6&lt;&#x2F;a&gt; a try after a surprisingly
decent experience on the &lt;a href=&quot;https:&#x2F;&#x2F;neon.kde.org&#x2F;&quot;&gt;KDE Neon&lt;&#x2F;a&gt; live image.&lt;&#x2F;p&gt;
&lt;p&gt;Whilst undoubtedly greater in its complexity and code size than sway, to me
Plasma 6 seems like one of the last decent desktop environments still remaining.
It’s incredibly customisable (but still comes with good defaults), looks nice
out of the box, and most importantly seems to care about providing a nicely
integrated and featureful experience. This even includes a companion app on
Android, &lt;a href=&quot;https:&#x2F;&#x2F;kdeconnect.kde.org&#x2F;&quot;&gt;KDE Connect&lt;&#x2F;a&gt;. It remains to be seen
whether it will fully convince me in the long run, but for now I am very
satisfied with it.&lt;&#x2F;p&gt;
&lt;figure&gt;
&lt;a href=&quot;&#x2F;19&amp;#x2F;kde-plasma.png&quot;&gt;
		&lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;zunzuncito.oriole.systems&amp;#x2F;processed_images&amp;#x2F;kde-plasma.67631c40d6568bd3.jpg&quot; alt=&quot;A picture of the KDE Plasma 6 desktop
environment, with a browser window, a terminal, and an instance of Dolphin, a
file manager.&quot; &#x2F;&gt;
	&lt;&#x2F;a&gt;
	&lt;figcaption class=&quot;smaller&quot;&gt;KDE Plasma 6 with a few windows open&lt;&#x2F;figcaption&gt;
	&lt;&#x2F;figure&gt;
&lt;p&gt;This last week was mostly spent learning about the desktop environment and
setting everything up exactly how I want it to be, but there were two notable
bugs to squash as well.&lt;&#x2F;p&gt;
&lt;p&gt;The first one reared its ugly head once I enabled backwards-compatibility with
Qt5-based apps. I have a couple of such apps still, most prominently
&lt;a href=&quot;https:&#x2F;&#x2F;www.mumble.info&#x2F;&quot;&gt;Mumble&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;quassel-irc.org&#x2F;&quot;&gt;Quassel IRC&lt;&#x2F;a&gt;.
Once the latter was built against the KFramework libraries, no more
notifications were shown…&lt;&#x2F;p&gt;
&lt;p&gt;Fixing this ended up taking about two days, most of which were spent discovering
exactly how
&lt;a href=&quot;https:&#x2F;&#x2F;api.kde.org&#x2F;frameworks&#x2F;knotifications&#x2F;html&#x2F;index.html&quot;&gt;KNotifications&lt;&#x2F;a&gt;
work. KDE provides apps with a tighter integration to the notification service,
allowing users to specify which types of notifications to show, and how.
Applications specify their notifications by shipping an &lt;code&gt;&amp;lt;app&amp;gt;.notifyrc&lt;&#x2F;code&gt; file.
KDE ties this file to the application by matching its base name to the name
given to the application (usually through a call to
&lt;code&gt;QCoreApplication::applicationName&lt;&#x2F;code&gt; or when creating
&lt;a href=&quot;https:&#x2F;&#x2F;api.kde.org&#x2F;frameworks&#x2F;kcoreaddons&#x2F;html&#x2F;classKAboutData.html&quot;&gt;KAboutData&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;It turns out that Quassel had recently been
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quassel&#x2F;quassel&#x2F;commit&#x2F;020c163421691fa37330826df92ac0a248721290&quot;&gt;patched&lt;&#x2F;a&gt;
to fix an issue where desktop environments did not show its icon correctly. This
required a call to &lt;code&gt;setDesktopFileName&lt;&#x2F;code&gt; in &lt;code&gt;KAboutData&lt;&#x2F;code&gt; to make environments
aware of the connection. However, Quassel’s application name was
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quassel&#x2F;quassel&#x2F;commit&#x2F;020c163421691fa37330826df92ac0a248721290#diff-c72daad7d2269a2ee21584002ef1f30f4415335358a6c6f7e7296d3290a51a91R117&quot;&gt;changed in the same commit&lt;&#x2F;a&gt;,
severing its link with the name given through its &lt;code&gt;quassel.notifyrc&lt;&#x2F;code&gt; file. This
seems to have been done in addition to the &lt;code&gt;setDesktopFileName&lt;&#x2F;code&gt; call and was not
necessary to solve the issue the commit was trying to address.&lt;&#x2F;p&gt;
&lt;p&gt;I prepared a &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quassel&#x2F;quassel&#x2F;pull&#x2F;619&quot;&gt;pull request&lt;&#x2F;a&gt; fixing
this issue by reverting part of the offending commit.&lt;&#x2F;p&gt;
&lt;figure&gt;
&lt;a href=&quot;&#x2F;19&amp;#x2F;notification.png&quot;&gt;
		&lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;zunzuncito.oriole.systems&amp;#x2F;processed_images&amp;#x2F;notification.061a2c93574b054b.png&quot; alt=&quot;A picture of a
notification from Quassel IRC saying &amp;#x27;yay for notifications&amp;#x27;.&quot; &#x2F;&gt;
	&lt;&#x2F;a&gt;
	&lt;figcaption class=&quot;smaller&quot;&gt;Glad to
have these back&lt;&#x2F;figcaption&gt;
	&lt;&#x2F;figure&gt;
&lt;p&gt;The second bug I randomly came across whilst perusing &lt;code&gt;journalctl&lt;&#x2F;code&gt; and seeing
the following error from &lt;a href=&quot;https:&#x2F;&#x2F;apps.kde.org&#x2F;dolphin&#x2F;&quot;&gt;Dolphin&lt;&#x2F;a&gt;, KDE’s file
manager:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;QString(View)::contains(): called on an invalid QRegularExpression object
(pattern is &amp;#x27;\A(?:file:&amp;#x2F;&amp;#x2F;&amp;#x2F;home&amp;#x2F;wolf&amp;#x2F;[Z-A]&amp;#x2F;?)\z&amp;#x27;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Seeing this immediately made me wonder whether Dolphin plugs a URL straight into
a regular expression without escaping it, and the answer, of course,
&lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;system&#x2F;dolphin&#x2F;-&#x2F;blob&#x2F;5c069471fccc41051b967be69f95655b3e0b73ef&#x2F;src&#x2F;dolphinviewcontainer.cpp#L554-557&quot;&gt;is yes&lt;&#x2F;a&gt;.
I spent most of today’s afternoon hunting this issue down and preparing a &lt;a href=&quot;https:&#x2F;&#x2F;invent.kde.org&#x2F;system&#x2F;dolphin&#x2F;-&#x2F;merge_requests&#x2F;831&quot;&gt;merge
request&lt;&#x2F;a&gt; that fixes
it in an elegant way.&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<author><name>wolf</name></author>
		<title>Getting MPD to parse TIT1 in MP3 files</title>
		<published>2022-02-13T18:25:11+01:00</published>
		<updated>2022-02-13T18:25:11+01:00</updated>
		<link href="https://zunzuncito.oriole.systems/17/" type="text/html"/>
		<id>https://zunzuncito.oriole.systems/17/</id>
		<content type="html">&lt;p&gt;I have a pretty extensive music library that I manage with MPD, the &lt;a href=&quot;https:&#x2F;&#x2F;www.musicpd.org&#x2F;&quot;&gt;Music
Player Daemon&lt;&#x2F;a&gt;. For the longest time now I have also
been aware of &lt;a href=&quot;https:&#x2F;&#x2F;beets.readthedocs.io&#x2F;en&#x2F;stable&#x2F;&quot;&gt;&lt;code&gt;beets&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, another
management system for music libraries. I played around with it a few times but
never took the plunge to have it organize my entire collection.&lt;&#x2F;p&gt;
&lt;p&gt;A few days ago, whilst looking up a particularly obscure recording, I ended up
finding it on &lt;a href=&quot;https:&#x2F;&#x2F;musicbrainz.org&#x2F;&quot;&gt;MusicBrainz&lt;&#x2F;a&gt; and decided to give beets,
which integrates very tightly with that service, another serious try.&lt;&#x2F;p&gt;
&lt;p&gt;Yesterday I finally completed a first rough import of my entire library (which
encompasses about 20,000 songs in 1400 albums). Given the integration with
MusicBrainz, I now try to map every album to a release in their database. If I
can’t find it there, I instead fall back to an old favourite of mine,
&lt;a href=&quot;https:&#x2F;&#x2F;www.discogs.com&#x2F;&quot;&gt;Discogs&lt;&#x2F;a&gt;. &lt;code&gt;beets&lt;&#x2F;code&gt; will automatically update and
correct any tags once I select the right release.&lt;&#x2F;p&gt;
&lt;p&gt;Whilst importing I decided that I should make more use of the “Grouping” tag as
a way to organize albums into an arbitrary group. This is useful if a series of
media features music that was composed by multiple artists. By matching on the
&lt;em&gt;Haibane Renmei&lt;&#x2F;em&gt; grouping, for example, I can find all music that was made for
that show, without having to keep artist names in mind.&lt;&#x2F;p&gt;
&lt;p&gt;“Grouping” seemed well-supported in MPD, but whilst updating some albums that I
(sadly) only have in MP3 format, I found that MPD would not add the grouping
information to its database.&lt;&#x2F;p&gt;
&lt;p&gt;As per the &lt;a href=&quot;https:&#x2F;&#x2F;id3.org&#x2F;id3v2.4.0-frames&quot;&gt;ID3v2.4 standard&lt;&#x2F;a&gt;, the &lt;code&gt;TIT1&lt;&#x2F;code&gt;
frame is used for this kind of information in MP3 files. Sure enough, that tag
was set correctly by &lt;code&gt;beets&lt;&#x2F;code&gt;, and both &lt;code&gt;mutagen-inspect&lt;&#x2F;code&gt; and &lt;code&gt;ffprobe&lt;&#x2F;code&gt; found it.
MPD, however, even though
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MusicPlayerDaemon&#x2F;MPD&#x2F;issues&#x2F;563&quot;&gt;this PR&lt;&#x2F;a&gt; had been merged almost
3 years ago, refused to pick it up.&lt;&#x2F;p&gt;
&lt;p&gt;After having the &lt;code&gt;#mpd&lt;&#x2F;code&gt; IRC channel sanity-check my configuration, I
investigated some more. Perhaps my version of &lt;code&gt;libid3tag&lt;&#x2F;code&gt; was outdated. It
wasn’t. Perhaps there were some encoding issues, but then why would other tags
from the same file work fine? Couldn’t be that either. I hooked up GDB and found
that
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MusicPlayerDaemon&#x2F;MPD&#x2F;commit&#x2F;319c9699fb09e7c35e2aafa022ff8e1f0dcfcd8b#diff-740cf5f8b0a6d5c79ba81c3c4325726dbac10a838f5f704b630f6a8967574b60R320&quot;&gt;this line from the PR&lt;&#x2F;a&gt;
was never actually reached at all!&lt;&#x2F;p&gt;
&lt;p&gt;I decided to look a bit closer at how exactly MPD reads tags. The specific
&lt;code&gt;scan_id3_tag&lt;&#x2F;code&gt; function that the PR modified is only called in two places,
&lt;code&gt;plugins&#x2F;DsdLib.cxx&lt;&#x2F;code&gt; and (indirectly) in &lt;code&gt;plugins&#x2F;MadDecoderPlugin.cxx&lt;&#x2F;code&gt;. I had
neither of these decoders installed, so… MPD just never got to read anything.&lt;&#x2F;p&gt;
&lt;p&gt;Yet how was I getting &lt;em&gt;any&lt;&#x2F;em&gt; tags, then?&lt;&#x2F;p&gt;
&lt;p&gt;After some spelunking in the decoder plugin folders and with the fact on my mind
that the only decoder I had actually compiled in was
&lt;a href=&quot;https:&#x2F;&#x2F;ffmpeg.org&#x2F;&quot;&gt;FFmpeg&lt;&#x2F;a&gt;, something dawned on me. Perhaps it was FFmpeg
that was reading the tags.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MusicPlayerDaemon&#x2F;MPD&#x2F;blob&#x2F;ad4cf79cc967f973f264efe1024f5be1c9a962ec&#x2F;src&#x2F;decoder&#x2F;plugins&#x2F;FfmpegMetaData.cxx#L75-L94&quot;&gt;Indeed it was&lt;&#x2F;a&gt;.
Turns out that FFmpeg does all of the heavy lifting here, and MPD really just
asks it for any metadata and &lt;strong&gt;parses the ones it understands&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MPD uses “grouping” as a cross-format identifier for grouping information. It
expects that particular string to be a key in the &lt;code&gt;AVDictionary&lt;&#x2F;code&gt; returned by
FFmpeg
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MusicPlayerDaemon&#x2F;MPD&#x2F;blob&#x2F;ad4cf79cc967f973f264efe1024f5be1c9a962ec&#x2F;src&#x2F;decoder&#x2F;plugins&#x2F;FfmpegMetaData.cxx#L61-L62&quot;&gt;here&lt;&#x2F;a&gt;.
Crucially, FFmpeg
&lt;a href=&quot;https:&#x2F;&#x2F;git.ffmpeg.org&#x2F;gitweb&#x2F;ffmpeg.git&#x2F;blob&#x2F;68595b46cb374658432fff998e82e5ff434557ac:&#x2F;libavformat&#x2F;id3v2.c#l64&quot;&gt;does not expose&lt;&#x2F;a&gt;
&lt;code&gt;TIT1&lt;&#x2F;code&gt; as “grouping” in its metadata conversion table, having MPD drop &lt;code&gt;TIT1&lt;&#x2F;code&gt; on
the floor like a hot potato.&lt;&#x2F;p&gt;
&lt;p&gt;It is debatable where this particular bug should be fixed. I decided to send
&lt;a href=&quot;https:&#x2F;&#x2F;ffmpeg.org&#x2F;pipermail&#x2F;ffmpeg-devel&#x2F;2022-February&#x2F;292948.html&quot;&gt;a patch&lt;&#x2F;a&gt;
upstream to FFmpeg, given that more than just MPD can benefit from a fix there.
For the next poor soul I also prepared
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MusicPlayerDaemon&#x2F;MPD&#x2F;pull&#x2F;1439&quot;&gt;a PR&lt;&#x2F;a&gt;
that clarifies how exactly MPD reads metadata.&lt;&#x2F;p&gt;
</content>
	</entry>
</feed>
