The plugin repeatedly crashes while controlling a version 0.21.5 mpd. The "restart or remove" dialog appears. The mpd log contains lines like these: exception: Integer expected: -731outputs exception: Integer expected: -731status (the number changes randomly)
What os ? Built against libmpd or using the standalone simple-libmpd code ? What is your output list ? can you build with --enable-debug=full and show me the debug log ?
It's this package: https://packages.debian.org/source/sid/xfce4-mpc-plugin The debug log is attached.
Created attachment 8544 Log
There is an error here: DBG[simple-libmpd.c:219] mpd_wait_for_answer(): Read 117 bytes, buff="outputid: 0 outputname: My ALSA Device plugin: alsa outputenabled: 1 attribute: allowed_formats= attribute: dop=0 OK " DBG[simple-libmpd.c:457] parse_outputs_answer(): Going to parse output #0 DBG[simple-libmpd.c:463] parse_outputs_answer(): key="outputid",value="0" DBG[simple-libmpd.c:463] parse_outputs_answer(): key="outputname",value="My ALSA Device" DBG[simple-libmpd.c:463] parse_outputs_answer(): key="plugin",value="alsa" DBG[simple-libmpd.c:463] parse_outputs_answer(): key="outputenabled",value="1" DBG[simple-libmpd.c:457] parse_outputs_answer(): Going to parse output #1 It seems to be parsing junk.
Created attachment 8566 skip attribute lines Ok, thanks for the log, i think i understand where it comes from - the code doesn't expect those lines with 'attribute' and should ignore them, skipping to the final 'OK' which signals the end of outputs. Instead of that, ones it sees the 'outputenabled' line and not immediately an 'OK' line, it thinks there's another output to parse, and then s**t happens. here with 0.21.6, on my 4 outputs i dont have such lines, that explains why i'm not seeing those crashes. ... outputname: sndio on localhost/ssh plugin: sndio outputenabled: 0 outputid: 3 outputname: HTTP stream plugin: httpd outputenabled: 1 OK ... do you have any idea what can cause those lines from MPD so that i can try reproducing ? Is this with mpc plugin 0.5.1 ? can you try the attached blind patch ?
Your patch works, but it looks strange to me. The more logical thing is just skip everything until the next "outputid", so it won't break sometime again in the future. I don't know why there are those lines. They were there in the default configuration.
There might not be another outputid.. that might require more changes to the logic. Can you provide a tested patch if you think of a better way ?
Landry Breuil referenced this bugreport in commit 9a21bf63df679ef22bc775d7fbfd971a0b423875 Ignore extra lines with attribute: entries (bug #15415) https://git.xfce.org/panel-plugins/xfce4-mpc-plugin/commit?id=9a21bf63df679ef22bc775d7fbfd971a0b423875