[xscreensaver/f16] Don't call ctime in blurb in signal hander, patch by jwz
Mamoru Tasaka
mtasaka at fedoraproject.org
Sat Jun 30 15:44:00 UTC 2012
commit 81569dd135bff2e5ac0c1ef5b1c805a1da5eb7e6
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date: Sun Jul 1 00:43:59 2012 +0900
Don't call ctime in blurb in signal hander, patch by jwz
xscreensaver-5.17-blurb-hndl-test-passwd.patch | 10 +++
xscreensaver-5.17-blurb-in-sighandler-jwz.patch | 81 +++++++++++++++++++++++
xscreensaver.spec | 19 ++++--
3 files changed, 105 insertions(+), 5 deletions(-)
---
diff --git a/xscreensaver-5.17-blurb-hndl-test-passwd.patch b/xscreensaver-5.17-blurb-hndl-test-passwd.patch
new file mode 100644
index 0000000..d899062
--- /dev/null
+++ b/xscreensaver-5.17-blurb-hndl-test-passwd.patch
@@ -0,0 +1,10 @@
+--- xscreensaver-5.17/driver/test-passwd.c.hndl_extra 2011-09-25 09:16:56.000000000 +0900
++++ xscreensaver-5.17/driver/test-passwd.c 2012-06-30 00:25:05.000000000 +0900
+@@ -66,6 +66,7 @@
+ Bool update_screen_layout (saver_info *si) { return 0; }
+
+ const char *blurb(void) { return progname; }
++Bool in_signal_handler_p = 0;
+ Atom XA_SCREENSAVER, XA_DEMO, XA_PREFS;
+
+ void
diff --git a/xscreensaver-5.17-blurb-in-sighandler-jwz.patch b/xscreensaver-5.17-blurb-in-sighandler-jwz.patch
new file mode 100644
index 0000000..cba3147
--- /dev/null
+++ b/xscreensaver-5.17-blurb-in-sighandler-jwz.patch
@@ -0,0 +1,81 @@
+cvs diff: Diffing .
+Index: subprocs.c
+===================================================================
+RCS file: /cvsroot/xscreensaver/driver/subprocs.c,v
+retrieving revision 1.84
+diff -u -r1.84 subprocs.c
+--- subprocs.c 26 Jun 2010 11:46:23 -0000 1.84
++++ subprocs.c 28 Jun 2012 18:25:20 -0000
+@@ -484,6 +484,7 @@
+ sigchld_handler (int sig)
+ {
+ saver_info *si = global_si_kludge; /* I hate C so much... */
++ in_signal_handler_p++;
+
+ if (si->prefs.debug_p)
+ {
+@@ -510,6 +511,7 @@
+ }
+
+ init_sigchld();
++ in_signal_handler_p--;
+ }
+ #endif /* SIGCHLD */
+
+Index: xscreensaver.c
+===================================================================
+RCS file: /cvsroot/xscreensaver/driver/xscreensaver.c,v
+retrieving revision 1.158
+diff -u -r1.158 xscreensaver.c
+--- xscreensaver.c 7 Jun 2012 01:36:17 -0000 1.158
++++ xscreensaver.c 28 Jun 2012 18:30:58 -0000
+@@ -299,14 +299,28 @@
+ }
+
+
++Bool in_signal_handler_p = 0; /* I hate C so much... */
++
+ char *
+ timestring (void)
+ {
+- time_t now = time ((time_t *) 0);
+- char *str = (char *) ctime (&now);
+- char *nl = (char *) strchr (str, '\n');
+- if (nl) *nl = 0; /* take off that dang newline */
+- return str;
++ if (in_signal_handler_p)
++ {
++ /* Turns out that ctime() and even localtime_r() call malloc() on Linux!
++ So we can't call them from inside SIGCHLD. WTF.
++ */
++ static char buf[30];
++ strcpy (buf, "... ... .. signal ....");
++ return buf;
++ }
++ else
++ {
++ time_t now = time ((time_t *) 0);
++ char *str = (char *) ctime (&now);
++ char *nl = (char *) strchr (str, '\n');
++ if (nl) *nl = 0; /* take off that dang newline */
++ return str;
++ }
+ }
+
+ static Bool blurb_timestamp_p = True; /* kludge */
+Index: xscreensaver.h
+===================================================================
+RCS file: /cvsroot/xscreensaver/driver/xscreensaver.h,v
+retrieving revision 1.87
+diff -u -r1.87 xscreensaver.h
+--- xscreensaver.h 10 Jan 2011 02:03:50 -0000 1.87
++++ xscreensaver.h 28 Jun 2012 18:22:46 -0000
+@@ -189,6 +189,7 @@
+ extern int saver_ehandler (Display *dpy, XErrorEvent *error);
+ extern int BadWindow_ehandler (Display *dpy, XErrorEvent *error);
+ extern Bool window_exists_p (Display *dpy, Window window);
++extern Bool in_signal_handler_p;
+ extern char *timestring (void);
+ extern Bool display_is_on_console_p (saver_info *si);
+ extern Visual *get_best_gl_visual (saver_info *si, Screen *screen);
+Exit 1
diff --git a/xscreensaver.spec b/xscreensaver.spec
index e244b90..7985080 100644
--- a/xscreensaver.spec
+++ b/xscreensaver.spec
@@ -10,7 +10,7 @@
%define split_getimage 1
%endif
-%define fedora_rel 1
+%define fedora_rel 2
%undefine extrarel
@@ -65,11 +65,15 @@ Patch30: xscreensaver-5.11-conf264.patch
Patch32: xscreensaver-5.13-dpmsQuickoff-japo.patch
# lament now uses a larger xpm file
Patch33: xscreensaver-5.17-lament-newxpm.patch
+# Don't call ctime() in signal handler, patch from jwz
+Patch34: xscreensaver-5.17-blurb-in-sighandler-jwz.patch
#
# driver/test-passwd tty segfaults
Patch41: xscreensaver-5.12-test-passwd-segv-tty.patch
# patch to compile driver/test-xdpms
Patch42: xscreensaver-5.12-tests-miscfix.patch
+# patch to compile driver/test-passwd.c with Patch34
+Patch43: xscreensaver-5.17-blurb-hndl-test-passwd.patch
#
# Patches end
Requires: xscreensaver-base = %{epoch}:%{version}-%{release}
@@ -260,8 +264,12 @@ This package contains some test programs to debug XScreenSaver.
%patch21 -p1 -b .nonet
%patch32 -p1 -b .dpmsoff_japo
%patch33 -p1 -b .newxpm
+( cd driver
+%patch34 -p0 -b .blurb_hndl
+)
%patch41 -p1 -b .test_passwd
%patch42 -p1 -b .test_misc
+%patch43 -p1 -b .hndl_extra
change_option(){
set +x
@@ -379,14 +387,12 @@ sed -i.icon -e 's|xscreensaver\.xpm|xscreensaver|' \
# Disable (don't build) some tests
# apm: doesn't compile
-# passwd: causes segv
-# mlstring: causes OOM
+# mlstring: causes OOM - need check again
sed -i.test \
-e 's|test-apm[ \t][ \t]*t|t|' \
%if 0
- -e 's|test-passwd[ \t][ \t]*t|t|' \
-%endif
-e 's|test-mlstring[ \t][ \t]*t|t|' \
+%endif
driver/Makefile.in
# test-fade: give more time between fading
@@ -811,6 +817,9 @@ exit 0
%defattr(-,root,root,-)
%changelog
+* Sat Jun 30 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1:5.17-2
+- Don't call ctime in blurb in signal hander, patch by jwz
+
* Sat Jun 23 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1:5.17-1
- Update to 5.17
More information about the scm-commits
mailing list