FS#54440 - [asunder] Impossible to launch

Attached to Project: Community Packages
Opened by jerem (jerem1313) - Tuesday, 13 June 2017, 20:19 GMT
Last edited by Xyne (Xyne) - Sunday, 02 July 2017, 18:58 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Xyne (Xyne)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hello
Can not run Asunder Version 2.9.3
Return of the terminal
[Arch @ arch]: ~> $ asunder
Warning: could not load config file: Wrong address
Fatal error: g_strdup_printf () failed. Out of memory.
[Arch @ arch]: ~> $

Bug also reported here also
https://bbs.archlinux.org/viewtopic.php?id=227217

My archlinux is installed today
Missing dependencies ??
Or asunder bug ??

This is my first bug report
thank you ;)
This task depends upon

Closed by  Xyne (Xyne)
Sunday, 02 July 2017, 18:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  fixed upstream with 2.9.1
Comment by WorMzy Tykashi (WorMzy) - Wednesday, 14 June 2017, 08:01 GMT
This only seems to affect users who have never previously run asunder, and seems to be caused by asunder trying to read cache files that don't exist yet. e.g.

-----

[...]
futex(0x7ff1d7f704a8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ff1d7f704a8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
access("/home/wormzy/.cache/asunder/album_artist", F_OK) = -1 ENOENT (No such file or directory)
access("/home/wormzy/.asunder_album_artist", F_OK) = -1 ENOENT (No such file or directory)
write(2, "Fatal error: g_strdup_printf() f"..., 54Fatal error: g_strdup_printf() failed. Out of memory.
) = 54
getpid() = 6460
getpid() = 6460
exit_group(-1) = ?
+++ exited with 255 +++

-----

A workaround is to create three cache files that it is looking for:

mkdir -p ~/.cache/asunder/
touch ~/.cache/asunder/album_artist ~/.cache/asunder/album_title ~/.cache/asunder/album_genre

Asunder can then be launched successfully.
Comment by jerem (jerem1313) - Wednesday, 14 June 2017, 08:57 GMT
thank you for your reply
Thanks to the command, Asunder launches without problems :)
And is functional
Thank you and sorry for my english, I am french.
Comment by Xyne (Xyne) - Saturday, 17 June 2017, 20:51 GMT
I have contacted the maintainer. I will post an update when I get a reply.
Comment by Andrew Smith (AndrewSmith) - Wednesday, 28 June 2017, 01:01 GMT
Hi guys. Thanks for the bug report. I got an email from another Arch user with the same bug.

But I can't reproduce it on Linux Mint.

Any chance one of you can run asunder in gdb and post a backtrace here?

I wanted to try Arch for a while, and maybe this is a good time, but this bug will be fixed quicker if you don't have to wait for that :)
Comment by WorMzy Tykashi (WorMzy) - Wednesday, 28 June 2017, 09:01 GMT
Hi Andrew, thanks for posting! Unfortunately running the application with gdb does not produce a backtrace:

(gdb) run
Starting program: /usr/bin/asunder
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

(asunder:8287): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",

(asunder:8287): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
Warning: could not load config file: Bad address
Fatal error: g_strdup_printf() failed. Out of memory.
[Inferior 1 (process 8287) exited with code 0377]
(gdb) bt
No stack.

----------
I'm not too familiar with debugging, and the bug tracker lacks code tags, but bear with me. If I recompile without optimization, add a break point to read_completion_file, and step from there, I get:

(gdb) break read_completion_file
Breakpoint 1 at 0x41ebdd: file completion.c, line 81.
(gdb) run
Starting program: /usr/bin/asunder
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

(asunder:14481): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",

(asunder:14481): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
Warning: could not load config file: Bad address

Breakpoint 1, read_completion_file (list=0x7612c0, name=0x41f7f6 "album_artist") at completion.c:81
81 {
(gdb) step
89 file = get_completion_filename_on_load(name);
(gdb)
get_completion_filename_on_load (name=0x41f7f6 "album_artist") at completion.c:38
38 {
(gdb)
40 const char * xdg_cache_home = g_getenv("XDG_CACHE_HOME");
(gdb)
41 gchar *result_filename = NULL;
(gdb)
48 filename = g_strdup_printf("asunder_%s", name);
(gdb)
49 dot_filename = g_strdup_printf(".%s", filename);
(gdb)
50 user_cache_filename = g_build_filename(g_get_user_cache_dir(), "asunder", name, NULL);
(gdb)
51 home_folder_filename = g_build_filename(g_getenv("HOME"), dot_filename, NULL);
(gdb)
52 g_free(dot_filename);
(gdb)
54 xdg_cache_home_filename = g_build_filename(xdg_cache_home, "asunder", filename, NULL);
(gdb)
56 if (g_file_test(user_cache_filename, G_FILE_TEST_EXISTS)) {
(gdb)
59 } else if (xdg_cache_home == NULL || *xdg_cache_home == '\0') {
(gdb)
61 if (g_file_test(home_folder_filename, G_FILE_TEST_EXISTS)) {
(gdb)
69 g_free(filename);
(gdb)
70 g_free(user_cache_filename);
(gdb)
71 g_free(home_folder_filename);
(gdb)
72 g_free(xdg_cache_home_filename);
(gdb)
74 snprintf(logStr, 1024, "using completion file name: %s\n", result_filename);
(gdb)
75 debugLog(logStr);
(gdb)
debugLog (msg=0x7fffffffd4d0 "using completion file name: (null)\n") at util.c:33
33 if(global_prefs->do_log)
(gdb)
35 }
(gdb)
get_completion_filename_on_load (name=0x41f7f6 "album_artist") at completion.c:76
76 return result_filename;
(gdb)
77 }
(gdb)
read_completion_file (list=0x7612c0, name=0x41f7f6 "album_artist") at completion.c:90
90 if (file == NULL)
(gdb)
91 fatalError("g_strdup_printf() failed. Out of memory.");
(gdb)
fatalError (message=0x4244a8 "g_strdup_printf() failed. Out of memory.") at util.c:39
39 fprintf(stderr, "Fatal error: %s\n", message);
(gdb)
Fatal error: g_strdup_printf() failed. Out of memory.
40 exit(-1);
(gdb)
[Inferior 1 (process 14481) exited with code 0377]

----------
Stepping though, it seems that xdg_cache_home_filename is never actually set:

[...]
(gdb)
54 xdg_cache_home_filename = g_build_filename(xdg_cache_home, "asunder", filename, NULL);
(gdb)
56 if (g_file_test(user_cache_filename, G_FILE_TEST_EXISTS)) {
(gdb) print xdg_cache_home_filename
$3 = (gchar *) 0x7b34e0 ""
(gdb) print xdg_cache_home
$4 = 0x0

----------
And since user_cache_filename [(gchar *) 0x7bc510 "/home/wormzy/.cache/asunder/album_artist"] doesn't exist, and home_folder_filename [(gchar *) 0x7bc560 "/home/wormzy/.asunder_album_artist"] doesn't exist, result_filename gets set to xdg_cache_home_filename [(gchar *) 0x7b34e0 ""].

If I manually set XDG_CACHE_HOME=/home/wormzy/.cache then asunder successfully launches. So, it seems that something changed in Arch's ecosystem and XDG_CACHE_HOME is no longer set by default (I'll see if I can find out what should be setting this environment variable), and asunder is falling over because of it.

TLDR: I guess it's up to you whether you want to add some resiliency to asunder's code to cope with the possibility of XDG_CACHE_HOME not being set.
Comment by Andrew Smith (AndrewSmith) - Wednesday, 28 June 2017, 14:46 GMT
Thanks WorMzy. That code doesn't look right to me, it doesn't account for all cases - which resulted in the crash you got. Can you please try it with the attached patch applied and let me know if it works for you?

With the patch it should only fail if the home directory isn't set, in which case I think nothing would work anyway.

Thanks in advance.
Comment by WorMzy Tykashi (WorMzy) - Wednesday, 28 June 2017, 16:38 GMT
Thanks Andrew, I've tried that patch on my laptop (never run asunder) and it does the trick -- asunder complains that it can't open config file (No such file or directory) but then launches successfully.
Comment by Andrew Smith (AndrewSmith) - Wednesday, 28 June 2017, 17:00 GMT
Thanks for trying it. Could you please confirm that your cache files do get created? I think you'll need an audio CD.
Comment by WorMzy Tykashi (WorMzy) - Wednesday, 28 June 2017, 19:57 GMT
No problem. I can confirm that the cache files get created (in ~/.cache/asunder/) when ripping an audio CD.
Comment by Andrew Smith (AndrewSmith) - Saturday, 01 July 2017, 02:35 GMT
Thanks everyone. I've released 2.9.1 on my website which includes this fix.
Comment by Xyne (Xyne) - Sunday, 02 July 2017, 18:57 GMT
Thanks for the fix, Andrew! And thanks for the testing, WorMzy!
The new package will be release shortly.

Loading...