Re: [Musicpd-dev-team] [PATCH] some libflac's cpu_info makes a SIGILL, so ignore it

2008-11-01 Thread Alam Arias
On Fri, 31 Oct 2008 17:12:30 +0100
Max Kellermann [EMAIL PROTECTED] wrote:

 I won't merge this patch, because I think this must be fixed in
 libflac.

Yea, after a nap and downloading FLAC source code, it does setup to
handle SIGILL and set the EIP ahead of SSE instruction.

Now here the thing, it does uses CPUID but if there FXSR(yes), SSE (no)
or SSE2 (no) support, it will try to see if the OS support SSE
instructions, now that is where it goes wrong.

I do not see why in libFLAC's cpu.c that if CPUID says that if the CPU
supports FXSR that it should test SEE support so I just compiled libFLAC
with -DFLAC__NO_SSE_OS and now see MPD will still crash with crossfade
off. It just that with crossfade on, the music still stops t-crossfade/2


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH] some libflac's cpu_info makes a SIGILL, so ignore it

2008-10-31 Thread Alam Arias
I noticed on my Debian Lenny/Sid system that libflac8 1.2.1-1.2
package's libFLAC.so.8 raises SIGILL in FLAC__cpu_info()

so this patch setups to ignore SIGILL when we do flac(_ogg)_init and
restore the old signal handler after the init
---
 src/decoder/flac_plugin.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index a4ccd6e..c515b6c 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -21,6 +21,7 @@
 #include ../log.h
 
 #include assert.h
+#include signal.h
 
 /* this code was based on flac123, from flac-tools */
 
@@ -308,6 +309,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
 	flac_decoder *flacDec;
 	FlacData data;
 	const char *err = NULL;
+	__sighandler_t oldill;
 
 	if (!(flacDec = flac_new()))
 		return false;
@@ -321,6 +323,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
 #endif
 
 
+	oldill = signal(SIGILL, SIG_IGN); // some libflac's cpu_info() makes a SIGILL, so ignore it
 	if (is_ogg) {
 		if (!flac_ogg_init(flacDec, flacRead, flacSeek, flacTell,
 		   flacLength, flacEOF, flacWrite, flacMetadata,
@@ -340,6 +343,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
 			goto fail;
 		}
 	}
+	signal(SIGILL, oldill); // let restore the old SIGILL hander
 
 	decoder_initialized(decoder, data.audio_format, data.total_time);
 
@@ -365,6 +369,8 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
 	}
 
 fail:
+	signal(SIGILL, oldill);
+
 	if (data.replayGainInfo)
 		freeReplayGainInfo(data.replayGainInfo);
 
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] [PATCH] some libflac's cpu_info makes a SIGILL, so ignore it

2008-10-31 Thread Max Kellermann
On 2008/10/31 16:55, Alam Arias [EMAIL PROTECTED] wrote:
 I noticed on my Debian Lenny/Sid system that libflac8 1.2.1-1.2
 package's libFLAC.so.8 raises SIGILL in FLAC__cpu_info()
 
 so this patch setups to ignore SIGILL when we do flac(_ogg)_init and
 restore the old signal handler after the init

I won't merge this patch, because I think this must be fixed in
libflac.  The SIG_IGN approach is problematic (not thread safe,
ignores the mask and flags, may ignore real errors), and it's not
MPD's task to work around this kind of bug.

Max

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team