Bug#610122: xjig: timer goes on after completing, finally causes beeps every 1s

2011-01-20 Thread Dave Holland
On Thu, Jan 20, 2011 at 09:05:28PM -0500, pac...@kosh.dhis.org wrote:
> But here's something even better: a patch to eliminate the magic number by
> adding an explicit flag for the end phase when the clock is no longer
> ticking. Besides fixing the weird behavior at the megasecond mark, this also
> makes it stop waking up once per second after the puzzle is finished.

Thanks for that!

I'm currently travelling, with limited connectivity, but I'll upload a
new package next week.

Cheers,
Dave



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



Bug#610122: xjig: timer goes on after completing, finally causes beeps every 1s

2011-01-20 Thread pacman
Yann Dirson writes:
> 
> FWIW - restricted the duration after which the beep occurs:
> 
> - more than 11days 00:26:40 (15866min)
> - less than 11days 17:50:22 (16910min)

If you keep measuring, you'll end up at 11 days 13:46:40 (exactly 1 million
seconds). The magic value 100 is used for an "infinite" sleep after
displaying the final time (see "next_sec=100;" around line 698 of
xjig.C). Nobody expected you to admire your work that long.

I think the exact time will be 1 million seconds after you started, not 1
million seconds after you finished.

Up the magic number to a billion and you will have to try really hard to hit
it again.

But here's something even better: a patch to eliminate the magic number by
adding an explicit flag for the end phase when the clock is no longer
ticking. Besides fixing the weird behavior at the megasecond mark, this also
makes it stop waking up once per second after the puzzle is finished.

diff -u xjig-2.4/xjig.C xjig-2.4/xjig.C
--- xjig-2.4/xjig.C
+++ xjig-2.4/xjig.C
@@ -669,6 +669,7 @@
struct timeval timeout;
/*struct*/ fd_set readfds;
int nfds;
+   static int end_phase;

FD_ZERO( &readfds );
FD_SET(  ConnectionNumber(dpy), &readfds  );
@@ -677,7 +678,7 @@
timeout.tv_sec  = 0;
double current_time=GetCurrentTime();
timeout.tv_usec = (long)(100 * 
(1.0-(current_time-floor(current_time;
-   select( nfds, FDS_TYPE &readfds, 0, 0, &timeout 
);
+   select( nfds, FDS_TYPE &readfds, 0, 0, 
end_phase?NULL:&timeout );

current_time = GetCurrentTime();
//  printf( "%g\n", current_time );
@@ -689,13 +690,13 @@
next_sec / 60, next_sec 
% 60 );
if (!shapes)
XStoreName(dpy,win,buffer);
}
-   else {
+   else if(!end_phase) {
sprintf( buffer, "no more tiles 
left at:  %02ld:%02ld",
next_sec / 60, next_sec 
% 60 );
if (!shapes)
XStoreName(dpy,win,buffer);
XBell(dpy,100);
XFlush(dpy);
-   next_sec=100;
+   end_phase=1;
}
}
}

-- 
Alan Curry



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



Bug#610122: xjig: timer goes on after completing, finally causes beeps every 1s

2011-01-19 Thread Yann Dirson
FWIW - restricted the duration after which the beep occurs:

- more than 11days 00:26:40 (15866min)
- less than 11days 17:50:22 (16910min)



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



Bug#610122: xjig: timer goes on after completing, finally causes beeps every 1s

2011-01-15 Thread Yann Dirson
Package: xjig
Version: 2.4-13+b1
Severity: normal

Once the puzzle has been completed, the title seems to be frozen
displaying how much time was spent to complete it.

Now if one keeps xjig open for several days (waiting for the right
moment for "look ma, I did it in 2 minutes!" ;), we get beeps every
second.  They can be silenced by killing xjig, but hey... it's not the
1st time it occurs, and I don't want to wait till some guest sleeping
not far from the running computer gets awaken at night, you guess :)

This seems to happen after something like 8 days uptime (as seen by
"ps -o pid,etime $(pidof xjig)".  What can be seen then is that the
title gets updated again, with times like "16132:24" and growing.

Attaching strace to a finished xjig in the case of not-yet-beeping
process, getting the following is already strange, although that may
still be normal (fd 3 seems to be the X socket):

Process 8527 attached - interrupt to quit
select(4, [3], NULL, NULL, {0, 198500}) = 0 (Timeout)
read(3, 0x16aa714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
select(4, [3], NULL, NULL, {0, 999402}) = 0 (Timeout)
read(3, 0x16aa714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
select(4, [3], NULL, NULL, {0, 998770}^C 
Process 8527 detached

Then those which started to beep rather exhibit the following, which
may just reflect the titlebar updates:

Process 9216 attached - interrupt to quit
select(4, [3], NULL, NULL, {0, 110413}) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\22\0\16\0\1\0`\3'\0\0\0\37\0\0\0\10\0\5\0 \0\0\0no more "..., 
60}, {NULL, 0}, {"", 0}], 3) = 60
read(3, 0x12d1714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
read(3, 0x12d1714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
select(4, [3], NULL, NULL, {0, 999086}) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\22\0\16\0\1\0`\3'\0\0\0\37\0\0\0\10\0\5\0 \0\0\0no more "..., 
60}, {NULL, 0}, {"", 0}], 3) = 60
read(3, 0x12d1714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
read(3, 0x12d1714, 4096)= -1 EAGAIN (Resource temporarily 
unavailable)
select(4, [3], NULL, NULL, {0, 997930}c^C 
Process 9216 detached


-- System Information:
Debian Release: 6.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (101, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34.1-3-ge5b0813-dirty (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xjig depends on:
ii  libc6 2.11.2-7   Embedded GNU C Library: Shared lib
ii  libgcc1   1:4.4.5-8  GCC support library
ii  libjpeg62 6b1-1  The Independent JPEG Group's JPEG 
ii  libnetpbm10   2:10.0-12.2+b1 Graphics conversion tools shared l
ii  libstdc++64.4.5-8The GNU Standard C++ Library v3
ii  libx11-6  2:1.3.3-4  X11 client-side library
ii  libxext6  2:1.1.2-1  X11 miscellaneous extension librar

xjig recommends no packages.

xjig suggests no packages.

-- no debconf information



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