Package: gawk
Version: 1:3.1.6.dfsg-1
Severity: important
Tags: patch

Hi,

There is a regression in the testsuite on arm, from the build log:

[...]
|rand
|./rand.ok _rand differ: char 2, line 1
|make[2]: [rand] Error 1 (ignored)
[...]
|1 TESTS FAILED
[...]

Here is a patch taken from upstream CVS to fix it.


Thanks,

Arthur.

#! /bin/sh -e
## 05_arm_align.dpatch
##
## DP: Description: Fix rand.awk test case alignment problem on arm.
## DP: Author: Duncan Moore <[EMAIL PROTECTED]>
## DP: Upstream status: Applied to CVS
## DP: URL: 
http://lists.gnu.org/archive/html/bug-gnu-utils/2008-03/msg00018.html
## DP: Date: 2008-04-23

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0


Wed Apr 23 22:30:27 2008  Duncan Moore       <[EMAIL PROTECTED]>

        * builtin.c (state): Do as an integer array for systems that need it.
        (do_rand, init_rand): Modify call to `initstate' as needed.

@DPATCH@
--- gawk-3.1.6/builtin.c        2008/03/15 20:27:35     1.24
+++ gawk-3.1.6/builtin.c        2008/04/23 19:35:57     1.25
@@ -2042,14 +2042,17 @@
 /* do_rand --- do the rand function */
 
 static int firstrand = TRUE;
-static char state[256];
+/* Some systems require this array to be integer aligned. Sigh. */
+#define SIZEOF_STATE 256
+static uint32_t istate[SIZEOF_STATE/sizeof(uint32_t)];
+static char *const state = (char *const) istate;
 
 /* ARGSUSED */
 NODE *
 do_rand(NODE *tree ATTRIBUTE_UNUSED)
 {
        if (firstrand) {
-               (void) initstate((unsigned) 1, state, sizeof state);
+               (void) initstate((unsigned) 1, state, SIZEOF_STATE);
                /* don't need to srandom(1), initstate() does it for us. */
                firstrand = FALSE;
                setstate(state);
@@ -2072,7 +2075,7 @@
        long ret = save_seed;   /* SVR4 awk srand returns previous seed */
 
        if (firstrand) {
-               (void) initstate((unsigned) 1, state, sizeof state);
+               (void) initstate((unsigned) 1, state, SIZEOF_STATE);
                /* don't need to srandom(1), we're changing the seed below */
                firstrand = FALSE;
                (void) setstate(state);

Attachment: signature.asc
Description: Digital signature

Reply via email to