snd_seq_drain_output change breaks existing code.
A message that is not in the archive (sent off-list or not yet received): [email protected]
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