Control: tags -1 patch

On Sat, Feb 13, 2021 at 02:53:58PM -0500, Andres Salomon wrote:
> Pulseaudio is failing to build on ppc64el. The version of pulseaudio in
> bullseye suffers from a pretty serious usability bug (see #980836)
> which should arguably be a higher severity, but let's focus on getting
> 14.2-1 built properly.
> 
> https://buildd.debian.org/status/logs.php?pkg=pulseaudio&arch=ppc64el
> 
> Here's where the ppc64el build fails:
> 
> 
> FAIL: cpu-volume-test
> =====================
> 
> Running suite(s): CPU
> 0%: Checks: 1, Failures: 1, Errors: 0
> tests/cpu-volume-test.c:81:F:svolume:svolume_orc_test:0: Failed
> FAIL cpu-volume-test (exit status: 1)

The output of the check (src/cpu-volume-test) is:
  Running suite(s): CPU
  Initialising ORC optimized volume functions.
  Checking Orc svolume
  Correctness test failed: align=1, channels=2
  1: 3303 != d317 (a1ed * 00007a36)
  0%: Checks: 1, Failures: 1, Errors: 0
  tests/cpu-volume-test.c:81:F:svolume:svolume_orc_test:0: Failed

Looking at the code of the test, that seems... not the intention:
    pa_cpu_info cpu_info;
    [...]
#if defined (__i386__) || defined (__amd64__)
    pa_zero(cpu_info);
    cpu_info.cpu_type = PA_CPU_X86;
    pa_cpu_get_x86_flags(&cpu_info.flags.x86);
#endif
    [...]
    if (!pa_cpu_init_orc(cpu_info)) {
            pa_log_info("Orc not supported. Skipping");
        return;
    }
    [...]
    pa_log_debug("Checking Orc svolume");

pa_cpu_init_orc() returns true only if cpu_info.cpu_type == PA_CPU_X86.
This should not be the case here, but cpu_info is being passed to the
function uninitialized, and... as luck would have it,
cpu_info.cpu_type's "random" contents are set to PA_CPU_X86.

So at minimum, the test is broken; initializing cpu_info as is done on
other tests is enough to fix this:

--- pulseaudio-14.2.orig/src/tests/cpu-volume-test.c
+++ pulseaudio-14.2/src/tests/cpu-volume-test.c
@@ -187,7 +187,7 @@ END_TEST

 START_TEST (svolume_orc_test) {
     pa_do_volume_func_t orig_func, orc_func;
-    pa_cpu_info cpu_info;
+    pa_cpu_info cpu_info = { PA_CPU_UNDEFINED, {}, false };
     int i, j;

 #if defined (__i386__) || defined (__amd64__)

I've tested this fix on plummer, and it seems to work as expected.

src/pulsecore/cpu.c has the only other invocation of pa_cpu_init_orc(),
and this seems to be initializing cpu_info properly, so this failure is
limited to the test suite and does not affect any runtime operation.

(This of course does not explain why the Orc code is broken on ppc64el.
It does not look to have been written with anything but i386/amd64 in
mind and the codepath is not meant to be running anywhere else, so
that's probably more in the "feature request" category.)

HTH!
Faidon

Reply via email to