patches/glibc/2.9/230-2.3.3-localedef-fix-trampoline.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed May 04 00:04:23 2011 +0200 (2011-05-04)
changeset 2608 aa09a36c3d36
parent 1201 c9967a6e3b25
permissions -rw-r--r--
scripts/functions: test for decompressors before use

./configure does check for the presence of gz and bzip2, so we can
safely use them in the build scripts.

On the other hand, more recent formats (eg. XZ) are not yet widely
available, and we do not want, and can't, force the user to install
them as a pre-requisite.

So, build up a list of allowed tarball formats based on the available
decompressors. For no, this is a static list, but the upcoming XZ
support will conditionnaly add to this list.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 Original patch from: gentoo/src/patchsets/glibc/2.9/1040_all_2.3.3-localedef-fix-trampoline.patch
     2 
     3 -= BEGIN original header =-
     4 #! /bin/sh -e
     5 
     6 # DP: Description: Fix localedef segfault when run under exec-shield,
     7 #        PaX or similar. (#231438, #198099)
     8 # DP: Dpatch Author: James Troup <james@nocrew.org>
     9 # DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
    10 # DP: Upstream status: Unknown
    11 # DP: Status Details: Unknown
    12 # DP: Date: 2004-03-16
    13 
    14 if [ $# -ne 2 ]; then
    15     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    16     exit 1
    17 fi
    18 case "$1" in
    19     -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    20     -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    21     *)
    22 	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    23 	exit 1
    24 esac
    25 exit 0
    26 
    27 -= END original header =-
    28 
    29 diff -durN glibc-2_9.orig/locale/programs/3level.h glibc-2_9/locale/programs/3level.h
    30 --- glibc-2_9.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
    31 +++ glibc-2_9/locale/programs/3level.h	2009-02-02 22:00:54.000000000 +0100
    32 @@ -203,6 +203,42 @@
    33  	}
    34      }
    35  }
    36 +
    37 +/* GCC ATM seems to do a poor job with pointers to nested functions passed
    38 +   to inlined functions.  Help it a little bit with this hack.  */
    39 +#define wchead_table_iterate(tp, fn) \
    40 +do									      \
    41 +  {									      \
    42 +    struct wchead_table *t = (tp);					      \
    43 +    uint32_t index1;							      \
    44 +    for (index1 = 0; index1 < t->level1_size; index1++)			      \
    45 +      {									      \
    46 +	uint32_t lookup1 = t->level1[index1];				      \
    47 +	if (lookup1 != ((uint32_t) ~0))					      \
    48 +	  {								      \
    49 +	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
    50 +	    uint32_t index2;						      \
    51 +	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
    52 +	      {								      \
    53 +		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
    54 +		if (lookup2 != ((uint32_t) ~0))				      \
    55 +		  {							      \
    56 +		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
    57 +		    uint32_t index3;					      \
    58 +		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
    59 +		      {							      \
    60 +			struct element_t *lookup3			      \
    61 +			  = t->level3[index3 + lookup2_shifted];	      \
    62 +			if (lookup3 != NULL)				      \
    63 +			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
    64 +			      lookup3);					      \
    65 +		      }							      \
    66 +		  }							      \
    67 +	      }								      \
    68 +	  }								      \
    69 +      }									      \
    70 +  } while (0)
    71 +
    72  #endif
    73  
    74  #ifndef NO_FINALIZE