public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* snd_seq_drain_output change breaks existing code.
       [not found] <188a22d3b514b800-webhooks-bot@alsa-project.org>
@ 2026-01-13  0:28 ` GitHub issues - opened
  0 siblings, 0 replies; 2+ messages in thread
From: GitHub issues - opened @ 2026-01-13  0:28 UTC (permalink / raw)
  To: alsa-devel

alsa-project/alsa-lib issue #493 was opened from Hoosier-Beagler:

The little gem shown below has broken a lot of code.  Previously, no positive results were returned and software relied on -EAGAIN to detect remaining data.  That result is no longer returned if some data was processed.  This has broken the old and stable version of my application written in C(++) which is no longer being maintained.  I have ported my app to python but this change has also broken public python wrappers for the alsa library.  In [alsa-python / pyalsa / alsaseq.c](https://github.com/alsa-project/alsa-python/blob/master/pyalsa/alsaseq.c) below line 2800 and also [python-alsa-midi / alsa_midi / client.py](https://github.com/Jajcus/python-alsa-midi/blob/main/alsa_midi/client.py) at line 626 and possibly the sub-classes as well (lines 1679, 1871).  None of these wrappers expected a valid return value and do not pass along said value returned from the c library call.

```
--- alsa-lib-1.2.14/src/seq/seq.c  2025-04-14 11:42:04.000000000 -0500
+++ alsa-lib-1.2.15.2/src/seq/seq.c       2026-01-08 08:27:57.000000000 -0600
@@ -4445,21 +4445,22 @@
 int snd_seq_drain_output(snd_seq_t *seq)
 {
        ssize_t result, processed = 0;
        assert(seq);
        while (seq->obufused > 0) {
                result = seq->ops->write(seq, seq->obuf, seq->obufused);
                if (result < 0) {
-                       if (result == -EAGAIN && processed)
+                       if (result == -EAGAIN && processed > 0)
                                return seq->obufused;
                        return result;
                }
                if ((size_t)result < seq->obufused)
                        memmove(seq->obuf, seq->obuf + result, seq->obufused - result);
                seq->obufused -= result;
+               processed += result;
        }
        return 0;
 }
 
 /**
  * \brief extract the first event in output buffer
  * \param seq sequencer handle

```

Issue URL     : https://github.com/alsa-project/alsa-lib/issues/493
Repository URL: https://github.com/alsa-project/alsa-lib

^ permalink raw reply	[flat|nested] 2+ messages in thread

* snd_seq_drain_output change breaks existing code.
       [not found] <188a23611a73cd00-webhooks-bot@alsa-project.org>
@ 2026-01-13  0:38 ` GitHub issues - edited
  0 siblings, 0 replies; 2+ messages in thread
From: GitHub issues - edited @ 2026-01-13  0:38 UTC (permalink / raw)
  To: alsa-devel

alsa-project/alsa-lib issue #493 was edited from Hoosier-Beagler:

The little gem shown below has broken a lot of code.  Previously, no positive results were returned and software relied on -EAGAIN to detect remaining data.  That result is no longer returned if some data was processed.  This has broken the old and stable version of my application written in C(++) which is no longer being maintained.  I have ported my app to python but this change has also broken public python wrappers for the alsa library.  In [alsa-python / pyalsa / alsaseq.c](https://github.com/alsa-project/alsa-python/blob/master/pyalsa/alsaseq.c) below line 2800 and also [python-alsa-midi / alsa_midi / client.py](https://github.com/Jajcus/python-alsa-midi/blob/main/alsa_midi/client.py) at line 626 and possibly the sub-classes as well (lines 1679, 1871).  None of these wrappers expected a valid return value and do not pass along said value returned from the c library call.  Consequently, there is no longer an indication that the output has not been fully drained.

```
--- alsa-lib-1.2.14/src/seq/seq.c  2025-04-14 11:42:04.000000000 -0500
+++ alsa-lib-1.2.15.2/src/seq/seq.c       2026-01-08 08:27:57.000000000 -0600
@@ -4445,21 +4445,22 @@
 int snd_seq_drain_output(snd_seq_t *seq)
 {
        ssize_t result, processed = 0;
        assert(seq);
        while (seq->obufused > 0) {
                result = seq->ops->write(seq, seq->obuf, seq->obufused);
                if (result < 0) {
-                       if (result == -EAGAIN && processed)
+                       if (result == -EAGAIN && processed > 0)
                                return seq->obufused;
                        return result;
                }
                if ((size_t)result < seq->obufused)
                        memmove(seq->obuf, seq->obuf + result, seq->obufused - result);
                seq->obufused -= result;
+               processed += result;
        }
        return 0;
 }
 
 /**
  * \brief extract the first event in output buffer
  * \param seq sequencer handle

```

Issue URL     : https://github.com/alsa-project/alsa-lib/issues/493
Repository URL: https://github.com/alsa-project/alsa-lib

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-13  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <188a23611a73cd00-webhooks-bot@alsa-project.org>
2026-01-13  0:38 ` snd_seq_drain_output change breaks existing code GitHub issues - edited
     [not found] <188a22d3b514b800-webhooks-bot@alsa-project.org>
2026-01-13  0:28 ` GitHub issues - opened

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox