Bug#574589: can confirm bug on debian squeeze, working patch attached

2011-02-13 Thread Adam D. Barratt
On Fri, 2011-02-11 at 12:53 +0100, Reinhard Tartler wrote:
> On Fr, Feb 11, 2011 at 10:11:27 (CET), Alexander Wuerstlein wrote:
> 
> > On 11-02-10 23:21, Reinhard Tartler 
> >  wrote:
> >> On Do, Feb 10, 2011 at 18:30:45 (CET), Alexander Wuerstlein wrote:
> >> > Also, I have ported and tested the upstream patch for the problem.
> >> > Please see the attached patch which fixes the problem for me. It's, up
> >> > to some small differences, the same as upstream commit
> >> > 609a005b77b5dc691271f48351bd39e3eecb7dc9.
[...]
> Please find the debdiff to my proposed stable update attached to this
> email.  With your permission, I'd like to upload to
> stable-proposed-updates so that this fix can be included in
> squeeze_r1. Feel free to point out mistakes in the version numbering or
> upload target, I'll fix that then before the upload.

Thanks for working on this.  Looking at the version graph for #574589,
it looks like this issue hasn't been resolved in the pulseaudio version
in unstable yet?  If so then the proposed patch should be uploaded to
unstable first and if no issues are found there then we can look at
applying it to stable.

(The report is also tagged fixed-in-experimental, yet the version graph
suggests that the bug affects the experimental package; one or other of
those should be changed.)

Regards,

Adam




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#574589: can confirm bug on debian squeeze, working patch attached

2011-02-11 Thread Reinhard Tartler
Hi Release Team,

On Fr, Feb 11, 2011 at 10:11:27 (CET), Alexander Wuerstlein wrote:

> On 11-02-10 23:21, Reinhard Tartler 
>  wrote:
>> On Do, Feb 10, 2011 at 18:30:45 (CET), Alexander Wuerstlein wrote:
>> 
>> > I can confirm that this bug also affects pulseaudio on squeeze while not
>> > affecting lenny. When commands are read from stdin (e.g. "echo info |
>> > pacmd") pacmd handles the closing of stdin incorrectly and enters an
>> > endless poll()-loop. The referenced Ubuntu-bug only provides a
>> > workaround by replacing all occurences of "echo  | pacmd" by
>> > "pacmd ". This is insufficient since it still leaves the
>> > regression, thus breaking other previously working code.
>> >
>> > Also, I have ported and tested the upstream patch for the problem.
>> > Please see the attached patch which fixes the problem for me. It's, up
>> > to some small differences, the same as upstream commit
>> > 609a005b77b5dc691271f48351bd39e3eecb7dc9.
>
> upstream gitweb link, if you are interested, is:
> http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=609a005b77b5dc691271f48351bd39e3eecb7dc9
>
>> Test packages can be retrieved from here:
>> http://people.debian.org/~siretart/pulseaudio/
>
> I can confirm that the provided binary packages as well as the source
> packages when built do fix the problem.

Please find the debdiff to my proposed stable update attached to this
email.  With your permission, I'd like to upload to
stable-proposed-updates so that this fix can be included in
squeeze_r1. Feel free to point out mistakes in the version numbering or
upload target, I'll fix that then before the upload.



debdiff
Description: Binary data



-- 
Reinhard Tartler Department of Computer Science IV
Martensstr 1, 91058 Erlangen Germany, University of Erlangen-Nuremberg
http://www4.informatik.uni-erlangen.de/~tartler


Bug#574589: can confirm bug on debian squeeze, working patch attached

2011-02-11 Thread Alexander Wuerstlein
On 11-02-10 23:21, Reinhard Tartler 
 wrote:
> On Do, Feb 10, 2011 at 18:30:45 (CET), Alexander Wuerstlein wrote:
> 
> > I can confirm that this bug also affects pulseaudio on squeeze while not
> > affecting lenny. When commands are read from stdin (e.g. "echo info |
> > pacmd") pacmd handles the closing of stdin incorrectly and enters an
> > endless poll()-loop. The referenced Ubuntu-bug only provides a
> > workaround by replacing all occurences of "echo  | pacmd" by
> > "pacmd ". This is insufficient since it still leaves the
> > regression, thus breaking other previously working code.
> >
> > Also, I have ported and tested the upstream patch for the problem.
> > Please see the attached patch which fixes the problem for me. It's, up
> > to some small differences, the same as upstream commit
> > 609a005b77b5dc691271f48351bd39e3eecb7dc9.

upstream gitweb link, if you are interested, is:
http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=609a005b77b5dc691271f48351bd39e3eecb7dc9

> Test packages can be retrieved from here:
> http://people.debian.org/~siretart/pulseaudio/

I can confirm that the provided binary packages as well as the source
packages when built do fix the problem.



Ciao,

Alexander Wuerstlein.




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#574589: can confirm bug on debian squeeze, working patch attached

2011-02-10 Thread Reinhard Tartler
On Do, Feb 10, 2011 at 18:30:45 (CET), Alexander Wuerstlein wrote:

> I can confirm that this bug also affects pulseaudio on squeeze while not
> affecting lenny. When commands are read from stdin (e.g. "echo info |
> pacmd") pacmd handles the closing of stdin incorrectly and enters an
> endless poll()-loop. The referenced Ubuntu-bug only provides a
> workaround by replacing all occurences of "echo  | pacmd" by
> "pacmd ". This is insufficient since it still leaves the
> regression, thus breaking other previously working code.
>
> Also, I have ported and tested the upstream patch for the problem.
> Please see the attached patch which fixes the problem for me. It's, up
> to some small differences, the same as upstream commit
> 609a005b77b5dc691271f48351bd39e3eecb7dc9.

Test packages can be retrieved from here:
http://people.debian.org/~siretart/pulseaudio/

Feedback welcome to this bugreport.

-- 
Reinhard Tartler Department of Computer Science IV
Martensstr 1, 91058 Erlangen Germany, University of Erlangen-Nuremberg
http://www4.informatik.uni-erlangen.de/~tartler



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#574589: can confirm bug on debian squeeze, working patch attached

2011-02-10 Thread Alexander Wuerstlein

Hello,

I can confirm that this bug also affects pulseaudio on squeeze while not
affecting lenny. When commands are read from stdin (e.g. "echo info |
pacmd") pacmd handles the closing of stdin incorrectly and enters an
endless poll()-loop. The referenced Ubuntu-bug only provides a
workaround by replacing all occurences of "echo  | pacmd" by
"pacmd ". This is insufficient since it still leaves the
regression, thus breaking other previously working code.

Also, I have ported and tested the upstream patch for the problem.
Please see the attached patch which fixes the problem for me. It's, up
to some small differences, the same as upstream commit
609a005b77b5dc691271f48351bd39e3eecb7dc9.




Ciao,

Alexander Wuerstlein.
--- pacmd.c.orig2009-11-23 23:22:41.0 +0100
+++ pacmd.c 2011-02-10 16:53:34.0 +0100
@@ -45,13 +45,6 @@
 
 int main(int argc, char*argv[]) {
 
-enum {
-WATCH_STDIN,
-WATCH_STDOUT,
-WATCH_SOCKET,
-N_WATCH
-};
-
 pid_t pid ;
 int fd = -1;
 int ret = 1, i;
@@ -60,7 +53,11 @@
 size_t ibuf_index, ibuf_length, obuf_index, obuf_length;
 char *cli;
 pa_bool_t ibuf_eof, obuf_eof, ibuf_closed, obuf_closed;
-struct pollfd pollfd[N_WATCH];
+
+struct pollfd pollfd[3];
+struct pollfd *watch_socket, *watch_stdin, *watch_stdout;
+
+int stdin_type = 0, stdout_type = 0, fd_type = 0;
 
 setlocale(LC_ALL, "");
 bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
@@ -128,32 +125,53 @@
 ibuf_eof = TRUE;
 }
 
-pa_zero(pollfd);
-
-pollfd[WATCH_STDIN].fd = STDIN_FILENO;
-pollfd[WATCH_STDOUT].fd = STDOUT_FILENO;
-pollfd[WATCH_SOCKET].fd = fd;
-
 for (;;) {
+struct pollfd *p;
+
 if (ibuf_eof &&
 obuf_eof &&
 ibuf_length <= 0 &&
 obuf_length <= 0)
 break;
 
-pollfd[WATCH_STDIN].events = pollfd[WATCH_STDOUT].events = 
pollfd[WATCH_SOCKET].events = 0;
+if (ibuf_length <= 0 && ibuf_eof && !ibuf_closed) {
+shutdown(fd, SHUT_WR);
+ibuf_closed = TRUE;
+}
 
-if (obuf_length > 0)
-pollfd[WATCH_STDOUT].events |= POLLOUT;
-else if (!obuf_eof)
-pollfd[WATCH_SOCKET].events |= POLLIN;
-
-if (ibuf_length > 0)
-pollfd[WATCH_SOCKET].events |= POLLOUT;
-else if (!ibuf_eof)
-pollfd[WATCH_STDIN].events |= POLLIN;
+if (obuf_length <= 0 && obuf_eof && !obuf_closed) {
+shutdown(fd, SHUT_RD);
+obuf_closed = TRUE;
+}
+
+pa_zero(pollfd);
+
+p = pollfd;
 
-if (poll(pollfd, N_WATCH, -1) < 0) {
+if (ibuf_length > 0 || (!obuf_eof && obuf_length <= 0)) {
+watch_socket = p++;
+watch_socket->fd = fd;
+watch_socket->events =
+(ibuf_length > 0 ? POLLOUT : 0) |
+(!obuf_eof && obuf_length <= 0 ? POLLIN : 0);
+} else
+watch_socket = NULL;
+
+if (!ibuf_eof && ibuf_length <= 0) {
+watch_stdin = p++;
+watch_stdin->fd = STDIN_FILENO;
+watch_stdin->events = POLLIN;
+} else
+watch_stdin = NULL;
+
+if (obuf_length > 0) {
+watch_stdout = p++;
+watch_stdout->fd = STDOUT_FILENO;
+watch_stdout->events = POLLOUT;
+} else
+watch_stdout = NULL;
+
+if (poll(pollfd, p-pollfd, -1) < 0) {
 
 if (errno == EINTR)
 continue;
@@ -162,82 +180,80 @@
 goto fail;
 }
 
-if (pollfd[WATCH_STDIN].revents & POLLIN) {
-ssize_t r;
-pa_assert(!ibuf_length);
-
-if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), NULL)) <= 0) {
-if (r < 0) {
-pa_log(_("read(): %s"), strerror(errno));
-goto fail;
+if (watch_stdin) {
+if (watch_stdin->revents & POLLIN) {
+ssize_t r;
+pa_assert(ibuf_length <= 0);
+
+if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), 
&stdin_type)) <= 0) {
+if (r < 0) {
+pa_log(_("read(): %s"), strerror(errno));
+goto fail;
+}
+
+ibuf_eof = TRUE;
+} else {
+ibuf_length = (size_t) r;
+ibuf_index = 0;
 }
-
+} else if (watch_stdin->revents & POLLHUP)
 ibuf_eof = TRUE;
-} else {
-ibuf_length = (size_t) r;
-ibuf_index = 0;
-}
 }
 
-if (pollfd[WATCH_SOCKET].revents & POLLIN) {
-ssize_t r;
-pa_assert(!obuf_length);
-
-if ((r = pa_read(fd, obuf, sizeof(obuf), NULL)) <= 0) {
-if (r < 0) {
-pa_log(_("read(): %s"