patches/glibc/ports-2.12.1/190-localedef-mmap.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 13 23:32:39 2011 +0100 (2011-12-13)
branch1.13
changeset 2847 c0bf2319af08
permissions -rw-r--r--
scripts: fix dumping execution backtrace

Dumping the backtrace has been broken since changeset #652e56d6d35a:
scripts: execute each steps in a subshell

We can spawn sub-sub-shells in some cases.

The way the fault handler works is to dump the backtrace, but to avoid
printing it once for every sub-shell (which could get quite confusing),
it simply exits when it detects that it is being run in a sub-shell,
leaving to the top-level shell the work to dump the backtrace.

Because each step is executed in its own sub-shell, the variable arrays
that contain the step name, the source file and line number, are lost
when exiting the per-step sub-shell.

Hence, the backtrace is currently limited to printing only the top-level
main procedure of the shell.

Fix this thus:
- when dumping the bckatraces for the steps & the functions, remember
it was dumped, and only dump it if it was not already dumped
- at the top-level shell, print the hints

Also, rename the top-level step label.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 4193d6e6a17430a177fa88c287879c2c35e319f3)
yann@2437
     1
sniped from Debian
yann@2437
     2
http://bugs.gentoo.org/289615
yann@2437
     3
yann@2437
     4
2009-10-27  Aurelien Jarno  <aurelien@aurel32.net>
yann@2437
     5
yann@2437
     6
	* locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
yann@2437
     7
	used later with MMAP_FIXED | MMAP_SHARED to cope with different
yann@2437
     8
	alignment restrictions.
yann@2437
     9
yann@2437
    10
diff -durN glibc-2.12.1.orig/locale/programs/locarchive.c glibc-2.12.1/locale/programs/locarchive.c
yann@2437
    11
--- glibc-2.12.1.orig/locale/programs/locarchive.c	2009-04-27 16:07:47.000000000 +0200
yann@2437
    12
+++ glibc-2.12.1/locale/programs/locarchive.c	2009-11-13 00:50:01.000000000 +0100
yann@2437
    13
@@ -134,7 +134,7 @@
yann@2437
    14
   size_t reserved = RESERVE_MMAP_SIZE;
yann@2437
    15
   int xflags = 0;
yann@2437
    16
   if (total < reserved
yann@2437
    17
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
yann@2437
    18
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
yann@2437
    19
 		       -1, 0)) != MAP_FAILED))
yann@2437
    20
     xflags = MAP_FIXED;
yann@2437
    21
   else
yann@2437
    22
@@ -396,7 +396,7 @@
yann@2437
    23
   size_t reserved = RESERVE_MMAP_SIZE;
yann@2437
    24
   int xflags = 0;
yann@2437
    25
   if (total < reserved
yann@2437
    26
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
yann@2437
    27
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
yann@2437
    28
 		       -1, 0)) != MAP_FAILED))
yann@2437
    29
     xflags = MAP_FIXED;
yann@2437
    30
   else
yann@2437
    31
@@ -614,7 +614,7 @@
yann@2437
    32
   int xflags = 0;
yann@2437
    33
   void *p;
yann@2437
    34
   if (st.st_size < reserved
yann@2437
    35
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
yann@2437
    36
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
yann@2437
    37
 		       -1, 0)) != MAP_FAILED))
yann@2437
    38
     xflags = MAP_FIXED;
yann@2437
    39
   else