From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 803 invoked by alias); 20 Jun 2012 15:27:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30518 Received: (qmail 16972 invoked from network); 20 Jun 2012 15:27:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,URIBL_BLACK autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 20 Jun 2012 16:26:11 +0100 From: Peter Stephenson To: Subject: Re: Solaris 10 64bit build of zsh 4.3.17 crashes on cursor right Message-ID: <20120620162611.49e5355e@pwslap01u.europe.root.pri> In-Reply-To: <4FDF465B.4020906@oracle.com> References: <4FDF465B.4020906@oracle.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.18] X-Scanned-By: MailControl 7.7.2 (www.mailcontrol.com) on 10.68.0.127 On Mon, 18 Jun 2012 17:16:43 +0200 Clemens Huebner wrote: > When compiled on Solaris 10 (or earlier) as 64bit, zsh will crash every > time cursor right is pressed. > > This is due to Solaris Bug 1240072. The bug causes tgoto() not to be > declared in term.h, if __STDC__ is set. The bug is fixed in Solaris 11, > but not in Solaris 10 or earlier. > > Due to the missing prototype, the char pointer returned by tgoto() will > be cast to int. This works on 32bit builds, but will truncate the > pointer on 64bit builds, as the 64 bit pointer will be cast to a 32 bit int. Well, we can detect a missing prototype in autoconf by looking for a conflict. The big danger here is that we pick up the correct prototype by some other headers we're not including at this point, and that prototype conflicts slightly with the one we use. It should be a small risk since at this point we're using the full power of our 20-year experience of finding terminal library headers. Hmm. Index: configure.ac =================================================================== RCS file: /cvsroot/zsh/zsh/configure.ac,v retrieving revision 1.138 diff -p -u -r1.138 configure.ac --- configure.ac 5 Mar 2012 10:06:28 -0000 1.138 +++ configure.ac 20 Jun 2012 15:22:14 -0000 @@ -1603,6 +1603,8 @@ AH_TEMPLATE([HAVE_NUMNAMES], [Define if you have the terminfo numnames symbol.]) AH_TEMPLATE([HAVE_STRNAMES], [Define if you have the terminfo strnames symbol.]) +AH_TEMPLATE([TGOTO_PROTO_MISSING], +[Define if there is no prototype for the tgoto() terminal function.]) if test x$zsh_cv_path_term_header != xnone; then AC_DEFINE(ZSH_HAVE_TERM_H) @@ -1618,26 +1620,42 @@ if test x$zsh_cv_path_term_header != xno AC_TRY_LINK($term_includes, [char **test = boolcodes; puts(*test);], AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no) AC_MSG_RESULT($boolcodes) + AC_MSG_CHECKING(if numcodes is available) AC_TRY_LINK($term_includes, [char **test = numcodes; puts(*test);], AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no) AC_MSG_RESULT($numcodes) + AC_MSG_CHECKING(if strcodes is available) AC_TRY_LINK($term_includes, [char **test = strcodes; puts(*test);], AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no) AC_MSG_RESULT($strcodes) + AC_MSG_CHECKING(if boolnames is available) AC_TRY_LINK($term_includes, [char **test = boolnames; puts(*test);], AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no) AC_MSG_RESULT($boolnames) + AC_MSG_CHECKING(if numnames is available) AC_TRY_LINK($term_includes, [char **test = numnames; puts(*test);], AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no) AC_MSG_RESULT($numnames) + AC_MSG_CHECKING(if strnames is available) AC_TRY_LINK($term_includes, [char **test = strnames; puts(*test);], AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no) AC_MSG_RESULT($strnames) + + dnl There are apparently defective terminal library headers on some + dnl versions of Solaris before 11. + AC_MSG_CHECKING(if tgoto prototype is missing) + tgoto_includes="$term_includes +/* guaranteed to clash with any valid tgoto prototype */ +extern void tgoto(int **stuff, float **more_stuff);" + AC_TRY_LINK($tgoto_includes, + [int *stuff; float *more_stuff; tgoto(&stuff, &more_stuff);], + AC_DEFINE(TGOTO_PROTO_MISSING) tgotoprotomissing=yes, tgotoprotomissing=no) + AC_MSG_RESULT($tgotoprotomissing) else ZSH_TERM_H= fi Index: Src/zsh_system.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh_system.h,v retrieving revision 1.1 diff -p -u -r1.1 zsh_system.h --- Src/zsh_system.h 10 May 2011 16:44:39 -0000 1.1 +++ Src/zsh_system.h 20 Jun 2012 15:22:14 -0000 @@ -874,3 +874,7 @@ extern short ospeed; # endif # endif #endif + +#ifdef TGOTO_PROTO_MISSING +char *tgoto(const char *cap, int col, int row); +#endif -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog