[Reproducible-commits] [texlive-bin] 99/400: * (pulled from upupstream cvs, patch xdvi-upupstream-fixes) - Fixed bugs in property handling on 64-bit systems (related to source specials). - Added support for XkbBell, to make the console bell work again.

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Thu Jul 9 21:39:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch master
in repository texlive-bin.

commit 4b9bcc4b16be7004fbb2d44b2278fa710bf98227
Author: Norbert Preining <preining at debian.org>
Date:   Sat Jun 23 03:59:20 2012 +0000

    * (pulled from upupstream cvs, patch xdvi-upupstream-fixes)
      - Fixed bugs in property handling on 64-bit systems (related to source
        specials).
      - Added support for XkbBell, to make the console bell work again.
---
 debian/changelog                   |   8 +-
 debian/quilt/series                |   1 +
 debian/quilt/xdvi-upupstream-fixes | 442 +++++++++++++++++++++++++++++++++++++
 3 files changed, 449 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 60c9cf7..00d5e2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-texlive-bin (2012.20120623-1) UNRELEASED; urgency=low
+texlive-bin (2012.20120623-1) unstable; urgency=low
 
   * post release fixed from Peter Breitenlohner (will be included upstream):
     - (patch-dvi2tty, patch-lacheck) Ken Brown <kbrow1i at gmail.com> has noteda
@@ -12,8 +12,12 @@ texlive-bin (2012.20120623-1) UNRELEASED; urgency=low
     building pdfTeX that way slightly reduces its capability to handle large 
     files (see README.config 1.6 and 3.4.2).
   * update updmap man page (Closes: #677300)
+  * (pulled from upupstream cvs, patch xdvi-upupstream-fixes)
+    - Fixed bugs in property handling on 64-bit systems (related to source 
+      specials).
+    - Added support for XkbBell, to make the console bell work again.
 
- -- Norbert Preining <preining at debian.org>  Sat, 23 Jun 2012 12:32:48 +0900
+ -- Norbert Preining <preining at debian.org>  Sat, 23 Jun 2012 12:57:25 +0900
 
 texlive-bin (2012.20120530-2) unstable; urgency=low
 
diff --git a/debian/quilt/series b/debian/quilt/series
index 2357e83..b53353b 100644
--- a/debian/quilt/series
+++ b/debian/quilt/series
@@ -23,3 +23,4 @@ patch-icu -p0
 patch-lacheck -p0
 patch-pdftex -p0
 patch-update-updmap-manpage
+xdvi-upupstream-fixes
diff --git a/debian/quilt/xdvi-upupstream-fixes b/debian/quilt/xdvi-upupstream-fixes
new file mode 100644
index 0000000..edd8056
--- /dev/null
+++ b/debian/quilt/xdvi-upupstream-fixes
@@ -0,0 +1,442 @@
+---
+ texk/xdvik/dvi-init.c |    4 -
+ texk/xdvik/events.c   |   13 +++
+ texk/xdvik/x_util.c   |  179 ++++++++++++++++++++------------------------------
+ texk/xdvik/x_util.h   |    3 
+ texk/xdvik/xdvi.c     |   10 --
+ texk/xdvik/xdvi.h     |    8 --
+ 6 files changed, 87 insertions(+), 130 deletions(-)
+
+Index: texlive-bin-2012.20120623/texk/xdvik/dvi-init.c
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/dvi-init.c	2012-06-23 12:51:06.438088084 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/dvi-init.c	2012-06-23 12:51:39.858119533 +0900
+@@ -1642,8 +1642,8 @@
+     dvi_property_length = strlen(globals.dvi_name) + 1; /* also copy the terminating 0 */
+     dvi_property = xmalloc(dvi_property_length);
+ 
+-    /* NOTE: we don't use dvi_inode like non-k xdvi, since dvi_name is
+-       always fully expanded with xdvik. */
++    /* NOTE: we don't use dvi_inode like non-k xdvi, since xdvik keeps closer
++       track of when the path points to a different inode. */
+     strcpy(dvi_property, globals.dvi_name);
+ }
+ 
+Index: texlive-bin-2012.20120623/texk/xdvik/x_util.c
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/x_util.c	2012-06-23 12:51:06.438088084 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/x_util.c	2012-06-23 12:51:39.858119533 +0900
+@@ -196,35 +196,24 @@
+ };
+ static Atom atoms[XtNumber(atom_names)];
+ 
+-Window
+-get_window_id(char *window_p)
+-{
+-    Window w;
+-    unsigned char *tmp;
+-    tmp = (unsigned char *)window_p;
+-    
+-#if !(defined(WORD64) || defined(LONG64))
+-    w = (*((xuint32 *) window_p));
++/*
++ *	On 64-bit platforms, XGetWindowProperty and related functions convert
++ *	properties with format=32 to arrays of longs.  This function keeps that
++ *	convention.
++ *	The return value is the total number of bytes in the buffer.
++ */
++
++#if defined(WORD64) || defined(LONG64)
++# define LONG_CONV_64(bytes, format)	((bytes) << ((format) >> 5))
+ #else
+-# if WORDS_BIGENDIAN
+-    w = ((unsigned long)tmp[0] << 24) |
+-	((unsigned long)tmp[1] << 16) |
+-	((unsigned long)tmp[2] << 8)  |
+-	(unsigned long)tmp[3];
+-# else
+-    w = ((unsigned long)tmp[3] << 24) |
+-	((unsigned long)tmp[2] << 16) |
+-	((unsigned long)tmp[1] << 8)  |
+-	(unsigned long)tmp[0];
+-# endif
++# define LONG_CONV_64(bytes, format)	(bytes)
+ #endif
+-    return w;
+-}
+ 
+ size_t
+ property_get_data(Window w, Atom a, char **ret_buf,
+ 		  int (*x_get_property)(Display *, Window, Atom, long,
+-					long, Bool, Atom, Atom *, int *, unsigned long *,
++					long, Bool, Atom,
++					Atom *, int *, unsigned long *,
+ 					unsigned long *, unsigned char **))
+ {
+     /* all of these are in 8-bit units */
+@@ -253,13 +242,17 @@
+ 
+ 	nitems_ret *= (format_ret / 8);	/* convert to bytes */
+ 
+-	while ((byte_offset + nitems_ret) >= buffer_len) {
+-	    buffer_len += 256;
+-	    buffer = xrealloc(buffer, buffer_len);
++	if (LONG_CONV_64(byte_offset + nitems_ret, format_ret) >= buffer_len) {
++	    buffer_len += 256
++			  * ((LONG_CONV_64(byte_offset + nitems_ret, format_ret)
++			      - buffer_len) / 256 + 1);
++	    buffer = (buffer == NULL ? xmalloc(buffer_len)
++				     : xrealloc(buffer, buffer_len));
+ 	}
+ 
+ 	/* the +1 captures the extra '\0' that Xlib puts after the end.  */
+-	memcpy(buffer + byte_offset, prop_ret, nitems_ret + 1);
++	memcpy(buffer + LONG_CONV_64(byte_offset, format_ret), prop_ret,
++	       LONG_CONV_64(nitems_ret, format_ret) + 1);
+ 	byte_offset += nitems_ret;
+ 
+ 	XFree(prop_ret);
+@@ -273,42 +266,28 @@
+ 	XFree(prop_ret);
+ 
+     *ret_buf = (char *)buffer;
+-    return byte_offset;
++    return LONG_CONV_64(byte_offset, format_ret);
+ }
+ 
+-size_t
+-property_get_window_list(char **window_list)
++static size_t
++property_get_window_list(long **window_list)
+ {
+     size_t len = property_get_data(DefaultRootWindow(DISP),
+-				   atom_xdvi_windows(), window_list,
++				   atom_xdvi_windows(), (char **) window_list,
+ 				   XGetWindowProperty);
+     if (len == 0) {
+ 	TRACE_CLIENT((stderr, "No \"xdvi windows\" property found"));
+ 	return 0;
+     }
+     
+-    if (len % 4 != 0) {
+-	TRACE_CLIENT((stderr, "\"XDVI_WINDOWS\" property had incorrect size; deleting it."));
++    if (len % sizeof(long) != 0) {
++	TRACE_CLIENT((stderr,
++		"\"XDVI_WINDOWS\" property had incorrect size; deleting it."));
+ 	XDeleteProperty(DISP, DefaultRootWindow(DISP), atom_xdvi_windows());
+ 	return 0;
+     }
+-    return len;
+-}
+ 
+-void
+-set_window_id(Window w, unsigned char *data)
+-{
+-#if WORDS_BIGENDIAN
+-    data[0] = (unsigned int)w >> 24;
+-    data[1] = (unsigned int)w >> 16;
+-    data[2] = (unsigned int)w >> 8;
+-    data[3] = (unsigned int)w;
+-#else
+-    data[0] = (unsigned int)w;
+-    data[1] = (unsigned int)w >> 8;
+-    data[2] = (unsigned int)w >> 16;
+-    data[3] = (unsigned int)w >> 24;
+-#endif
++    return len / sizeof (long);
+ }
+ 
+ /**
+@@ -325,16 +304,16 @@
+ 
+ 
+ /*
+- * Delete all occurences of window w from the window list property. Then,
+- * if `prepend' is true, prepend the window ID to the existing list.
++ * Delete all occurrences of window w from the window list property.
++ * Then, if `prepend' is true, prepend the window ID to the existing list.
+  */
+ void
+ update_window_property(Window w, Boolean prepend)
+ {
+-    char *wlist;
++    long *wlist;
+     size_t wlist_len;
+-    char *wlist_end;
+-    char *wp;
++    long *wlist_end;
++    long *wp;
+ #if 0
+     int i;
+ #endif /* 0 */
+@@ -347,33 +326,27 @@
+     wlist_end = wlist + wlist_len;
+ 
+ #if 0
+-    for (i = 0, wp = wlist; wp < wlist_end; wp += 4, i++) {
+-	fprintf(stderr, "WIN %d: %08lx; len: %d\n", i, get_window_id(wp), wlist_len);
++    for (i = 0, wp = wlist; wp < wlist_end; ++wp, ++i) {
++	fprintf(stderr, "WIN %d: %08lx; len: %d\n", i, *wp, wlist_len);
+     }
+ #endif /* 0 */
+     
+-    for (wp = wlist; wp < wlist_end; wp += 4) {
+-	if (get_window_id(wp) == w) { /* match, remove our ID */
+-	    wlist_len -= 4;
+-	    wlist_end -= 4;
+-	    memmove(wp, wp + 4, wlist_end - wp);
+-	    wp -= 4; /* new item is now at wp; don't skip it in next iteration */
++    for (wp = wlist; wp < wlist_end; ++wp) {
++	if (*wp == w) { /* match, remove our ID */
++	    --wlist_len;
++	    --wlist_end;
++	    memmove(wp, wp + 1, (wlist_end - wp) * sizeof (long));
++	    --wp; /* new item is now at wp; don't skip it in next iteration */
+ 	}
+     }
+     
+     if (prepend) { /* add our ID again to front */
+-#if (defined(WORD64) || defined(LONG64))
+-	unsigned char data[4];
+-	set_window_id(w, data);
+-#else
+-	xuint32 data = w;
+-#endif
+ 	/* Note: no need to realloc wlist, since the original length
+ 	   was sufficient for all elements.
+ 	*/
+-	memmove(wlist + 4, wlist, wlist_len);
+-	wlist_len += 4;
+-	memcpy(wlist, &data, 4);
++	memmove(wlist + 1, wlist, wlist_len * sizeof (long));
++	++wlist_len;
++	*wlist = w;
+     }
+ 	    
+     if (wlist_len == 0)
+@@ -382,8 +355,7 @@
+     else
+ 	XChangeProperty(DISP, DefaultRootWindow(DISP),
+ 			atom_xdvi_windows(), atom_xdvi_windows(), 32,
+-			PropModeReplace, (unsigned char *)wlist,
+-			wlist_len / 4);
++			PropModeReplace, (unsigned char *)wlist, wlist_len);
+     
+     XFlush(DISP);
+ }
+@@ -1102,30 +1074,32 @@
+ }
+ 
+ /*
+- * Check for another running copy of xdvi. If same_file is true, return
+- * the window ID of that other instance only if it has currently loaded the
+- * same file; else, return 0.
++ * Check for another running copy of xdvi.
++ * If same_file is true, return the window ID of an instance that has
++ * currently loaded the same file, or 0 if none exists.
+  * If same_file is false, return the first valid xdvi window ID.
+  */
++
+ Window
+ get_xdvi_window_id(Boolean same_file, property_cbT callback)
+ {
+-    char *window_list;
++    long *window_list;
+     size_t window_list_len;
+-    char *window_list_end;
+-    char *wp;
+-    char *p;
++    long *window_list_end;
++    long *wp;
++    long *p;
+     Boolean need_rewrite = False;
+     Window ret_window = 0;
+ 
+     /*
+-     * Get window list.  Copy it over (we'll be calling property_get_data() again).
++     * Get window list.
++     * Copy it over (we'll be calling property_get_data() again).
+      */
+     if ((window_list_len = property_get_window_list(&p)) == 0)
+ 	return 0;
+ 
+-    window_list = xmalloc(window_list_len);
+-    memcpy(window_list, p, window_list_len);
++    window_list = xmalloc(window_list_len * sizeof (long));
++    memcpy(window_list, p, window_list_len * sizeof (long));
+ 
+     XdviOldErrorHandler = XSetErrorHandler(XdviErrorHandler);
+ 
+@@ -1134,16 +1108,13 @@
+     window_list_end = window_list + window_list_len;
+     TRACE_CLIENT((stderr, "My property: `%s'", dvi_property));
+ 
+-    for (wp = window_list; wp < window_list_end; wp += 4) {
+-	Window w;
++    for (wp = window_list; wp < window_list_end; ++wp) {
+ 	char *buf_ret;
+ 	size_t len;
+ 
+-	w = get_window_id(wp);
+-
+-	TRACE_CLIENT((stderr, "Checking window %08lx", w));
++	TRACE_CLIENT((stderr, "Checking window %08lx", *wp));
+ 	
+-	len = property_get_data(w, atom_dvi_file(), &buf_ret,
++	len = property_get_data((Window) *wp, atom_dvi_file(), &buf_ret,
+ 				XdviGetWindowProperty);
+ 
+ 	if (len == 0) {
+@@ -1151,39 +1122,33 @@
+ 	       that the application the window had belonged to had
+ 	       been killed with signal 9
+ 	    */
+-	    TRACE_CLIENT((stderr, "Window %08lx: doesn't exist any more, deleting", w));
+-	    window_list_len -= 4;
+-	    window_list_end -= 4;
+-	    memmove(wp, wp + 4, window_list_end - wp);
+-	    wp -= 4; /* new item is now at wp; don't skip it in next iteration */
++	    TRACE_CLIENT((stderr,
++			"Window %08lx: doesn't exist any more, deleting", *wp));
++	    --window_list_len;
++	    --window_list_end;
++	    memmove(wp, wp + 1, (window_list_end - wp) * sizeof (long));
++	    --wp; /* new item is now at wp; don't skip it in next iteration */
+ 	    need_rewrite = True;
+ 	    continue;
+ 	}
+ 	else { /* window still alive */
+ 	    if (globals.debug & DBG_CLIENT) {
+-#if 0
+-		unsigned long ino;
+-		int i;
+-		
+-		ino = 0;
+-		for (i = 7; i >= 0; --i)
+-		    ino = (ino << 8) | (unsigned char)(buf_ret[i]);
+-#endif
+-		TRACE_CLIENT((stderr, "Window %08lx: property: `%s'", w, buf_ret));
++		TRACE_CLIENT((stderr,
++			      "Window %08lx: property: `%s'", *wp, buf_ret));
+ 	    }
+ 
+ 	    /* invoke callback if given */
+ 	    if (callback != NULL) {
+-		callback(w);
++		callback((Window) *wp);
+ 	    }
+ 	    
+ 	    if (!same_file && ret_window == 0) {
+-		ret_window = w;
++		ret_window = *wp;
+ 		if (callback == 0) /* can return early */
+ 		    break;
+ 	    }
+ 	    else if (strcmp(buf_ret, dvi_property) == 0 && ret_window == 0) { /* match */
+-		ret_window = w;
++		ret_window = *wp;
+ 		if (callback == 0) /* can return early */
+ 		    break;
+ 	    }
+@@ -1196,7 +1161,7 @@
+ 	XChangeProperty(DISP, DefaultRootWindow(DISP),
+ 			atom_xdvi_windows(), atom_xdvi_windows(), 32,
+ 			PropModeReplace, (unsigned char *)window_list,
+-			window_list_len / 4);
++			window_list_len);
+ 
+     return ret_window;
+ }
+Index: texlive-bin-2012.20120623/texk/xdvik/x_util.h
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/x_util.h	2012-06-23 12:51:06.438088084 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/x_util.h	2012-06-23 12:51:39.858119533 +0900
+@@ -50,10 +50,7 @@
+ 						       long, Bool, Atom, Atom *, int *, unsigned long *,
+ 						       unsigned long *, unsigned char **));
+ 
+-extern size_t property_get_window_list(char **window_list);
+ extern void set_dvi_property(void);
+-extern void set_window_id(Window w, unsigned char *data);
+-extern Window get_window_id(char *window_p);
+ extern void update_window_property(Window w, Boolean prepend);
+ extern void update_dvi_property(void);
+ extern void property_initialize(void);
+Index: texlive-bin-2012.20120623/texk/xdvik/xdvi.c
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/xdvi.c	2012-06-23 12:51:06.438088084 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/xdvi.c	2012-06-23 12:51:39.858119533 +0900
+@@ -3300,14 +3300,8 @@
+ 
+     /* Store window id for use by src_client_check().  */
+     {
+-	/* was xuint32, but need 8-byte alignment on some 64-bit systems. */
+-	long data;
+-#if !(defined(WORD64) || defined(LONG64))
+-	data = XtWindow(globals.widgets.top_level);
+-#else
+-	set_window_id(XtWindow(globals.widgets.top_level),
+-		      (unsigned char *)&data);
+-#endif
++	long data = XtWindow(globals.widgets.top_level);
++
+ 	XChangeProperty(DISP, DefaultRootWindow(DISP),
+ 			atom_xdvi_windows(), atom_xdvi_windows(), 32,
+ 			PropModePrepend, (unsigned char *)&data, 1);
+Index: texlive-bin-2012.20120623/texk/xdvik/xdvi.h
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/xdvi.h	2012-06-23 12:51:06.438088084 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/xdvi.h	2012-06-23 12:51:39.858119533 +0900
+@@ -188,14 +188,6 @@
+ 
+ #include <X11/Xmd.h>	/* get WORD64 and LONG64 */
+ 
+-#ifndef WORD64
+-#  ifdef LONG64
+-typedef unsigned int xuint32;
+-#  else
+-typedef unsigned long xuint32;
+-#  endif
+-#endif
+-
+ #if defined(HAVE_STDINT_H)
+ #include <stdint.h>
+ #elif defined(HAVE_INTTYPES_H)
+Index: texlive-bin-2012.20120623/texk/xdvik/events.c
+===================================================================
+--- texlive-bin-2012.20120623.orig/texk/xdvik/events.c	2012-04-02 17:27:30.643007000 +0900
++++ texlive-bin-2012.20120623/texk/xdvik/events.c	2012-06-23 12:54:42.382290601 +0900
+@@ -103,6 +103,14 @@
+ extern int errno;
+ #endif /* X_NOT_STDC_ENV */
+ 
++#if HAVE_XKB_BELL_EXT
++# include <X11/XKBlib.h>
++# define XdviBell(display, window, percent)	\
++	 XkbBell(display, window, percent, (Atom) None)
++#else
++# define XdviBell(display, window, percent)	XBell(display, percent)
++#endif
++
+ /* Linux prefers O_ASYNC over FASYNC; SGI IRIX does the opposite.  */
+ #if !defined(FASYNC) && defined(O_ASYNC)
+ # define FASYNC	O_ASYNC
+@@ -1296,7 +1304,7 @@
+ 
+     if (event->type != ButtonPress || mouse_release != null_mouse
+ 	|| MAGNIFIER_ACTIVE || mane.shrinkfactor == 1 || *num_params != 1) {
+-	XBell(DISP, 0);
++	XdviBell(DISP, event->xany.window, 0);
+ 	if (mane.shrinkfactor == 1) {
+ 	    statusline_info(STATUS_SHORT,
+ 			     "No magnification available at shrink factor 1");
+@@ -5284,7 +5292,8 @@
+        that window.
+     */
+     if (have_src_specials && do_update_property
+-	&& globals.win_expose.min_x != 1 && globals.win_expose.max_y - globals.win_expose.min_y != 1
++	&& globals.win_expose.min_x != 1
++	&& globals.win_expose.max_y - globals.win_expose.min_y != 1
+ 	&& currwin.base_x == 0 && currwin.base_y == 0) {
+ 	update_window_property(XtWindow(globals.widgets.top_level), True);
+     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/texlive-bin.git



More information about the Reproducible-commits mailing list