Source: alsa-lib Version: 1.1.3-5 Severity: important Tags: patch I was a bit annoyed I could not play any sound on my x32 desktop any more and today investigated it. It boils down to that amd64 assembly code was run, which, of course, cannot work.
While the fix for that (0011-distinguish-x32-from-amd64.patch) turned out to be a one-liner, I recognised further problems that appear on all “new” 32-bit architectures added to Linux because of them using a 64-bit time_t, so 0009-fix-format-strings.patch was added. Finally, I found a minor typo 0010-fix-testcase-typo.patch while investigating compiler warnings caused by what is fixed by 0009. Please apply them all *and* submit them *all* upstream. In the meantime, I’ve uploaded a package built from the attached debdiff to unreleased, but that will, of course, unsync M-A, which is not the desirable thing to have. Thanks! This work was sponsored by ⮡ tarent -- System Information: Debian Release: buster/sid APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable') Architecture: x32 (x86_64) Foreign Architectures: i386, amd64 Kernel: Linux 4.11.0-1-amd64 (SMP w/8 CPU cores) Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8) Shell: /bin/sh linked to /bin/lksh Init: sysvinit (via /sbin/init)
diff -Nru alsa-lib-1.1.3/debian/changelog alsa-lib-1.1.3/debian/changelog --- alsa-lib-1.1.3/debian/changelog 2017-02-13 20:12:05.000000000 +0100 +++ alsa-lib-1.1.3/debian/changelog 2017-08-01 17:47:16.000000000 +0200 @@ -1,3 +1,10 @@ +alsa-lib (1.1.3-5+x32.1) unreleased; urgency=medium + + * Non-maintainer upload. + * Add patches fixing sound on x32. + + -- Thorsten Glaser <t...@mirbsd.de> Tue, 01 Aug 2017 17:47:16 +0200 + alsa-lib (1.1.3-5) unstable; urgency=medium [ Jordi Mallach ] diff -Nru alsa-lib-1.1.3/debian/patches/0009-fix-format-strings.patch alsa-lib-1.1.3/debian/patches/0009-fix-format-strings.patch --- alsa-lib-1.1.3/debian/patches/0009-fix-format-strings.patch 1970-01-01 01:00:00.000000000 +0100 +++ alsa-lib-1.1.3/debian/patches/0009-fix-format-strings.patch 2017-08-01 17:45:18.000000000 +0200 @@ -0,0 +1,71 @@ +# DP: fix long vs. long long confusion when there is a 64-bit time_t +# DP: on a 32-bit long system, such as all newer 32-bit architectures + +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -2188,10 +2188,10 @@ int snd_pcm_status_dump(snd_pcm_status_t + { + assert(status); + snd_output_printf(out, " state : %s\n", snd_pcm_state_name((snd_pcm_state_t) status->state)); +- snd_output_printf(out, " trigger_time: %ld.%06ld\n", +- status->trigger_tstamp.tv_sec, status->trigger_tstamp.tv_nsec); +- snd_output_printf(out, " tstamp : %ld.%06ld\n", +- status->tstamp.tv_sec, status->tstamp.tv_nsec); ++ snd_output_printf(out, " trigger_time: %lld.%06ld\n", ++ (long long)status->trigger_tstamp.tv_sec, (long)status->trigger_tstamp.tv_nsec); ++ snd_output_printf(out, " tstamp : %lld.%06ld\n", ++ (long long)status->tstamp.tv_sec, (long)status->tstamp.tv_nsec); + snd_output_printf(out, " delay : %ld\n", (long)status->delay); + snd_output_printf(out, " avail : %ld\n", (long)status->avail); + snd_output_printf(out, " avail_max : %ld\n", (long)status->avail_max); +--- a/test/latency.c ++++ b/test/latency.c +@@ -325,12 +325,12 @@ void setscheduler(void) + printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority); + } + +-long timediff(snd_timestamp_t t1, snd_timestamp_t t2) ++long long timediff(snd_timestamp_t t1, snd_timestamp_t t2) + { +- signed long l; ++ signed long long l; + + t1.tv_sec -= t2.tv_sec; +- l = (signed long) t1.tv_usec - (signed long) t2.tv_usec; ++ l = (signed long long) t1.tv_usec - (signed long long) t2.tv_usec; + if (l < 0) { + t1.tv_sec--; + l = 1000000 + l; +@@ -682,10 +682,10 @@ int main(int argc, char *argv[]) + snd_pcm_nonblock(phandle, !block ? 1 : 0); + if (ok) { + #if 1 +- printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n", +- p_tstamp.tv_sec, ++ printf("Playback time = %lli.%i, Record time = %lli.%i, diff = %lli\n", ++ (long long)p_tstamp.tv_sec, + (int)p_tstamp.tv_usec, +- c_tstamp.tv_sec, ++ (long long)c_tstamp.tv_sec, + (int)c_tstamp.tv_usec, + timediff(p_tstamp, c_tstamp)); + #endif +--- a/test/queue_timer.c ++++ b/test/queue_timer.c +@@ -99,11 +99,11 @@ main(int argc ATTRIBUTE_UNUSED, char **a + normalize(&diffdiff); + prevdiff = diff; + +- fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n diff: %12ld sec %8ld usec\n diffdiff: %12ld sec %8ld usec\n", +- tv.tv_sec, tv.tv_usec, +- (long)rtime->tv_sec, (long)rtime->tv_nsec / 1000, +- diff.tv_sec, diff.tv_usec, +- (long)diffdiff.tv_sec, (long)diffdiff.tv_usec); ++ fprintf(stderr, " real time: %12lld sec %8ld usec\nqueue time: %12lld sec %8ld usec\n diff: %12lld sec %8ld usec\n diffdiff: %12lld sec %8ld usec\n", ++ (long long)tv.tv_sec, (long)tv.tv_usec, ++ (long long)rtime->tv_sec, (long)rtime->tv_nsec / 1000, ++ (long long)diff.tv_sec, (long)diff.tv_usec, ++ (long long)diffdiff.tv_sec, (long)diffdiff.tv_usec); + + if (diffdiff.tv_usec > 5000 || + diffdiff.tv_usec < -5000) { diff -Nru alsa-lib-1.1.3/debian/patches/0010-fix-testcase-typo.patch alsa-lib-1.1.3/debian/patches/0010-fix-testcase-typo.patch --- alsa-lib-1.1.3/debian/patches/0010-fix-testcase-typo.patch 1970-01-01 01:00:00.000000000 +0100 +++ alsa-lib-1.1.3/debian/patches/0010-fix-testcase-typo.patch 2017-08-01 17:45:25.000000000 +0200 @@ -0,0 +1,13 @@ +# DP: fix an obvious typo + +--- a/test/latency.c ++++ b/test/latency.c +@@ -673,7 +673,7 @@ int main(int argc, char *argv[]) + printf("Capture:\n"); + showstat(chandle, frames_in); + showinmax(in_max); +- if (p_tstamp.tv_sec == p_tstamp.tv_sec && ++ if (p_tstamp.tv_sec == c_tstamp.tv_sec && + p_tstamp.tv_usec == c_tstamp.tv_usec) + printf("Hardware sync\n"); + snd_pcm_drop(chandle); diff -Nru alsa-lib-1.1.3/debian/patches/0011-distinguish-x32-from-amd64.patch alsa-lib-1.1.3/debian/patches/0011-distinguish-x32-from-amd64.patch --- alsa-lib-1.1.3/debian/patches/0011-distinguish-x32-from-amd64.patch 1970-01-01 01:00:00.000000000 +0100 +++ alsa-lib-1.1.3/debian/patches/0011-distinguish-x32-from-amd64.patch 2017-08-01 17:47:06.000000000 +0200 @@ -0,0 +1,14 @@ +# DP: fix segmentation fault coming from this using amd64 assembly code +# DP: on x32 systems + +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -142,7 +142,7 @@ static void dmix_server_free(snd_pcm_dir + #include "pcm_dmix_generic.c" + #if defined(__i386__) + #include "pcm_dmix_i386.c" +-#elif defined(__x86_64__) ++#elif defined(__x86_64__) && !defined(__ILP32__) + #include "pcm_dmix_x86_64.c" + #else + #ifndef DOC_HIDDEN diff -Nru alsa-lib-1.1.3/debian/patches/series alsa-lib-1.1.3/debian/patches/series --- alsa-lib-1.1.3/debian/patches/series 2017-01-24 17:35:03.000000000 +0100 +++ alsa-lib-1.1.3/debian/patches/series 2017-08-01 17:46:09.000000000 +0200 @@ -6,3 +6,6 @@ 0006-Enabled-extended-namehints-in-alsa.conf.patch 0007-Add-a-configuration-for-tegra-alc5632-based-cards.patch 0008-topology-Fix-incorrect-license-in-source-comments.patch +0009-fix-format-strings.patch +0010-fix-testcase-typo.patch +0011-distinguish-x32-from-amd64.patch