zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] 4.3.5 build fails on SunOS 4.1.4
@ 2008-03-03  4:58 River Tarnell
  2008-03-03 12:36 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: River Tarnell @ 2008-03-03  4:58 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 679 bytes --]

this platform doesn't provide strtoul(), and zsh has no compat.c
replacement.  the patch (attached) provides one from NetBSD sources
(which i believe has a liberal enough license to be included in zsh).

there are two remaining problems, but i have no idea where to start
on either of them:

 + unless compiled with --disable-dynamic, any attempt to use
   completion-related features crashes the shell with 'Undefined
   symbol: _incompfunc'

 + job control doesn't work properly.  while typing ^Z in 'vi'
   works fine, in 'vim', the program immediately resumes, rather
   than returning to the shell.  both work fine with the system
   'csh'.

        - river.

[-- Attachment #1.2: zsh-sunos.diff --]
[-- Type: application/octet-stream, Size: 3981 bytes --]

*** configure.ac.old	Fri Feb  1 11:22:22 2008
--- configure.ac	Mon Mar  3 04:35:04 2008
***************
*** 1174,1180 ****
  	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
  	       initgroups nis_list \
  	       setuid seteuid setreuid setresuid setsid \
! 	       memcpy memmove strstr strerror \
  	       getrlimit getrusage \
  	       setlocale \
  	       uname \
--- 1174,1180 ----
  	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
  	       initgroups nis_list \
  	       setuid seteuid setreuid setresuid setsid \
! 	       memcpy memmove strstr strerror strtoul \
  	       getrlimit getrusage \
  	       setlocale \
  	       uname \
*** Src/compat.c.old	Tue Jul 18 10:17:11 2006
--- Src/compat.c	Mon Mar  3 03:40:28 2008
***************
*** 448,450 ****
--- 448,552 ----
  }
  /**/
  #endif /* ZSH_64_BIT_TYPE */
+ 
+ #ifndef HAVE_STRTOUL
+ 
+ /*
+  * Copyright (c) 1990, 1993
+  *	The Regents of the University of California.  All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. Neither the name of the University nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ /*
+  * Convert a string to an unsigned long integer.
+  *
+  * Ignores `locale' stuff.  Assumes that the upper and lower case
+  * alphabets and digits are each contiguous.
+  */
+ unsigned long
+ strtoul(nptr, endptr, base)
+ 	const char *nptr;
+ 	char **endptr;
+ 	int base;
+ {
+ 	const char *s;
+ 	unsigned long acc, cutoff;
+ 	int c;
+ 	int neg, any, cutlim;
+ 
+ 	/* endptr may be NULL */
+ 
+ 	s = nptr;
+ 	do {
+ 		c = (unsigned char) *s++;
+ 	} while (isspace(c));
+ 	if (c == '-') {
+ 		neg = 1;
+ 		c = *s++;
+ 	} else {
+ 		neg = 0;
+ 		if (c == '+')
+ 			c = *s++;
+ 	}
+ 	if ((base == 0 || base == 16) &&
+ 	    c == '0' && (*s == 'x' || *s == 'X')) {
+ 		c = s[1];
+ 		s += 2;
+ 		base = 16;
+ 	}
+ 	if (base == 0)
+ 		base = c == '0' ? 8 : 10;
+ 
+ 	cutoff = ULONG_MAX / (unsigned long)base;
+ 	cutlim = (int)(ULONG_MAX % (unsigned long)base);
+ 	for (acc = 0, any = 0;; c = (unsigned char) *s++) {
+ 		if (isdigit(c))
+ 			c -= '0';
+ 		else if (isalpha(c)) {
+ 			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+ 		} else
+ 			break;
+ 		if (c >= base)
+ 			break;
+ 		if (any < 0)
+ 			continue;
+ 		if (acc > cutoff || (acc == cutoff && c > cutlim)) {
+ 			any = -1;
+ 			acc = ULONG_MAX;
+ 			errno = ERANGE;
+ 		} else {
+ 			any = 1;
+ 			acc *= (unsigned long)base;
+ 			acc += c;
+ 		}
+ 	}
+ 	if (neg && any > 0)
+ 		acc = -acc;
+ 	if (endptr != NULL)
+ 		*endptr = any ? s - 1 : nptr;
+ 	return (acc);
+ }
+ #endif

[-- Attachment #2: Type: application/pgp-signature, Size: 183 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 4.3.5 build fails on SunOS 4.1.4
  2008-03-03  4:58 [PATCH] 4.3.5 build fails on SunOS 4.1.4 River Tarnell
@ 2008-03-03 12:36 ` Peter Stephenson
  2008-03-03 17:31   ` Vin Shelton
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-03-03 12:36 UTC (permalink / raw)
  To: River Tarnell, Zsh Hackers' List

On Mon, 3 Mar 2008 04:58:15 +0000
River Tarnell <river@wikimedia.org> wrote:
> this platform doesn't provide strtoul(), and zsh has no compat.c
> replacement.  the patch (attached) provides one from NetBSD sources
> (which i believe has a liberal enough license to be included in zsh).

Right, and you've even included the licence, so I've committed it as it is.
Thanks.

> there are two remaining problems, but i have no idea where to start
> on either of them:
> 
>  + unless compiled with --disable-dynamic, any attempt to use
>    completion-related features crashes the shell with 'Undefined
>    symbol: _incompfunc'

I think the answer here is probably --disable-dynamic.  It's going back a
while, but I have a suspicion dynamic linking has always been problematic
on SunOS 4.  It might be fixable if anyone thought it worth while and had
the time and facilities.

For the specific problem, on some older systems an underscore needed to be
added by hand to entry points when fetching them with dlsym().  It looks
like this is some variant of that problem (although dlsym() isn't directly
involved).  Again, it's going back a bit and I'm not sure how this was
supposed to pan out.

>  + job control doesn't work properly.  while typing ^Z in 'vi'
>    works fine, in 'vim', the program immediately resumes, rather
>    than returning to the shell.  both work fine with the system
>    'csh'.

Job control definitely worked once on 4.1.x because I used to use it all
the time about 15(!) years ago, although I think that was in the age before
vim.  It's likely to need some poking around with a suitable system, unless
it awakes some memory of Bart's.

It might be worth trying "ttyctl -f" before calling vim the first time in
case it's monkeying with terminal settings.  I don't hold out much hope,
but it's at least a very quick test.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 4.3.5 build fails on SunOS 4.1.4
  2008-03-03 12:36 ` Peter Stephenson
@ 2008-03-03 17:31   ` Vin Shelton
  0 siblings, 0 replies; 3+ messages in thread
From: Vin Shelton @ 2008-03-03 17:31 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: River Tarnell, Zsh Hackers' List

On Mon, Mar 3, 2008 at 7:36 AM, Peter Stephenson <pws@csr.com> wrote:
> On Mon, 3 Mar 2008 04:58:15 +0000
>  River Tarnell <river@wikimedia.org> wrote:
>  >  + unless compiled with --disable-dynamic, any attempt to use
>  >    completion-related features crashes the shell with 'Undefined
>  >    symbol: _incompfunc'
>
>  I think the answer here is probably --disable-dynamic.  It's going back a
>  while, but I have a suspicion dynamic linking has always been problematic
>  on SunOS 4.  It might be fixable if anyone thought it worth while and had
>  the time and facilities.
>
>  For the specific problem, on some older systems an underscore needed to be
>  added by hand to entry points when fetching them with dlsym().  It looks
>  like this is some variant of that problem (although dlsym() isn't directly
>  involved).  Again, it's going back a bit and I'm not sure how this was
>  supposed to pan out.

Peter et al -

As you wrote, this is going back some ways (it's been *at least* 3
years since I built on a SunOS 4 platform) - I had to
--disable-dynamic in order to build a working zsh on SunOS4.  I recall
investigating further, but I never got the build to the point where
building with dynamic linking worked, IIRC.

  - Vin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-03 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03  4:58 [PATCH] 4.3.5 build fails on SunOS 4.1.4 River Tarnell
2008-03-03 12:36 ` Peter Stephenson
2008-03-03 17:31   ` Vin Shelton

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).