Discussion:
segfault on startup with resume view set to "browser" v 2.4.1
yawfle
2011-07-19 13:26:50 UTC
Permalink
Hi.

Today I got a segfault error when starting cmus 2.4.1, strace showed it
trying to load the resume file, so I deleted that and cmus started up
fine. After a litle investigation, it appears that this happens when the
view saved in the resume file is set to browser. Didn't see this posted
anywhere already, sorry if it's a repeat.

cheers,

yawfle
Johannes Weißl
2011-07-20 13:08:23 UTC
Permalink
Hi!
Post by yawfle
Today I got a segfault error when starting cmus 2.4.1, strace showed it
trying to load the resume file, so I deleted that and cmus started up
fine. After a litle investigation, it appears that this happens when the
view saved in the resume file is set to browser. Didn't see this posted
anywhere already, sorry if it's a repeat.
No, the error hasn't been discovered yet! I tried to reproduce it, but it
works fine if "browser" is set as view in "resume". Can you always
reproduce this? It would be cool if you could send either the strace
output, or better, a gdb backtrace to fix this...

Thanks for reporting!


Greetings,
Johannes
yawfle
2011-07-20 18:37:48 UTC
Permalink
Yes, I can always reproduce this on my system, slackware 13.37. I just now tried clearing the library, then deleting all configuration files, then recompiling cmus, and in all cases it still behaved the same. Attached is the output from strace, with contents of home directory snipped (behavior is the same when starting from other directories). I don't know much about generating gdb backtraces, but if I get a chance I'll look into it.

I really, really love cmus, by the way. :)
--
yawfle
Post by Johannes Weißl
Hi!
Post by yawfle
Today I got a segfault error when starting cmus 2.4.1, strace showed it
trying to load the resume file, so I deleted that and cmus started up
fine. After a litle investigation, it appears that this happens when the
view saved in the resume file is set to browser. Didn't see this posted
anywhere already, sorry if it's a repeat.
No, the error hasn't been discovered yet! I tried to reproduce it, but it
works fine if "browser" is set as view in "resume". Can you always
reproduce this? It would be cool if you could send either the strace
output, or better, a gdb backtrace to fix this...
Thanks for reporting!
Greetings,
Johannes
Johannes Weißl
2011-07-20 19:00:31 UTC
Permalink
Hi,
Post by yawfle
Yes, I can always reproduce this on my system, slackware 13.37. I just
now tried clearing the library, then deleting all configuration files,
then recompiling cmus, and in all cases it still behaved the same.
Attached is the output from strace, with contents of home directory
snipped (behavior is the same when starting from other directories). I
don't know much about generating gdb backtraces, but if I get a chance
I'll look into it.
Strange. Are you using the latest git master? It shouldn't affect the
bug, but all the latest fixes are there, so it is always a good idea!
It turns out that the strace output isn't too helpful, this is how you
generate gdb backtraces:

Configure with debug CFLAGS:
CFLAGS="-O0 -g" ./configure [...]

Then run cmus with gdb:
gdb --args /path/to/self-compiled/cmus

After the segfault type "backtrace" in gdb

This would be very helpful to fix the bug!
Post by yawfle
I really, really love cmus, by the way. :)
Thanks :-)!


Johannes
yawfle
2011-07-21 12:53:43 UTC
Permalink
I had been using the 2.4.1 release, but I built the git master for the
gdb stuff, since it still exhibits the bug. The backtrace is attached.
If nobody else can reproduce this, then maybe it's something about my
system ncurses (5.9) and unicode support or something, since slackware
is pretty conservative about adopting that stuff sometimes... just a
guess. Anyway, cmus is working fine otherwise, so it's not a big
problem for me.
--
yawfle
Post by Johannes Weißl
Hi,
Post by yawfle
Yes, I can always reproduce this on my system, slackware 13.37. I
just now tried clearing the library, then deleting all configuration
files, then recompiling cmus, and in all cases it still behaved the
same. Attached is the output from strace, with contents of home
directory snipped (behavior is the same when starting from other
directories). I don't know much about generating gdb backtraces, but
if I get a chance I'll look into it.
Strange. Are you using the latest git master? It shouldn't affect the
bug, but all the latest fixes are there, so it is always a good idea!
It turns out that the strace output isn't too helpful, this is how you
Configure with debug CFLAGS: CFLAGS="-O0 -g" ./configure [...]
Then run cmus with gdb: gdb --args /path/to/self-compiled/cmus
After the segfault type "backtrace" in gdb
This would be very helpful to fix the bug!
Post by yawfle
I really, really love cmus, by the way. :)
Thanks :-)!
Johannes
Johannes Weißl
2011-07-21 23:04:35 UTC
Permalink
Hi,
Post by yawfle
I had been using the 2.4.1 release, but I built the git master for the
gdb stuff, since it still exhibits the bug. The backtrace is attached.
If nobody else can reproduce this, then maybe it's something about my
system ncurses (5.9) and unicode support or something, since slackware
is pretty conservative about adopting that stuff sometimes... just a
guess.
Thanks for the gdb backtrace, I was able to solve the problem! Your
guess was good, the bug was triggered in the non-utf8 code (which e.g.
I'm not using). But the real reason for the crash is my resume feature:
The UI is initialized after the view is set, which causes the COLS
(columns) value to take random values (in you case "-2", which is passed
to memcpy and leads to the segfault). So my fix is to initialize the UI
before the resume functionality. This also leads to a more instant
startup, since the library is now added after the UI started.
Post by yawfle
Anyway, cmus is working fine otherwise, so it's not a big problem for
me.
Well, even small bugs are bugs :-). Thanks for the report!
Is it working for you with this patch?


@Gregory: Could you maybe release 2.4.2? There a couple of pretty
important fixes since 2.4.1, especially the avcodec patch. More and more
distributions are starting to update, and cmus will fail to compile
otherwise.


Johannes
Johannes Weißl
2011-07-21 23:06:29 UTC
Permalink
Reported-by: yawfle <***@nospammail.net>
---
ui_curses.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ui_curses.c b/ui_curses.c
index 2c57b7e..361bf7a 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -2225,20 +2225,12 @@ static void init_all(void)
if (!soft_vol)
mixer_open();

- if (resume_cmus)
- resume_load();
-
lib_autosave_filename = xstrjoin(cmus_config_dir, "/lib.pl");
pl_autosave_filename = xstrjoin(cmus_config_dir, "/playlist.pl");
play_queue_autosave_filename = xstrjoin(cmus_config_dir, "/queue.pl");
pl_filename = xstrdup(pl_autosave_filename);
lib_filename = xstrdup(lib_autosave_filename);

- if (resume_cmus)
- cmus_add(play_queue_append, play_queue_autosave_filename, FILE_TYPE_PL, JOB_TYPE_QUEUE);
- cmus_add(pl_add_track, pl_autosave_filename, FILE_TYPE_PL, JOB_TYPE_PL);
- cmus_add(lib_add_track, lib_autosave_filename, FILE_TYPE_PL, JOB_TYPE_LIB);
-
if (error_count) {
char buf[16];
char *ret;
@@ -2251,6 +2243,14 @@ static void init_all(void)
help_add_all_unbound();

init_curses();
+
+ if (resume_cmus) {
+ resume_load();
+ cmus_add(play_queue_append, play_queue_autosave_filename, FILE_TYPE_PL, JOB_TYPE_QUEUE);
+ }
+
+ cmus_add(pl_add_track, pl_autosave_filename, FILE_TYPE_PL, JOB_TYPE_PL);
+ cmus_add(lib_add_track, lib_autosave_filename, FILE_TYPE_PL, JOB_TYPE_LIB);
}

static void exit_all(void)
--
1.7.5.4
Gregory Petrosyan
2011-07-22 03:51:25 UTC
Permalink
Post by Johannes Weißl
@Gregory: Could you maybe release 2.4.2? There a couple of pretty
important fixes since 2.4.1, especially the avcodec patch. More and more
distributions are starting to update, and cmus will fail to compile
otherwise.
No problem — thanks for the reminder! Before the end of this week it
will be out :-)

                Gregory
yawfle
2011-07-22 18:25:20 UTC
Permalink
Post by Johannes Weißl
Is it working for you with this patch?
Not only is it starting up fine in browser view now, but it resumes
playing so fast it actually startled me a little!

Nice work, thanks for taking care of us unicode laggers. ;)
--
yawfle
Loading...