NetBSD Problem Report #44918

From tron@zhadum.org.uk  Sat Apr 30 08:27:59 2011
Return-Path: <tron@zhadum.org.uk>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id C7A4F63B9D1
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Apr 2011 08:27:59 +0000 (UTC)
Message-Id: <20110430082755.92160AF4B@sheridan.zhadum.org.uk>
Date: Sat, 30 Apr 2011 09:27:55 +0100 (BST)
From: tron@zhadum.org.uk
Reply-To: tron@zhadum.org.uk
To: gnats-bugs@gnats.NetBSD.org
Subject: Recent "libc" changes break "bash" under NetBSD/sparc64
X-Send-Pr-Version: 3.95

>Number:         44918
>Category:       port-sparc64
>Synopsis:       Recent "libc" changes break "bash" under NetBSD/sparc64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 30 08:30:05 +0000 2011
>Closed-Date:    Sat Apr 30 23:58:56 +0000 2011
>Last-Modified:  Sun May 01 00:00:03 +0000 2011
>Originator:     tron@zhadum.org.uk
>Release:        NetBSD 5.99.51 2011-04-29 sources
>Organization:
Matthias Scheler                                  http://zhadum.org.uk/
>Environment:
System: NetBSD sheridan.zhadum.org.uk 5.99.51 NetBSD 5.99.51 (SHERIDAN) #0: Fri Apr 29 16:35:56 BST 2011 tron@excalibur.zhadum.org.uk:/Volumes/Sources/obj/sys/arch/sparc64/compile/SHERIDAN sparc64
Architecture: sparc64
Machine: sparc64
>Description:
It seems that the fix for PR port-sparc64/44902 causes problem in e.g. "bash".
The following simple script causes a bus error:

tron@sheridan:~>uname -a
NetBSD sheridan.zhadum.org.uk 5.99.51 NetBSD 5.99.51 (SHERIDAN) #0: Fri Apr 29 16:35:56 BST 2011  tron@excalibur.zhadum.org.uk:/Volumes/Sources/obj/sys/arch/sparc64/compile/SHERIDAN sparc64
tron@sheridan:~>cat bang.sh 
#!/usr/pkg/bin/bash
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='printf %s\n'
  as_echo_n='printf %s'
else
  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    :
  fi
fi

tron@sheridan:~>./bang.sh 
./bang.sh: line 19:   923 Bus error               ( test "X`printf %s $as_echo`" = "X$as_echo" ) 2> /dev/null
tron@sheridan:~>

It works fine under NetBSD/amd64 5.1_STABLE:

tron@colwyn:~>uname -a
NetBSD colwyn.zhadum.org.uk 5.1_STABLE NetBSD 5.1_STABLE (COLWYN.64) #0: Tue Mar  8 09:15:48 GMT 2011  tron@colwyn.zhadum.org.uk:/src/sys/compile/COLWYN.64 amd64
tron@colwyn:~>./bang.sh
tron@colwyn:~>

>How-To-Repeat:
cd pkgsrc/databases/mysql51-client
make configure

>Fix:
Not known.

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44918 CVS commit: src/lib/libc/arch/sparc64/gen
Date: Sat, 30 Apr 2011 19:39:38 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Apr 30 19:39:38 UTC 2011

 Modified Files:
 	src/lib/libc/arch/sparc64/gen: longjmp.c setjmp.S sigsetjmp.S

 Log Message:
 Rearange jmp_buf content again: storing the sigsetjmp() save_mask midway
 inside the environment is not a good idea, we may overwrite it when
 fetching other details of the sigjmp environment.
 Instead move it to the very end again.
 Do not bother to save volatile (caller saved) global registers.
 Fixes PR port-sparc64/44918.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/sparc64/gen/longjmp.c
 cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/sparc64/gen/setjmp.S
 cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/sparc64/gen/sigsetjmp.S

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: port-sparc64-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 30 Apr 2011 23:58:56 +0000
Responsible-Changed-Why:
I broke & fixed it


State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sat, 30 Apr 2011 23:58:56 +0000
State-Changed-Why:
Confirmed fixed, thanks for the report!


From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc: port-sparc64-maintainer@netbsd.org
Subject: Re: PR/44918 CVS commit: src/lib/libc/arch/sparc64/gen
Date: Sun, 1 May 2011 00:56:27 +0100

 On Sat, Apr 30, 2011 at 07:40:05PM +0000, Martin Husemann wrote:
 > The following reply was made to PR port-sparc64/44918; it has been noted by GNATS.
 > 
 > From: "Martin Husemann" <martin@netbsd.org>
 > To: gnats-bugs@gnats.NetBSD.org
 > Cc: 
 > Subject: PR/44918 CVS commit: src/lib/libc/arch/sparc64/gen
 > Date: Sat, 30 Apr 2011 19:39:38 +0000
 > 
 >  Module Name:	src
 >  Committed By:	martin
 >  Date:		Sat Apr 30 19:39:38 UTC 2011
 >  
 >  Modified Files:
 >  	src/lib/libc/arch/sparc64/gen: longjmp.c setjmp.S sigsetjmp.S
 >  
 >  Log Message:
 >  Rearange jmp_buf content again: storing the sigsetjmp() save_mask midway
 >  inside the environment is not a good idea, we may overwrite it when
 >  fetching other details of the sigjmp environment.
 >  Instead move it to the very end again.
 >  Do not bother to save volatile (caller saved) global registers.
 >  Fixes PR port-sparc64/44918.

 I can confirm that this fixes PR port-sparc64/44918 without re-introducing
 PR port-sparc64/44902. Please close this PR.

 	Thanks a lot

 -- 
 Matthias Scheler                                  http://zhadum.org.uk/

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.