See test script below. Reproducible: Always Steps to Reproduce: #! /bin/bash cd /tmp export XDG_CONFIG_HOME=$PWD XDG_DATA_DIRS=$PWD XDG_DATA_HOME=$PWD mkdir applications echo 'Exec=true a %u' > applications/a.desktop echo 'MimeType=x/a;x/b;x/c;' >> applications/a.desktop echo 'Exec=true b %u' > applications/b.desktop echo 'MimeType=x/a;x/b;x/c;' >> applications/b.desktop xdg-mime query default x/a xdg-mime default b.desktop x/a xdg-mime query default x/a rm -rf applications Actual Results: a.desktop a.desktop Expected Results: a.desktop b.desktop Fails since installing "=x11-misc/xdg-utils-1.2.1-r1". Definitely worked with "=x11-misc/xdg-utils-1.1.3_p20200220-r1" and most probably also with "=x11-misc/xdg-utils-1.1.3_p20210805-r2".
Thank you. Reported upstream as https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/252.
(In reply to Sam James from comment #1) > Thank you. Reported upstream as > https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/252. Bisected to https://gitlab.freedesktop.org/xdg/xdg-utils/-/commit/9b7d253ca07b80fbc201c5cf5b7f14a49bd09b3f and reverting it restores the old behaviour...
Rainer, could you try https://gitlab.freedesktop.org/xdg/xdg-utils/-/merge_requests/115.patch in /etc/portage/patches/x11-misc/xdg-utils/bug931673.patch, re-emerge xdg-utils, and see if it helps? Thanks.
Sadly, it didn't work: # emerge --changed-use --update x11-misc/xdg-utils [ebuild U ] x11-misc/xdg-utils-1.2.1-r1 [1.1.3_p20210805-r2] Would you like to merge these packages? [Yes/No] y >>> Verifying ebuild manifests >>> Emerging (1 of 1) x11-misc/xdg-utils-1.2.1-r1::gentoo >>> Failed to emerge x11-misc/xdg-utils-1.2.1-r1, Log file: >>> '/var/log/portage/build/x11-misc/xdg-utils-1.2.1-r1:20240513-143132.log' * Error messages for package x11-misc/xdg-utils-1.2.1-r1: * ERROR: x11-misc/xdg-utils-1.2.1-r1::gentoo failed (prepare phase): * patch -p1 failed with /etc/portage/patches/x11-misc/xdg-utils/bug931673.patch * * Call stack: * ebuild.sh, line 136: Called src_prepare * environment, line 1674: Called default * phase-functions.sh, line 872: Called default_src_prepare * phase-functions.sh, line 948: Called __eapi8_src_prepare * environment, line 357: Called eapply_user * environment, line 842: Called eapply '/etc/portage/patches/x11-misc/xdg-utils/bug931673.patch' * environment, line 805: Called _eapply_patch '/etc/portage/patches/x11-misc/xdg-utils/bug931673.patch' * environment, line 743: Called __helpers_die 'patch -p1 failed with /etc/portage/patches/x11-misc/xdg-utils/bug931673.patch' * isolated-functions.sh, line 112: Called die * The specific snippet of code: * die "$@" ... # Not sure what I did wrong. But afterwards manually applying the patch to the still unchanged file "/var/tmp/.../scripts/xdg-utils-common.in" did succeed. So the patch WAS applicable :-\ But I'm again back to version 1.1.3_p20210805-r2 which by the way works flawlessly.
Can you show me the full build.log? It should have more info as to why it failed. Maybe just try clone it from git and do './configure && make' and point your script to the version it just made?
(In reply to Sam James from comment #5) > Can you show me the full build.log? It should have more info as to why it > failed. Not really: ... * die "$@" * * If you need support, post the output of `emerge --info '=x11-misc/xdg-utils-1.2.1-r1::gentoo'`, * the complete build log and the output of `emerge -pqv '=x11-misc/xdg-utils-1.2.1-r1::gentoo'`. * The complete build log is located at '/var/log/portage/build/x11-misc/xdg-utils-1.2.1-r1:20240513-143132.log'. * For convenience, a symlink to the build log is located at '/var/tmp/portage/x11-misc/xdg-utils-1.2.1-r1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/x11-misc/xdg-utils-1.2.1-r1/temp/environment'. * Working directory: '/var/tmp/portage/x11-misc/xdg-utils-1.2.1-r1/work/xdg-utils-v1.2.1' * S: '/var/tmp/portage/x11-misc/xdg-utils-1.2.1-r1/work/xdg-utils-v1.2.1' > > Maybe just try clone it from git and do './configure && make' and point your > script to the version it just made? Wasn't that what you already successfully did by bisecting using my 12-lines test script and reverting a particular changeset?
That part you pasted is not the build.log, it's part of the terminal. The build.log (the path of which is given in the output) should include the failed patch output. wrt testing: I was assuming you had an original case which was worth testing too, and not so simplified. If it really was almost identical to the thing you posted in your first comment, then fair enough, I guess?
(In reply to Sam James from comment #7) > That part you pasted is not the build.log, it's part of the terminal. The > build.log (the path of which is given in the output) should include the > failed patch output. Sorry, no. Both snippets together make up the complete contents of file "/var/log/portage/build/x11-misc/xdg-utils-1.2.1-r1:20240513-143132.log". > wrt testing: I was assuming you had an original case which was worth testing > too, and not so simplified. If it really was almost identical to the thing > you posted in your first comment, then fair enough, I guess? The 12-lines test script was an excerpt from a real test script solely used to test a script of mine. This test script failed, and after some head scratching and experimenting I decided that "xdg-mime default" had just started to do the wrong thing :-) So there really isn't a "real life case" involved.
Thank you for explaining!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43a36b89fbd4f4a108e70381e80c6e261256f407 commit 43a36b89fbd4f4a108e70381e80c6e261256f407 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-06-01 03:11:41 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-06-01 03:11:41 +0000 x11-misc/xdg-utils: fix xdg-mime default regression Closes: https://bugs.gentoo.org/931673 Signed-off-by: Sam James <sam@gentoo.org> .../files/xdg-utils-1.2.1-xdg-mime-default.patch | 143 +++++++++++++++++++++ x11-misc/xdg-utils/xdg-utils-1.2.1-r2.ebuild | 92 +++++++++++++ 2 files changed, 235 insertions(+)
Sorry, but I cannot confirm this. I upgraded to non-stable "=x11-misc/xdg-utils-1.2.1-r2", even booted my system, but my little test script still outputs a.desktop a.desktop
No, sorry, forget that, it now returns b.desktop b.desktop The first (implicit) default setting seems to be (now?) arbitrary. But explicitly setting xdg-mime default a.desktop x/a xdg-mime query default x/a now returns a.desktop
Seems not to be my day :-( I now added "xdg-mime --version" to stop the confusion and also added another change of the default: #! /bin/bash cd /tmp export XDG_CONFIG_HOME=$PWD XDG_DATA_DIRS=$PWD XDG_DATA_HOME=$PWD mkdir applications echo 'Exec=true a %u' > applications/a.desktop echo 'MimeType=x/a;x/b;x/c;' >> applications/a.desktop echo 'Exec=true b %u' > applications/b.desktop echo 'MimeType=x/a;x/b;x/c;' >> applications/b.desktop xdg-mime --version xdg-mime query default x/a xdg-mime default a.desktop x/a xdg-mime query default x/a xdg-mime default b.desktop x/a xdg-mime query default x/a rm -rf applications Results: xdg-mime 1.2.1 a.desktop a.desktop a.desktop xdg-mime 1.1.3+ b.desktop a.desktop b.desktop I cannot say for sure whether in my earlier tests the first output line (before a default was set) was really "a.desktop". Could this be undetermined? But in any case the new version still ignores setting the default.
(In reply to Rainer W from comment #13) I've meanwhile tested x11-misc/xdg-utils-1.2.1-r6 and it still refuses to set the default to "b.desktop" when running the test script below: > ... > #! /bin/bash > cd /tmp > export XDG_CONFIG_HOME=$PWD XDG_DATA_DIRS=$PWD XDG_DATA_HOME=$PWD > mkdir applications > echo 'Exec=true a %u' > applications/a.desktop > echo 'MimeType=x/a;x/b;x/c;' >> applications/a.desktop > echo 'Exec=true b %u' > applications/b.desktop > echo 'MimeType=x/a;x/b;x/c;' >> applications/b.desktop > xdg-mime --version > xdg-mime query default x/a > xdg-mime default a.desktop x/a > xdg-mime query default x/a > xdg-mime default b.desktop x/a > xdg-mime query default x/a > rm -rf applications > > Results: > > xdg-mime 1.2.1 > a.desktop > a.desktop > a.desktop > > xdg-mime 1.1.3+ > b.desktop > a.desktop > b.desktop So I've again downgraded to x11-misc/xdg-utils-1.1.3_p20210805-r2 :-(
Please report it upstream.
(In reply to Sam James from comment #15) > Please report it upstream. No longer necessary. I've meanwhile searched the Web for XDG documentation and internals and found a few hints what could have gone wrong with my test scripts. As usual all hints but the last did not help, and that last hint eventually uncovered that "xdg-utils" version 1.2.1 is just more picky with respect to what it regards a valid desktop file: while old version 1.1.3 accepts my minimalistic desktop files which only contained the two assignments "Exec=..." and "MimeType=...", new version 1.2.1 now rejects these desktop files because they don't start with the line "[Desktop Entry]" (though it doesn't bother throwing any error messages). So prefixing my two test desktop files with this line finally made my test script work with both versions. Sorry for the noise ...
Thank you for the closure/update!