Bug 208098 - shells/ksh93: a() { b } makes ksh93 dump core.
Summary: shells/ksh93: a() { b } makes ksh93 dump core.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Cy Schubert
URL:
Keywords: crash, needs-patch
Depends on: 211164
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-17 19:44 UTC by Robert Clausecker
Modified: 2019-04-21 17:30 UTC (History)
4 users (show)

See Also:
cy: maintainer-feedback? (saper)


Attachments
Update ksh93 to 2014-12-24 (or rather 2016-01-10 beta) (55.61 KB, patch)
2019-02-25 09:52 UTC, Marcin Cieślak
saper: maintainer-approval+
Details | Diff
Update ksh93 to 2014-12-24 (or rather 2016-01-10 beta) from GitHub (51.80 KB, patch)
2019-03-13 00:13 UTC, Marcin Cieślak
saper: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Clausecker freebsd_committer freebsd_triage 2016-03-17 19:44:08 UTC
Recently I wrote a shell script, made a syntax error and watched ksh93 dump core. To reproduce, create a file with the following content

    a() { b }

then try to run this as a ksh93 shell script. The result looks like this:

    $ ksh93 ksh_crash.sh
    ksh_crash.sh: syntax error at line 2: `{' unmatched
    Memory fault(coredump)

This is the version reported by ksh93:

    $ echo $KSH_VERSION
    Version AJM 93u+ 2012-08-01
Comment 1 Marcin Cieślak 2016-07-16 23:33:17 UTC
I believe this is no longer occuring with 93v- 2014-12-24
Comment 2 Marcin Cieślak 2017-01-23 01:28:26 UTC
Hello,

the patches are attached to the ksh93 port update at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211164
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-01-16 09:54:24 UTC
Is this still relevant?
Comment 4 Robert Clausecker freebsd_committer freebsd_triage 2018-01-16 22:51:31 UTC
The problem still occurs with ksh93 from pkg and with ksh93 built from ports, so it's still open.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2019-02-20 19:56:04 UTC
cy: can you have a look ? or merge ksh93 and -devel ?
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2019-02-20 20:58:19 UTC
This has been fixed in ksh93-devel.

slippy$ ksh93 ksh_crash.sh
ksh_crash.sh: syntax error at line 2: `{' unmatched
slippy$ 

We could update to 93v. The tag is there but we will need to fetch from github instead of http://www2.research.att.com/~astopen/download/tgz/.

The tags we can use are:
slippy$ git tag
2017.0.0-devel
93u
93v
ksh93u
ksh93v
slippy$ 

Perusing through the repo, looks like 93v and ksh93v are the same.

Repocopying shells/ksh93 with -devel isn't as straight forward as it appears. ksh93-devel uses meson and ninja whereas ksh93v does not. Suggest we use PR/211164 except fetch the file from github rather than some random file hosting site. Unless packaged by the author and mirrored, there are fewer exposures through github rather than rolled by someone else or rolled by the port maintainer.

Let's reopen PR/211164 and update the Makefile to use github instead. You won't need INIT either.
Comment 7 Cy Schubert freebsd_committer freebsd_triage 2019-02-21 06:39:26 UTC
I've reopened 211164 and have updated the patch to fetch from att/ast on GH.
Comment 8 Cy Schubert freebsd_committer freebsd_triage 2019-02-21 07:16:32 UTC
Let's move the discussion to 211164.
Comment 9 Cy Schubert freebsd_committer freebsd_triage 2019-02-24 07:28:43 UTC
The patch in PR/211164 doesn't work with 93v from att/ast and I've spent too much time on it already. Suggest we either:

a) Delete shells/ksh93 and use shells/ksh93-devel instead, or
b) Live with the brokenness until att/ast tags a new tag from which to update shell/ksh93.
c) svn copy ksh93-devel at some point and leave it. (What would the point of ksh93 be then?)


I can't spend any more time on this as there is more important FreeBSD work that needs to get done first.

pi@, do you want to take this PR back? Do we want to simply close this PR instead?
Comment 10 Kurt Jaeger freebsd_committer freebsd_triage 2019-02-24 11:47:58 UTC
(In reply to Cy Schubert from comment #9)
What could I do to fix it ? The update-PR 211164 is closed/rejected by the maintainer, so what can be done ? I'm in no position to find a patch for the non-devel ksh93 to fix the bug.

> Do we want to simply close this PR instead?

The bug raised in 208098 is a valid bug.
     
In general, I think both versions should be merged to fix the bug.

But if both maintainers disagree on that, there's no sensible way forward.
Comment 11 Cy Schubert freebsd_committer freebsd_triage 2019-02-24 18:07:49 UTC
Let's deprecate/delete shells/ksh93 and use ksh93-devel instead.

diff --git a/shells/ksh93/Makefile b/shells/ksh93/Makefile
index 5535114ff480..d24b6e148c97 100644
--- a/shells/ksh93/Makefile
+++ b/shells/ksh93/Makefile
@@ -23,6 +23,8 @@ MAINTAINER=   saper@saper.info
 COMMENT=       Official AT&T release of KornShell 93
 
 LICENSE=       EPL
+DEPRECATED=  Contains many bugs, unmaintainable, superceeded by ksh93-devel
+EXPIRATION_DATE=     2019-03-31
 
 CONFLICTS=     ksh93-devel-*
Comment 12 Cy Schubert freebsd_committer freebsd_triage 2019-02-24 18:10:09 UTC
Requested maintainer approval to deprecate and delete shells/ksh93.
Comment 13 Cy Schubert freebsd_committer freebsd_triage 2019-02-24 18:24:01 UTC
See https://reviews.freebsd.org/D19331.
Comment 14 Marcin Cieślak 2019-02-25 01:28:45 UTC
Hello, I have a working set of patches based on the GitHub ksh93v release:

> echo $KSH_VERSION
Version ABIJM 93v- 2014-12-24

This pulls off last AT&T release from https://github.com/att/ast/archive/ksh93v.tar.gz and applies patches.

I need to test it on newer FreeBSD versions and I'll post it here.
Comment 15 Cy Schubert freebsd_committer freebsd_triage 2019-02-25 01:41:02 UTC
Excellent!
Comment 16 Marcin Cieślak 2019-02-25 09:52:16 UTC
Created attachment 202345 [details]
Update ksh93 to 2014-12-24 (or rather 2016-01-10 beta)

Work in progress:

Here is my first attempt to fix the problem. I still need to decide which date should be assigned to this release (since it includes library code updated on 2016-10-01).

Since this is a stripped down build (not a full AST package), need to bring back tests and also review test results.

Builds fine on 10.x and 11.2. Need to try 12.x and -CURRENT

Feedback welcome!
Comment 17 Marcin Cieślak 2019-02-25 11:51:23 UTC
 the patch submitted also as https://reviews.freebsd.org/D19343
Comment 18 Cy Schubert freebsd_committer freebsd_triage 2019-03-11 19:38:08 UTC
I'm still of the opinion that we deprecate and delete shells/ksh93. ksh93-devel addresses this bug and many more. We can consider resurrecting ksh93 after att/ast create a new release.

Should I submit a review for deprecation, expiry and deletion?
Comment 19 Marcin Cieślak 2019-03-13 00:13:07 UTC
Created attachment 202831 [details]
Update ksh93 to 2014-12-24 (or rather 2016-01-10 beta) from GitHub

Now using arcanist to create the patch
Comment 20 Marcin Cieślak 2019-03-13 00:14:09 UTC
Comment on attachment 202345 [details]
Update ksh93 to 2014-12-24 (or rather 2016-01-10 beta)

>diff -ruN /usr/ports/shells/ksh93/distinfo ./distinfo
>--- /usr/ports/shells/ksh93/distinfo	2013-08-09 21:01:58.000000000 +0200
>+++ ./distinfo	2019-02-25 09:07:46.017130000 +0100
>@@ -1,4 +1,3 @@
>-SHA256 (ksh93/INIT.2013-05-24.tgz) = 118b2c8a4d651727fcd680289be69941d3045951bf9e3a4d45dcb42f0658f014
>-SIZE (ksh93/INIT.2013-05-24.tgz) = 383979
>-SHA256 (ksh93/ast-ksh.2012-08-01.tgz) = e6192cfa52a6a9fd20618cbaf3fa81f0cc9fd83525500757e83017275e962851
>-SIZE (ksh93/ast-ksh.2012-08-01.tgz) = 2053532
>+TIMESTAMP = 1551054883
>+SHA256 (ksh93/ksh93v.tar.gz) = 89e5aeec66c28692aa392105552c06053ba60b09a62e94dc555dadf967bca643
>+SIZE (ksh93/ksh93v.tar.gz) = 26409086
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_cmd_INIT_iffe.sh ./files/patch-src_cmd_INIT_iffe.sh
>--- /usr/ports/shells/ksh93/files/patch-src_cmd_INIT_iffe.sh	2017-02-09 21:26:22.000000000 +0100
>+++ ./files/patch-src_cmd_INIT_iffe.sh	1970-01-01 01:00:00.000000000 +0100
>@@ -1,20 +0,0 @@
>---- src/cmd/INIT/iffe.sh.orig	2013-03-06 16:33:17 UTC
>-+++ src/cmd/INIT/iffe.sh
>-@@ -3414,7 +3414,7 @@ $src
>- 						(eval "$src") <&$nullin || e=1
>- 						;;
>- 					mac*|nomac*)
>--						if	compile $cc -E $tmp.c <&$nullin >$tmp.i
>-+						if	compile $cc -E -P $tmp.c <&$nullin >$tmp.i
>- 						then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i
>- 						else	e=1
>- 						fi
>-@@ -3705,7 +3705,7 @@ $inc
>- <<\"#define $v\">>	$v	<<\"/* native $v */\">>
>- <<\"#endif\">>
>- #endif" > $tmp.c
>--					if	compile $cc -E $tmp.c <&$nullin >$tmp.i
>-+					if	compile $cc -E -P $tmp.c <&$nullin >$tmp.i
>- 					then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i > $tmp.t
>- 						if	test -s $tmp.t
>- 						then	success
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_cmd_proto_proto.c ./files/patch-src_cmd_proto_proto.c
>--- /usr/ports/shells/ksh93/files/patch-src_cmd_proto_proto.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_cmd_proto_proto.c	2019-02-25 09:07:46.017607000 +0100
>@@ -0,0 +1,18 @@
>+--- src/cmd/proto/proto.c.orig	2017-11-30 22:35:04 UTC
>++++ src/cmd/proto/proto.c
>+@@ -396,6 +396,15 @@ proto(char* file, char* license, char* o
>+ 
>+ #if !PROTO_STANDALONE
>+ #undef	error
>++void
>++error( int xit, const char *msg, ... )
>++{
>++	va_list ap;
>++	va_start( ap, msg );
>++	vfprintf( stderr, msg, ap );
>++	va_end( ap );
>++	exit( xit );
>++}
>+ #endif
>+ 
>+ typedef struct Sufcom_s
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_cmd_std_features_procfs ./files/patch-src_cmd_std_features_procfs
>--- /usr/ports/shells/ksh93/files/patch-src_cmd_std_features_procfs	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_cmd_std_features_procfs	2019-02-25 09:07:46.017964000 +0100
>@@ -0,0 +1,36 @@
>+--- src/cmd/std/features/procfs.orig	2017-11-30 22:35:04 UTC
>++++ src/cmd/std/features/procfs
>+@@ -1,6 +1,6 @@
>+ hdr	kvm,procinfo,pstat,asm/param
>+ 
>+-sys	procfs,sysctl
>++sys	procfs,sysctl,user
>+ 
>+ lib	getprocs
>+ lib	kvm_open,kvm_getprocs kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm
>+@@ -10,7 +10,11 @@ mem	extern_proc.p_pid,extern_proc.p_star
>+ mem	procsinfo64.pi_pri procinfo.h
>+ mem	prpsinfo.pr_clname,prpsinfo.pr_cstime,prpsinfo.pr_cstime.tv_sec,prpsinfo.pr_ctime,prpsinfo.pr_cutime,prpsinfo.pr_gid,prpsinfo.pr_lttydev,prpsinfo.pr_ntpid,prpsinfo.pr_pgid,prpsinfo.pr_pgrp,prpsinfo.pr_psargs,prpsinfo.pr_refcount,prpsinfo.pr_rssize,prpsinfo.pr_sid,prpsinfo.pr_sonproc,prpsinfo.pr_start,prpsinfo.pr_start.tv_sec,prpsinfo.pr_starttime,prpsinfo.pr_starttime.tv_sec,prpsinfo.pr_state,prpsinfo.pr_stime,prpsinfo.pr_tgrp,prpsinfo.pr_time,prpsinfo.pr_time.tv_sec,prpsinfo.pr_utime,prpsinfo.pr_zomb,prpsinfo.pr_pctcpu,prpsinfo.pr_cpu,prpsinfo.pr_lwp.pr_pctcpu,prpsinfo.pr_lwp.pr_cpu -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
>+ 
>++num	PIOCPSINFO
>++
>+ typ	struct.prpsinfo -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
>++typ	struct.kinfo_proc sys/types.h sys/procfs.h sys/user.h
>++typ	struct.kp_proc sys/types.h sys/procfs.h sys/user.h
>+ 
>+ tst	lib_info note{ info(2) kernel table api }end link{
>+ 	#include <info.h>
>+@@ -587,11 +591,11 @@ cat{
>+ #define PSS_METHOD		PSS_METHOD_getprocs
>+ #endif
>+ 
>+-#if !PSS_METHOD && defined(_PS_dir)
>++#if !PSS_METHOD && defined(_PS_dir) && (_PS_scan_binary || _num_PIOCPSINFO)
>+ #define PSS_METHOD		PSS_METHOD_procfs
>+ #endif
>+ 
>+-#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs
>++#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs && _typ_struct_kinfo_proc && _typ_struct_kp_proc
>+ #define PSS_METHOD		PSS_METHOD_kvm
>+ #endif
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_cmd_std_pss-kvm.c ./files/patch-src_cmd_std_pss-kvm.c
>--- /usr/ports/shells/ksh93/files/patch-src_cmd_std_pss-kvm.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_cmd_std_pss-kvm.c	2019-02-25 09:07:46.018260000 +0100
>@@ -0,0 +1,12 @@
>+--- src/cmd/std/pss-kvm.c.orig	2017-11-30 22:35:04 UTC
>++++ src/cmd/std/pss-kvm.c
>+@@ -43,6 +43,9 @@ NoN(pss_kvm)
>+ #if _sys_proc
>+ #include <sys/proc.h>
>+ #endif
>++#if _sys_user
>++#include <sys/user.h>
>++#endif
>+ #include <sys/sysctl.h>
>+ #include <sys/tty.h>
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_comp_setlocale.c ./files/patch-src_lib_libast_comp_setlocale.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_comp_setlocale.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_comp_setlocale.c	2019-02-25 09:07:46.018555000 +0100
>@@ -0,0 +1,10 @@
>+--- src/lib/libast/comp/setlocale.c.orig	2017-11-30 22:35:04 UTC
>++++ src/lib/libast/comp/setlocale.c
>+@@ -38,6 +38,7 @@
>+ #include <namval.h>
>+ #include <iconv.h>
>+ #include <codeset.h>
>++#include <errno.h>
>+ 
>+ #if ( _lib_wcwidth || _lib_wctomb ) && _hdr_wctype
>+ #include <wctype.h>
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_mmap ./files/patch-src_lib_libast_features_mmap
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_mmap	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_features_mmap	2019-02-25 09:07:46.018937000 +0100
>@@ -0,0 +1,191 @@
>+--- src/lib/libast/features/mmap.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/features/mmap
>+@@ -16,14 +16,7 @@ tst	lib_mmap note{ standard mmap interfa
>+ 
>+ 	#define Failed(file)	(remove(file),1)
>+ 
>+-	int
>+-	#if _STD_
>+-	main(int argc, char** argv)
>+-	#else
>+-	main(argc,argv)
>+-	int     argc;
>+-	char**  argv;
>+-	#endif
>++	int main(int argc, char** argv)
>+ 	{
>+ 		caddr_t		mm;
>+ 		char		*file;
>+@@ -165,169 +158,18 @@ tst	lib_mmap64 -D_LARGEFILE64_SOURCE not
>+ 	}
>+ }end
>+ 
>+-tst	mmap_anon note{ use mmap MAP_ANON to get raw memory }end execute{
>+-	#if !_lib_mmap
>+-	(
>+-	#endif
>+-	#include <unistd.h>
>+-	#include <fcntl.h>
>+-	#include <sys/types.h>
>+-	#include <sys/mman.h>
>+-	#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
>+-	#define MAP_ANON	MAP_ANONYMOUS
>+-	#endif
>+-	int
>+-	main()
>+-	{	void	*addr;
>+-		addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0);
>+-		return (addr && addr != (void*)(-1)) ? 0 : 1;
>+-	}
>+-}end
>+-
>+-tst	mmap_devzero note{ use mmap on /dev/zero to get raw memory }end execute{
>+-	#if !_lib_mmap
>+-	(
>+-	#endif
>+-	#include <unistd.h>
>+-	#include <fcntl.h>
>+-	#include <sys/types.h>
>+-	#include <sys/mman.h>
>+-	int
>+-	main()
>+-	{	int	fd;
>+-		void	*addr;
>+-		if((fd = open("/dev/zero", O_RDWR)) < 0)
>+-			return 1;
>+-		addr = mmap(0,1024*1024,PROT_READ|PROT_WRITE,MAP_PRIVATE,fd,0);
>+-		return (addr && addr != (void*)(-1)) ? 0 : 1;
>+-	}
>+-}end
>+-
>+-tst	-D_LARGEFILE64_SOURCE note{ mmap is worth using }end output{
>+-	#if !_lib_mmap
>+-	(
>+-	#endif
>+-	#include <unistd.h>
>+-	#include <fcntl.h>
>+-	#include <string.h>
>+-	#include <sys/types.h>
>+-	#include <sys/mman.h>
>+-	#include <sys/stat.h>
>+-	#include <sys/times.h>
>+-
>+-	#if _lib_mmap64
>+-	#undef	mmap
>+-	#define mmap	mmap64
>+-	#endif
>+-
>+-	#if _lib_munmap64
>+-	#undef	munmap
>+-	#define munmap	munmap64
>+-	#endif
>+-	
>+-	#define MAPSIZE (64*1024)
>+-	#define BUFSIZE	(MAPSIZE/8)
>+-	#define WRITE   (64)
>+-	#define RUN	(64)
>+-	
>+-	#define Failed(file)	(remove(file),1)
>+-	
>+-	int
>+-	#if _STD_
>+-	main(int argc, char** argv)
>+-	#else
>+-	main(argc,argv)
>+-	int     argc;
>+-	char**  argv;
>+-	#endif
>+-	{
>+-		caddr_t		mm;
>+-		char		*file, *t;
>+-		int		i, fd, k, run;
>+-		char		buf[MAPSIZE];
>+-		struct tms	stm, etm;
>+-		clock_t		rdtm, mmtm;
>+-	
>+-		file = argv[1];
>+-		if ((fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0)
>+-			return 1;
>+-	
>+-		for (i = 0; i < sizeof(buf); ++i)
>+-			buf[i] = '0' + (i%10);
>+-		for (i = 0; i < WRITE; ++i)
>+-			if (write(fd,buf,sizeof(buf)) != sizeof(buf))
>+-				return Failed(file);
>+-		close(fd);
>+-	
>+-		/* read time */
>+-		times(&stm);
>+-		for(run = 0; run < RUN; ++run)
>+-		{	if((fd = open(file, O_RDWR)) < 0)
>+-				return Failed(file);
>+-			for (i = 0; i < WRITE; ++i)
>+-			{	for(k = 0; k < MAPSIZE; k += BUFSIZE)
>+-					if (read(fd,buf,BUFSIZE) != BUFSIZE)
>+-						return Failed(file);
>+-			}
>+-			close(fd);
>+-		}
>+-		times(&etm);
>+-		rdtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime);
>+-	
>+-		/* mmap time */
>+-		times(&stm);
>+-		for(run = 0; run < RUN; ++run)
>+-		{	if ((fd = open(file, O_RDWR)) < 0)
>+-				return Failed(file);
>+-			for(i = 0, mm = (caddr_t)0; i < WRITE; ++i)
>+-			{	if(mm)
>+-					munmap(mm, MAPSIZE);
>+-				mm = (caddr_t)mmap((caddr_t)0, MAPSIZE,
>+-						   (PROT_READ|PROT_WRITE),
>+-						   MAP_PRIVATE, fd, i*MAPSIZE );
>+-				if(mm == (caddr_t)(-1) || mm == (caddr_t)0)
>+-					return Failed(file);
>+-	
>+-				/* the memcpy is < BUFSIZE to simulate the
>+-				   fact that functions like sfreserve/sfgetr do
>+-				   not do buffer copying.
>+-				*/
>+-				t = (char*)mm;
>+-				for(k = 0; k < MAPSIZE; k += BUFSIZE, t += BUFSIZE)
>+-					memcpy(buf,t,(3*BUFSIZE)/4);
>+-			}
>+-			close(fd);
>+-		}
>+-		times(&etm);
>+-		mmtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime);
>+-
>+-		remove(file);
>+-	
>+-		if(4*mmtm <= 3*rdtm)
>+-			printf("#define _mmap_worthy	2	/* mmap outperforms read on 64Ki buffers -- use it */\n");
>+-		else if(4*mmtm <= 5*rdtm)
>+-			printf("#define _mmap_worthy	2	/* mmap is slightly better than read on 64Ki buffers -- use it */\n");
>+-		else
>+-			printf("#define _mmap_worthy	2	/* mmap worse than read on 64Ki buffers -- use it anyway */\n");
>+-
>+-		return 0;
>+-	}
>+-}end
>+-
>+ cat{
>++        /* assume MAP_ANON works */
>++        #define _mmap_anon 1
>+ 
>+ 	/* some systems get it wrong but escape concise detection */
>+-	#ifndef _NO_MMAP
>+ 	#if __CYGWIN__
>+ 	#define _NO_MMAP	1
>+ 	#endif
>+-	#endif
>+ 
>+ 	#if _NO_MMAP
>+ 	#undef	_lib_mmap
>+ 	#undef	_lib_mmap64
>+-	#undef	_mmap_anon
>+-	#undef	_mmap_devzero
>+-	#undef	_mmap_worthy
>++	#undef  _mmap_anon
>+ 	#endif
>+ }end
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_standards ./files/patch-src_lib_libast_features_standards
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_standards	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_features_standards	2019-02-25 09:07:46.019260000 +0100
>@@ -0,0 +1,23 @@
>+--- src/lib/libast/features/standards.orig	2017-11-30 22:35:04 UTC
>++++ src/lib/libast/features/standards
>+@@ -1,5 +1,19 @@
>+ set stdio
>+-if tst note{ _GNU_SOURCE works }end compile{
>++# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit*
>++# functionality to known API; they don't enable anything. The general intent in
>++# BSD is to enable everything by default (effectively, providing the
>++# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay
>++# careful that we don't get fooled by presence of FreeBSD that underpins some
>++# subsystems in Mac OS X; there are other Apple-specific portability hacks
>++# elsewhere we should not interfere with.
>++if tst note{ FreeBSD }end compile{
>++		#include <sys/param.h>
>++		#if !defined(__FreeBSD__) || defined(APPLE)
>++		#error not a FreeBSD system
>++		#endif
>++	}end {
>++	}
>++elif tst note{ _GNU_SOURCE works }end compile{
>+ 		#define _GNU_SOURCE 1
>+ 		#include <sys/types.h>
>+ 		#include <sys/stat.h>
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_vmalloc ./files/patch-src_lib_libast_features_vmalloc
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_vmalloc	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_features_vmalloc	2019-02-25 09:07:46.019540000 +0100
>@@ -0,0 +1,10 @@
>+--- src/lib/libast/features/vmalloc.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/features/vmalloc
>+@@ -217,7 +217,4 @@ cat{
>+ 	#if _mmap_anon
>+ 	#define _mem_mmap_anon	1
>+ 	#endif
>+-	#if _mmap_devzero
>+-	#define _mem_mmap_zero	1
>+-	#endif
>+ }end
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_wchar ./files/patch-src_lib_libast_features_wchar
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_features_wchar	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_features_wchar	2019-02-25 09:07:46.019884000 +0100
>@@ -0,0 +1,10 @@
>+--- src/lib/libast/features/wchar.orig	2017-11-30 22:35:04 UTC
>++++ src/lib/libast/features/wchar
>+@@ -6,6 +6,7 @@ set	include .
>+ cat{
>+ 	#ifndef _AST_WCHAR_H
>+ 	#define _AST_WCHAR_H	1
>++	#define _STDFILE_DECLARED
>+ }end
>+ 
>+ lib	mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_port_astcopy.c ./files/patch-src_lib_libast_port_astcopy.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_port_astcopy.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_port_astcopy.c	2019-02-25 09:07:46.020170000 +0100
>@@ -0,0 +1,17 @@
>+--- src/lib/libast/port/astcopy.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/port/astcopy.c
>+@@ -30,14 +30,10 @@
>+ #include <ast.h>
>+ #include <ast_mmap.h>
>+ 
>+-#if _mmap_worthy > 1
>+-
>+ #include <ls.h>
>+ 
>+ #define MAPSIZE		(1024*256)
>+ 
>+-#endif
>+-
>+ #undef	BUFSIZ
>+ #define BUFSIZ		4096
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfclose.c ./files/patch-src_lib_libast_sfio_sfclose.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfclose.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfclose.c	2019-02-25 09:07:46.020465000 +0100
>@@ -0,0 +1,14 @@
>+--- src/lib/libast/sfio/sfclose.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfclose.c
>+@@ -104,11 +104,9 @@ Sfio_t*	f;
>+ 
>+ 	if(f->data && (!local || (f->flags&SF_STRING) || (f->bits&SF_MMAP) ) )
>+ 	{	/* free buffer */
>+-#if _mmap_worthy
>+ 		if(f->bits&SF_MMAP)
>+ 			SFMUNMAP(f,f->data,f->endb-f->data);
>+ 		else
>+-#endif
>+ 		if(f->flags&SF_MALLOC)
>+ 			data = (Void_t*)f->data;
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfhdr.h ./files/patch-src_lib_libast_sfio_sfhdr.h
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfhdr.h	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfhdr.h	2019-02-25 09:07:46.020760000 +0100
>@@ -0,0 +1,12 @@
>+--- src/lib/libast/sfio/sfhdr.h.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfhdr.h
>+@@ -209,9 +209,6 @@
>+ 
>+ /* see if we can use memory mapping for io */
>+ #if _LARGEFILE64_SOURCE && !_lib_mmap64
>+-#undef _mmap_worthy
>+-#endif
>+-#if !_mmap_worthy
>+ #undef _hdr_mman
>+ #undef _sys_mman
>+ #endif
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfmode.c ./files/patch-src_lib_libast_sfio_sfmode.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfmode.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfmode.c	2019-02-25 09:07:46.021080000 +0100
>@@ -0,0 +1,45 @@
>+--- src/lib/libast/sfio/sfmode.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfmode.c
>+@@ -404,7 +404,6 @@ reg int		local;	/* a local call */
>+ 
>+ 	if(f->mode&SF_GETR)
>+ 	{	f->mode &= ~SF_GETR;
>+-#if _mmap_worthy
>+ 		if(f->bits&SF_MMAP)
>+ 		{
>+ 			if (!++f->ngetr)
>+@@ -415,7 +414,6 @@ reg int		local;	/* a local call */
>+ 				f->ngetr = f->tiny[0] = 0;
>+ 			}
>+ 		}
>+-#endif
>+ 		if(f->getr)
>+ 		{	f->next[-1] = f->getr;
>+ 			f->getr = 0;
>+@@ -519,12 +517,10 @@ reg int		local;	/* a local call */
>+ 			if((f->flags&(SF_SHARE|SF_PUBLIC)) == (SF_SHARE|SF_PUBLIC) &&
>+ 			   (addr = SFSK(f,0,SEEK_CUR,f->disc)) != f->here)
>+ 			{
>+-#if _mmap_worthy
>+ 				if((f->bits&SF_MMAP) && f->data)
>+ 				{	SFMUNMAP(f,f->data,f->endb-f->data);
>+ 					f->data = NIL(uchar*);
>+ 				}
>+-#endif
>+ 				f->endb = f->endr = f->endw = f->next = f->data;
>+ 				f->here = addr;
>+ 			}
>+@@ -567,13 +563,11 @@ reg int		local;	/* a local call */
>+ 		}
>+ 
>+ 		f->mode = SF_WRITE|SF_LOCK;
>+-#if _mmap_worthy
>+ 		if(f->bits&SF_MMAP)
>+ 		{	if(f->data)
>+ 				SFMUNMAP(f,f->data,f->endb-f->data);
>+ 			(void)SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
>+ 		}
>+-#endif
>+ 		if(f->data == f->tiny)
>+ 		{	f->endb = f->data = f->next = NIL(uchar*);
>+ 			f->size = 0;
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfpurge.c ./files/patch-src_lib_libast_sfio_sfpurge.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfpurge.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfpurge.c	2019-02-25 09:07:46.021368000 +0100
>@@ -0,0 +1,18 @@
>+--- src/lib/libast/sfio/sfpurge.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfpurge.c
>+@@ -54,7 +54,6 @@ Sfio_t*	f;
>+ 	SFLOCK(f,0);
>+ 
>+ 	/* if memory map must be a read stream, pretend data is gone */
>+-#if _mmap_worthy
>+ 	if(f->bits&SF_MMAP)
>+ 	{	f->here -= f->endb - f->next;
>+ 		if(f->data)
>+@@ -64,7 +63,6 @@ Sfio_t*	f;
>+ 		SFOPEN(f,0);
>+ 		SFMTXRETURN(f, 0);
>+ 	}
>+-#endif
>+ 
>+ 	switch(f->mode&~SF_LOCK)
>+ 	{
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfrd.c ./files/patch-src_lib_libast_sfio_sfrd.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfrd.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfrd.c	2019-02-25 09:07:46.021661000 +0100
>@@ -0,0 +1,31 @@
>+--- src/lib/libast/sfio/sfrd.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfrd.c
>+@@ -92,12 +92,10 @@ Sfdisc_t*	disc;
>+ 			{	f->endb = f->next = f->endr = f->data;
>+ 				f->mode &= ~SF_SYNCED;
>+ 			}
>+-#if _mmap_worthy
>+ 			if((f->bits&SF_MMAP) && f->data)
>+ 			{	SFMUNMAP(f, f->data, f->endb-f->data);
>+ 				f->data = NIL(uchar*);
>+ 			}
>+-#endif
>+ 			f->next = f->endb = f->endr = f->endw = f->data;
>+ 		}
>+ 	}
>+@@ -132,7 +130,6 @@ Sfdisc_t*	disc;
>+ 			}
>+ 		}
>+ 
>+-#if _mmap_worthy
>+ 		if(f->bits&SF_MMAP)
>+ 		{	reg ssize_t	a, round;
>+ 			sfstat_t	st;
>+@@ -230,7 +227,6 @@ Sfdisc_t*	disc;
>+ 				}
>+ 			}
>+ 		}
>+-#endif
>+ 
>+ 		/* sync unseekable write streams to prevent deadlock */
>+ 		if(!dosync && f->extent < 0)
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfseek.c ./files/patch-src_lib_libast_sfio_sfseek.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfseek.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfseek.c	2019-02-25 09:07:46.021985000 +0100
>@@ -0,0 +1,43 @@
>+--- src/lib/libast/sfio/sfseek.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfseek.c
>+@@ -34,12 +34,10 @@ Sfio_t*	f;
>+ Sfoff_t p;
>+ #endif
>+ {
>+-#if _mmap_worthy
>+ 	if((f->bits&SF_MMAP) && f->data)
>+ 	{	SFMUNMAP(f, f->data, f->endb-f->data);
>+ 		f->data = NIL(uchar*);
>+ 	}
>+-#endif
>+ 	f->next = f->endr = f->endw = f->data;
>+ 	f->endb = (f->mode&SF_WRITE) ? f->data+f->size : f->data;
>+ 	if((f->here = p) < 0)
>+@@ -201,23 +199,13 @@ int	type;	/* 0: from org, 1: from here, 
>+ 	if((p += type == SEEK_CUR ? s : 0) < 0)
>+ 		goto done;
>+ 
>+-#if _mmap_worthy
>+ 	if(f->bits&SF_MMAP)
>+ 	{	/* if mmap is not great, stop mmaping if moving around too much */
>+-#if _mmap_worthy < 2
>+-		if((f->next - f->data) < ((f->endb - f->data)/4) )
>+-		{	SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
>+-			hardseek = 1; /* this forces a hard seek below */
>+-		}
>+-		else
>+-#endif
>+-		{	/* for mmap, f->here can be virtual except for hardseek */
>+-			newpos(f,p);
>+-			if(!hardseek)
>+-				goto done;
>+-		}
>++		/* for mmap, f->here can be virtual except for hardseek */
>++		newpos(f,p);
>++		if(!hardseek)
>++			goto done;
>+ 	}
>+-#endif
>+ 
>+ 	if(f->endb > f->next)
>+ 	{	/* reduce wastage in future buffer fillings */
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetbuf.c ./files/patch-src_lib_libast_sfio_sfsetbuf.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetbuf.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfsetbuf.c	2019-02-25 09:07:46.022312000 +0100
>@@ -0,0 +1,34 @@
>+--- src/lib/libast/sfio/sfsetbuf.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfsetbuf.c
>+@@ -302,7 +302,6 @@ size_t	size;	/* buffer size, -1 for defa
>+ 	okmmap = (buf || (f->flags&SF_STRING) || (f->flags&SF_RDWR) == SF_RDWR) ? 0 : 1;
>+ 
>+ 	/* save old buffer info */
>+-#if _mmap_worthy
>+ 	if(f->bits&SF_MMAP)
>+ 	{	if(f->data)
>+ 		{	if(f->getr && (f->mode&SF_GETR) && f->next)
>+@@ -311,7 +310,6 @@ size_t	size;	/* buffer size, -1 for defa
>+ 			f->data = NIL(uchar*);
>+ 		}
>+ 	} else
>+-#endif
>+ 	if(f->data == f->tiny)
>+ 	{	f->data = NIL(uchar*);
>+ 		f->size = 0;
>+@@ -438,7 +436,6 @@ size_t	size;	/* buffer size, -1 for defa
>+ 		}
>+ 	}
>+ 
>+-#if _mmap_worthy
>+ 	if(okmmap && size && (f->mode&SF_READ) && f->extent >= 0 )
>+ 	{	/* see if we can try memory mapping */
>+ 		if(!disc)
>+@@ -457,7 +454,6 @@ size_t	size;	/* buffer size, -1 for defa
>+ 			}
>+ 		}
>+ 	}
>+-#endif
>+ 
>+ 	/* get buffer space */
>+ setbuf:
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetfd.c ./files/patch-src_lib_libast_sfio_sfsetfd.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetfd.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfsetfd.c	2019-02-25 09:07:46.022673000 +0100
>@@ -0,0 +1,15 @@
>+--- src/lib/libast/sfio/sfsetfd.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfsetfd.c
>+@@ -108,12 +108,10 @@ int	newfd;
>+ 					SFMTXRETURN(f, -1);
>+ 				}
>+ 
>+-#if _mmap_worthy
>+ 				if((f->bits&SF_MMAP) && f->data)
>+ 				{	SFMUNMAP(f,f->data,f->endb-f->data);
>+ 					f->data = NIL(uchar*);
>+ 				}
>+-#endif
>+ 
>+ 				/* make stream appears uninitialized */
>+ 				f->endb = f->endr = f->endw = f->data;
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsize.c ./files/patch-src_lib_libast_sfio_sfsize.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsize.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfsize.c	2019-02-25 09:07:46.022980000 +0100
>@@ -0,0 +1,15 @@
>+--- src/lib/libast/sfio/sfsize.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfsize.c
>+@@ -80,12 +80,10 @@ Sfio_t*	f;
>+ 
>+ 	if(f->here != s && (f->mode&SF_READ) )
>+ 	{	/* buffered data is known to be invalid */
>+-#if _mmap_worthy
>+ 		if((f->bits&SF_MMAP) && f->data)
>+ 		{	SFMUNMAP(f,f->data,f->endb-f->data);
>+ 			f->data = NIL(uchar*);
>+ 		}
>+-#endif
>+ 		f->next = f->endb = f->endr = f->endw = f->data;
>+ 	}
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsk.c ./files/patch-src_lib_libast_sfio_sfsk.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_sfio_sfsk.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_sfio_sfsk.c	2019-02-25 09:07:46.023267000 +0100
>@@ -0,0 +1,15 @@
>+--- src/lib/libast/sfio/sfsk.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/sfio/sfsk.c
>+@@ -49,12 +49,10 @@ Sfdisc_t*	disc;
>+ 			SFMTXRETURN(f, (Sfoff_t)(-1));
>+ 		if(SFSYNC(f) < 0)
>+ 			SFMTXRETURN(f, (Sfoff_t)(-1));
>+-#if _mmap_worthy
>+ 		if(f->mode == SF_READ && (f->bits&SF_MMAP) && f->data)
>+ 		{	SFMUNMAP(f, f->data, f->endb-f->data);
>+ 			f->data = NIL(uchar*);
>+ 		}
>+-#endif
>+ 		f->next = f->endb = f->endr = f->endw = f->data;
>+ 	}
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_string_strexpr.c ./files/patch-src_lib_libast_string_strexpr.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_string_strexpr.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_string_strexpr.c	2019-02-25 09:07:46.023598000 +0100
>@@ -0,0 +1,87 @@
>+--- src/lib/libast/string/strexpr.c.orig	2017-11-30 22:35:04 UTC
>++++ src/lib/libast/string/strexpr.c
>+@@ -44,7 +44,7 @@
>+ #define peekchr(ex)	(*(ex)->nextchr)
>+ #define ungetchr(ex)	((ex)->nextchr--)
>+ 
>+-#define error(ex,msg)	return(seterror(ex,msg))
>++#define err(ex,msg)	return(seterror(ex,msg))
>+ 
>+ typedef struct				/* expression handle		*/
>+ {
>+@@ -87,7 +87,7 @@ expr(register Expr_t* ex, register int p
>+ 	case 0:
>+ 		ungetchr(ex);
>+ 		if (!precedence) return(0);
>+-		error(ex, "more tokens expected");
>++		err(ex, "more tokens expected");
>+ 	case '-':
>+ 		n = -expr(ex, 13);
>+ 		break;
>+@@ -113,17 +113,17 @@ expr(register Expr_t* ex, register int p
>+ 		case 0:
>+ 			goto done;
>+ 		case ')':
>+-			if (!precedence) error(ex, "too many )'s");
>++			if (!precedence) err(ex, "too many )'s");
>+ 			goto done;
>+ 		case '(':
>+ 			n = expr(ex, 1);
>+ 			if (getchr(ex) != ')')
>+ 			{
>+ 				ungetchr(ex);
>+-				error(ex, "closing ) expected");
>++				err(ex, "closing ) expected");
>+ 			}
>+ 		gotoperand:
>+-			if (operand) error(ex, "operator expected");
>++			if (operand) err(ex, "operator expected");
>+ 			operand = 1;
>+ 			continue;
>+ 		case '?':
>+@@ -140,7 +140,7 @@ expr(register Expr_t* ex, register int p
>+ 				if (getchr(ex) != ':')
>+ 				{
>+ 					ungetchr(ex);
>+-					error(ex, ": expected for ? operator");
>++					err(ex, ": expected for ? operator");
>+ 				}
>+ 				if (n)
>+ 				{
>+@@ -189,7 +189,7 @@ expr(register Expr_t* ex, register int p
>+ 			break;
>+ 		case '=':
>+ 		case '!':
>+-			if (peekchr(ex) != '=') error(ex, "operator syntax error");
>++			if (peekchr(ex) != '=') err(ex, "operator syntax error");
>+ 			if (precedence > 7) goto done;
>+ 			getchr(ex);
>+ 			x = expr(ex, 8);
>+@@ -237,7 +237,7 @@ expr(register Expr_t* ex, register int p
>+ 			if (precedence > 11) goto done;
>+ 			x = expr(ex, 12);
>+ 			if (c == '*') n *= x;
>+-			else if (x == 0) error(ex, "divide by zero");
>++			else if (x == 0) err(ex, "divide by zero");
>+ 			else if (c == '/') n /= x;
>+ 			else n %= x;
>+ 			break;
>+@@ -246,15 +246,15 @@ expr(register Expr_t* ex, register int p
>+ 			pos = --ex->nextchr;
>+ 			if (isdigit(c)) n = strton(ex->nextchr, &ex->nextchr, NiL, 0);
>+ 			else if (ex->convert) n = (*ex->convert)(ex->nextchr, &ex->nextchr, ex->handle);
>+-			if (ex->nextchr == pos) error(ex, "syntax error");
>++			if (ex->nextchr == pos) err(ex, "syntax error");
>+ 			goto gotoperand;
>+ 		}
>+ 		if (ex->errmsg) return(0);
>+-		if (!operand) error(ex, "operand expected");
>++		if (!operand) err(ex, "operand expected");
>+ 	}
>+  done:
>+ 	ungetchr(ex);
>+-	if (!operand) error(ex, "operand expected");
>++	if (!operand) err(ex, "operand expected");
>+ 	return(n);
>+ }
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_malloc.c ./files/patch-src_lib_libast_vmalloc_malloc.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_malloc.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_malloc.c	2019-02-25 09:07:46.023917000 +0100
>@@ -0,0 +1,20 @@
>+--- src/lib/libast/vmalloc/malloc.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/malloc.c
>+@@ -906,7 +906,7 @@ union Alloca_u
>+ 	{	char*		addr;
>+ 		Alloca_t*	next;
>+ 	} head;
>+-	char	array[ALIGN];
>++	char	array[MEM_ALIGN];
>+ };
>+ struct Alloca_s
>+ {	union Alloca_u	head;
>+@@ -914,7 +914,7 @@ struct Alloca_s
>+ };
>+ 
>+ extern Void_t* alloca(size_t size)
>+-{	char		array[ALIGN];
>++{	char		array[MEM_ALIGN];
>+ 	char*		file;
>+ 	int		line;
>+ 	Void_t*		func;
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmbest.c ./files/patch-src_lib_libast_vmalloc_vmbest.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmbest.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmbest.c	2019-02-25 09:07:46.024313000 +0100
>@@ -0,0 +1,101 @@
>+--- src/lib/libast/vmalloc/vmbest.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmbest.c
>+@@ -64,19 +64,19 @@ void _STUB_vmbest(){}
>+ #define	PK_ALLOW	128	/* min #packs allowed to be created	*/
>+ 
>+ /* Small requests are rounded to 0%SM_RNDx */
>+-#define SM_RND0	(1*ALIGN)	/* round value:  1*ALIGN  ==   16	*/
>++#define SM_RND0	(1*MEM_ALIGN)	/* round value:  1*MEM_ALIGN  ==   16	*/
>+ #define SM_BIT0	4		/* (1<<SM_BIT0) == SM_RND0		*/
>+ #define SM_CNT0	16	   	/* # caches as rounded by SM_RND0	*/
>+ #define SM_IDX0	0		/* starting cache index of this group	*/
>+ #define SM_MAX0	(SM_CNT0*SM_RND0)
>+ 	
>+-#define SM_RND1	(2*ALIGN)	/* round value:  2*ALIGN  ==   32	*/
>++#define SM_RND1	(2*MEM_ALIGN)	/* round value:  2*MEM_ALIGN  ==   32	*/
>+ #define SM_CNT1	8
>+ #define SM_BIT1	5
>+ #define SM_IDX1	(SM_IDX0+SM_CNT0)
>+ #define SM_MAX1	(SM_MAX0 + SM_CNT1*SM_RND1)
>+ 
>+-#define SM_RND2	(4*ALIGN)	/* round value:  4*ALIGN  ==   64	*/
>++#define SM_RND2	(4*MEM_ALIGN)	/* round value:  4*MEM_ALIGN  ==   64	*/
>+ #define SM_BIT2	6
>+ #define SM_CNT2	8
>+ #define SM_IDX2	(SM_IDX1+SM_CNT1)
>+@@ -167,7 +167,7 @@ static int chktree(Pack_t* pack, Block_t
>+ 	if(_Vmassert & VM_check_reg)
>+ 	{	if(!node) /* the empty tree is always good */
>+ 			return 0;
>+-		/**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%ALIGN) == 0 );
>++		/**/DEBUG_ASSERT(BDSZ(node) >= BODYSIZE && (BDSZ(node)%MEM_ALIGN) == 0 );
>+ 
>+ 		if(SIZE(node) & (BUSY|PFREE)) /* should be BITS-free */
>+ 			{ /**/DEBUG_MESSAGE("Free block corrupted"); /**/DEBUG_ASSERT(0); return -1; }
>+@@ -252,7 +252,7 @@ static int bestfree(Vmalloc_t* vm, Void_
>+ 	if((Vmuchar_t*)data < vm->data->segmin || (Vmuchar_t*)data >= vm->data->segmax)
>+ 		return -1;
>+ 
>+-	blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%ALIGN) == 0 );
>++	blk = BLOCK(data); /**/DEBUG_ASSERT((SIZE(blk)&BUSY) && (BDSZ(blk)%MEM_ALIGN) == 0 );
>+ 	pack = PACK(blk); /**/DEBUG_ASSERT(pack->best == (Vmbest_t*)vm->data);
>+ 	if((sz = SIZE(blk))&SMALL )
>+ 		listp = &pack->small[SMDECODE(sz)].free;
>+@@ -339,7 +339,7 @@ static Block_t* bestpackextend(Vmalloc_t
>+ 
>+ 	/**/DEBUG_ASSERT(!wild || (PACK(wild) == pack && BDSZ(wild) < size && PACKWILD(pack,wild)) );
>+ 	blkz = BDSZ(pack->pblk); /**/DEBUG_ASSERT(blkz >= _Vmpagesize);
>+-	size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%ALIGN == 0);
>++	size += blkz - (wild ? BDSZ(wild) : 0) + EXTRA(pack); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0);
>+ 	if(_Vmassert & VM_debug) debug_printf(2, "%s:%d: PACK(%p) WILD(%p)=%zd BDSZ(%p)=%zd blkz=%zd size=%zu\n", __FILE__, __LINE__, pack, wild, wild ? BDSZ(wild) : 0, pack->pblk, BDSZ(pack->pblk), blkz, size);
>+ 	if(!(pblk = (*_Vmsegalloc)(vm, pack->pblk, size, segtype)) )
>+ 		pblk = pack->pblk;
>+@@ -383,7 +383,7 @@ static Block_t* bestpackextract(Pack_t* 
>+ 
>+ 	l = r = &link;
>+ 	if((root = pack->root) ) do /* top-down splay tree search */
>+-	{	/**/DEBUG_ASSERT((size%ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) );
>++	{	/**/DEBUG_ASSERT((size%MEM_ALIGN) == 0 && !(SIZE(root)&(BUSY|PFREE)) );
>+ 		if(size == (sz = BDSZ(root)) )
>+ 			break;
>+ 		if(size < sz)
>+@@ -508,7 +508,7 @@ static int bestlistreclaim(Vmalloc_t* vm
>+ 			continue;
>+ 
>+ 		/**/DEBUG_ASSERT((SIZE(fp)&(BUSY|MARK)) == (BUSY|MARK) );
>+-		/**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%ALIGN == 0);
>++		/**/DEBUG_ASSERT(BDSZ(fp) >= sizeof(Body_t) && BDSZ(fp)%MEM_ALIGN == 0);
>+ 		SIZE(fp) &= ~BITS; 
>+ 		t = NEXT(fp);
>+ 		SIZE(t) |= PFREE; /**/DEBUG_ASSERT(SIZE(NEXT(fp))&BUSY);
>+@@ -563,7 +563,7 @@ static Block_t* bestpackalloc(Vmalloc_t*
>+ 	ssize_t		sz;
>+ 	Block_t		*tp, *np, *pblk;
>+ 	Vmbest_t	*best = (Vmbest_t*)vm->data;
>+-	/**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%ALIGN == 0);
>++	/**/DEBUG_ASSERT(size >= sizeof(Body_t) && size%MEM_ALIGN == 0);
>+ 
>+ 	if((tp = pack->alloc) ) /* fast allocation from recent memory */
>+ 	{	pack->alloc = NIL(Block_t*);
>+@@ -719,9 +719,9 @@ static Void_t* bestalloc(Vmalloc_t* vm, 
>+ 	asospindecl();
>+ 
>+ 	/**/DEBUG_COUNT(N_alloc);
>+-	/**/DEBUG_ASSERT((ALIGN%(BITS+1)) == 0 );
>+-	/**/DEBUG_ASSERT((sizeof(Head_t)%ALIGN) == 0 );
>+-	/**/DEBUG_ASSERT((sizeof(Body_t)%ALIGN) == 0 );
>++	/**/DEBUG_ASSERT((MEM_ALIGN%(BITS+1)) == 0 );
>++	/**/DEBUG_ASSERT((sizeof(Head_t)%MEM_ALIGN) == 0 );
>++	/**/DEBUG_ASSERT((sizeof(Body_t)%MEM_ALIGN) == 0 );
>+ 	/**/DEBUG_ASSERT(sizeof(Block_t) == (sizeof(Body_t)+sizeof(Head_t)) );
>+ 	/**/DEBUG_ASSERT(chkregion((Vmbest_t*)vm->data, local) >= 0);
>+ 
>+@@ -902,7 +902,7 @@ static Void_t* bestalign(Vmalloc_t* vm, 
>+ 		return NIL(Void_t*);
>+ 
>+ 	algz = LGROUND(size);
>+-	algn = (*_Vmlcm)(align,ALIGN);
>++	algn = (*_Vmlcm)(align,MEM_ALIGN);
>+ 
>+ 	/* non-Vmbest methods may require extra header space */
>+ 	if(METHOD(best) != VM_MTBEST && vm->meth.eventf)
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcshare.c ./files/patch-src_lib_libast_vmalloc_vmdcshare.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcshare.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmdcshare.c	2019-02-25 09:07:46.024614000 +0100
>@@ -0,0 +1,20 @@
>+--- src/lib/libast/vmalloc/vmdcshare.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmdcshare.c
>+@@ -61,7 +61,7 @@ void _STUB_vmdcshare(){}
>+ #define MM_REMOVE	02	/* remove files/segments	*/
>+ 
>+ /* macros to get the data section and size */
>+-#define MMHEAD(name)	ROUND(sizeof(Mmvm_t)+strlen(name), ALIGN)
>++#define MMHEAD(name)	ROUND(sizeof(Mmvm_t)+strlen(name), MEM_ALIGN)
>+ #define MMDATA(mmvm)	((Vmuchar_t*)(mmvm)->base + MMHEAD(mmvm->name))
>+ #define MMSIZE(mmvm)	((mmvm)->size - MMHEAD(mmvm->name))
>+ 
>+@@ -178,7 +178,7 @@ static int mminit(Mmdisc_t* mmdc)
>+ 	/* fixed size region so make it reasonably large */
>+ 	if((size = mmdc->size) < MM_MINSIZE )
>+ 		size =  MM_MINSIZE;
>+-	size += MMHEAD(mmdc->name) + ALIGN;
>++	size += MMHEAD(mmdc->name) + MEM_ALIGN;
>+ 	size  = ROUND(size, _Vmpagesize);
>+ 
>+ 	/* get/create the initial segment of data */
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcsystem.c ./files/patch-src_lib_libast_vmalloc_vmdcsystem.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcsystem.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmdcsystem.c	2019-02-25 09:07:46.025015000 +0100
>@@ -0,0 +1,126 @@
>+--- src/lib/libast/vmalloc/vmdcsystem.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmdcsystem.c
>+@@ -66,18 +66,16 @@ static Vmemory_f	_Vmemoryf = 0;
>+ 
>+ #if _std_malloc
>+ #undef	_mem_mmap_anon
>+-#undef	_mem_mmap_zero
>+ #undef	_mem_sbrk
>+ #undef	_mem_win32
>+ #endif
>+ 
>+ #if _mem_win32
>+ #undef	_mem_mmap_anon
>+-#undef	_mem_mmap_zero
>+ #undef	_mem_sbrk
>+ #endif
>+ 
>+-#if _mem_mmap_anon || _mem_mmap_zero /* may get space using mmap */
>++#if _mem_mmap_anon /* may get space using mmap */
>+ #include		<sys/mman.h>
>+ #ifndef MAP_ANON
>+ #ifdef	MAP_ANONYMOUS
>+@@ -86,7 +84,7 @@ static Vmemory_f	_Vmemoryf = 0;
>+ #define MAP_ANON	0
>+ #endif /*MAP_ANONYMOUS*/
>+ #endif /*MAP_ANON*/
>+-#endif /*_mem_mmap_anon || _mem_mmap_zero*/
>++#endif /*_mem_mmap_anon*/
>+ 
>+ /*
>+  * hint at "transparent huge pages" (=largepages) if
>+@@ -259,73 +257,6 @@ static Void_t* mmapanonmem(Vmalloc_t* vm
>+ }
>+ #endif /* _mem_mmap_anon */
>+ 
>+-#if _mem_mmap_zero /* get space by mmapping from /dev/zero */
>+-#include		<fcntl.h>
>+-#ifndef OPEN_MAX
>+-#define	OPEN_MAX	64
>+-#endif
>+-#define FD_PRIVATE	(3*OPEN_MAX/4)	/* private file descriptor	*/
>+-#define FD_NONE		(-2)		/* no mapping with file desc	*/
>+-
>+-/* this is called after an initial successful call of mmapzeromeminit() */
>+-static Void_t* mmapzeromem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
>+-{
>+-	Memdisc_t*	mmdc = (Memdisc_t*)disc;
>+-	off_t		offset;
>+-
>+-	GETMEMCHK(vm, caddr, csize, nsize, disc);
>+-	if(csize == 0)
>+-	{	nsize = ROUND(nsize, _Vmpagesize);
>+-		offset = asoaddoff(&mmdc->offset, nsize);
>+-		RESTARTMEM(caddr, mmap(NIL(Void_t*), nsize, PROT_READ|PROT_WRITE, MAP_PRIVATE, mmdc->fd, offset));
>+-		ADVISE(vm, caddr, nsize);
>+-		RETURN(vm, caddr, nsize);
>+-	}
>+-	else if(nsize == 0)
>+-	{	Vmuchar_t	*addr = (Vmuchar_t*)sbrk(0);
>+-		if(addr < (Vmuchar_t*)caddr ) /* in sbrk space */
>+-			return NIL(Void_t*);
>+-		(void)munmap(caddr, csize);
>+-		RETURN(vm, caddr, nsize);
>+-	}
>+-	else	return NIL(Void_t*);
>+-}
>+-
>+-/* if this call succeeds then mmapzeromem() is the implementation */
>+-static Void_t* mmapzeromeminit(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
>+-{
>+-	Memdisc_t*	mmdc = (Memdisc_t*)disc;
>+-	int		fd;
>+-
>+-	GETMEMCHK(vm, caddr, csize, nsize, disc);
>+-	if(mmdc->fd != FD_INIT)
>+-		return NIL(Void_t*);
>+-	RESTARTSYS(fd, open("/dev/zero", O_RDONLY|O_CLOEXEC));
>+-	if(fd < 0)
>+-	{	mmdc->fd = FD_NONE;
>+-		return NIL(Void_t*);
>+-	}
>+-#if O_CLOEXEC == 0
>+-	else
>+-		SETCLOEXEC(fd);
>+-#endif
>+-	if(fd >= FD_PRIVATE || (mmdc->fd = fcntl(fd, F_DUPFD_CLOEXEC, FD_PRIVATE)) < 0)
>+-		mmdc->fd = fd;
>+-	else
>+-	{	close(fd);
>+-#if F_DUPFD_CLOEXEC == F_DUPFD
>+-		SETCLOEXEC(mmdc->fd);
>+-#endif
>+-	}
>+-	RESTARTMEM(caddr, mmapzeromem(vm, caddr, csize, nsize, disc));
>+-	if(!caddr)
>+-	{	close(mmdc->fd);
>+-		mmdc->fd = FD_NONE;
>+-	}
>+-	RETURN(vm, caddr, nsize);
>+-}
>+-#endif /* _mem_mmap_zero */
>+-
>+ #if _std_malloc /* using native malloc as a last resort */
>+ static Void_t* mallocmem(Vmalloc_t* vm, Void_t* caddr, size_t csize, size_t nsize, Vmdisc_t* disc)
>+ {
>+@@ -364,12 +295,6 @@ static Void_t* getmemory(Vmalloc_t* vm, 
>+ 		return (Void_t*)addr;
>+ 	}
>+ #endif
>+-#if _mem_mmap_zero
>+-	if((_Vmassert & VM_zero) && (addr = mmapzeromeminit(vm, caddr, csize, nsize, disc)))
>+-	{	GETMEMUSE(mmapzeromem, disc);
>+-		return (Void_t*)addr;
>+-	}
>+-#endif
>+ #if _mem_sbrk
>+ 	if((_Vmassert & VM_break) && (addr = sbrkmem(vm, caddr, csize, nsize, disc)))
>+ 	{	GETMEMUSE(sbrkmem, disc);
>+@@ -386,6 +311,7 @@ static Void_t* getmemory(Vmalloc_t* vm, 
>+ 	if((_Vmassert & VM_native) && (addr = mallocmem(vm, caddr, csize, nsize, disc)))
>+ 	{	GETMEMUSE(mallocmem, disc);
>+ 		return (Void_t*)addr;
>++	}
>+ #endif 
>+ 	write(2, "vmalloc: panic: all memory allocation disciplines failed\n", 57);
>+ 	abort();
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdebug.c ./files/patch-src_lib_libast_vmalloc_vmdebug.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdebug.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmdebug.c	2019-02-25 09:07:46.025346000 +0100
>@@ -0,0 +1,29 @@
>+--- src/lib/libast/vmalloc/vmdebug.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmdebug.c
>+@@ -335,7 +335,7 @@ int		local;
>+ 	if(vm->data->mode&VM_DBCHECK)
>+ 		vmdbcheck(vm);
>+ 
>+-	sz = ROUND(size,ALIGN) + DB_EXTRA;
>++	sz = ROUND(size,MEM_ALIGN) + DB_EXTRA;
>+ 	sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t);
>+ 	if(!(data = (Vmuchar_t*)KPVALLOC(vm, sz, (*(Vmbest->allocf))) ) )
>+ 	{	dbwarn(vm, NIL(Vmuchar_t*), DB_ALLOC, file, line, func, DB_ALLOC);
>+@@ -483,7 +483,7 @@ int		local;
>+ 	oldline = DBLINE(addr);
>+ 
>+ 	/* do the resize */
>+-	sz = ROUND(size,ALIGN) + DB_EXTRA;
>++	sz = ROUND(size,MEM_ALIGN) + DB_EXTRA;
>+ 	sz = sz >= sizeof(Body_t) ? sz : sizeof(Body_t);
>+ 	data = (Vmuchar_t*)KPVRESIZE(vm, (Void_t*)data, sz, (type&~VM_RSZERO), (*(Vmbest->resizef)) );
>+ 	if(!data) /* failed, reset data for old block */
>+@@ -632,7 +632,7 @@ int		local;
>+ 
>+ 	asolock(&vm->data->dlck, KEY_DEBUG, ASO_LOCK);
>+ 
>+-	if((sz = ROUND(size,ALIGN) + DB_EXTRA) < sizeof(Body_t))
>++	if((sz = ROUND(size,MEM_ALIGN) + DB_EXTRA) < sizeof(Body_t))
>+ 		sz = sizeof(Body_t);
>+ 
>+ 	if((data = (Vmuchar_t*)KPVALIGN(vm, sz, align, (*(Vmbest->alignf)))) )
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h ./files/patch-src_lib_libast_vmalloc_vmhdr.h
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmhdr.h	2019-02-25 09:07:46.025698000 +0100
>@@ -0,0 +1,86 @@
>+--- src/lib/libast/vmalloc/vmhdr.h.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmhdr.h
>+@@ -86,7 +86,7 @@
>+ #if defined(_WIN32)
>+ #define _mem_win32	1	/* use the VirtualAlloc interface	*/
>+ #endif
>+-#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon && !_mem_mmap_zero
>++#if !_mem_win32 && !_mem_sbrk && !_mem_mmap_anon
>+ #undef _std_malloc
>+ #define _std_malloc	1	/* use native malloc/free/realloc	*/
>+ #endif
>+@@ -160,11 +160,11 @@ extern void		_vmmessage _ARG_((const cha
>+ 				    (ABORT() ? (abort(),0) : PAUSE() ? (pause(),0) : 0)) )
>+ #define COUNT(n)	((n) += 1)
>+ #define ACCOUNT(a,b)	((a) += (b))
>+-#define INITMEMORY(m,z)	((m) ? (memset((m), 'i', (z) > 2*ALIGN ? 2*ALIGN : (z)), 0) : 0 )
>+-#define SETBUSYMEM(m,z)	(memset(((char*)(m))+2*ALIGN, 'b', (z) <= 2*ALIGN ? 0 : ALIGN ) )
>+-#define CHKBUSYMEM(m,z)	(memcmp(((char*)(m))+2*ALIGN, "bbbbbbbb", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 )
>+-#define SETFREEMEM(m,z)	(memset(((char*)(m))+2*ALIGN, 'f', (z) <= 2*ALIGN ? 0 : ALIGN ) )
>+-#define CHKFREEMEM(m,z)	(memcmp(((char*)(m))+2*ALIGN, "ffffffff", (z) <= 2*ALIGN ? 0 : 8) == 0 ? 1 : 0 )
>++#define INITMEMORY(m,z)	((m) ? (memset((m), 'i', (z) > 2*MEM_ALIGN ? 2*MEM_ALIGN : (z)), 0) : 0 )
>++#define SETBUSYMEM(m,z)	(memset(((char*)(m))+2*MEM_ALIGN, 'b', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) )
>++#define CHKBUSYMEM(m,z)	(memcmp(((char*)(m))+2*MEM_ALIGN, "bbbbbbbb", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 )
>++#define SETFREEMEM(m,z)	(memset(((char*)(m))+2*MEM_ALIGN, 'f', (z) <= 2*MEM_ALIGN ? 0 : MEM_ALIGN ) )
>++#define CHKFREEMEM(m,z)	(memcmp(((char*)(m))+2*MEM_ALIGN, "ffffffff", (z) <= 2*MEM_ALIGN ? 0 : 8) == 0 ? 1 : 0 )
>+ #define DEBUGDECL(_ty_,_ob_)	_ty_ _ob_;
>+ #else
>+ #define ABORT()		(0)
>+@@ -203,7 +203,7 @@ extern void		_vmmessage _ARG_((const cha
>+ #define BITS		(BUSY|PFREE|SMALL|MARK)
>+ #define ALIGNB		(BITS+1) /* to guarantee blksize == 0%(BITS+1)	*/
>+ 
>+-/* ALIGN is chosen for three conditions:
>++/* MEM_ALIGN is chosen for three conditions:
>+ ** 1. Able to address all primitive types.
>+ ** 2. A multiple of ALIGNB==(BITS+1) as discussed above.
>+ ** 3. Large enough to cover two pointers. Note that on some machines
>+@@ -238,9 +238,9 @@ struct _two_s
>+ 	void*		two;
>+ };
>+ #define ALIGNA	(sizeof(struct _a_s) - sizeof(union _align_u))
>+-#undef	ALIGN	/* Blocks will be aligned on both ALIGNA & ALIGNB */
>++#undef	MEM_ALIGN	/* Blocks will be aligned on both ALIGNA & ALIGNB */
>+ #define ALIGNAB	MULTIPLE(ALIGNA,ALIGNB)
>+-#define ALIGN	MULTIPLE(ALIGNAB, sizeof(struct _two_s))
>++#define MEM_ALIGN	MULTIPLE(ALIGNAB, sizeof(struct _two_s))
>+ 
>+ typedef union _word_u
>+ {	size_t		size;	/* to store a size_t	*/
>+@@ -252,7 +252,7 @@ struct _head_s /* a block header has two
>+ {	Word_t		one;
>+ 	Word_t		two;
>+ };
>+-#define HEADSIZE	ROUND(sizeof(struct _head_s), ALIGN)
>++#define HEADSIZE	ROUND(sizeof(struct _head_s), MEM_ALIGN)
>+ union _head_u
>+ {	Vmuchar_t	data[HEADSIZE];	/* to standardize size	*/
>+ 	struct _head_s	head;
>+@@ -264,15 +264,15 @@ struct _body_s /* Note that self is actu
>+ 	Block_t*	left;	/* left child in free tree	*/
>+ 	Block_t**	self;	/* self pointer when free	*/
>+ };
>+-#define BODYSIZE	ROUND(sizeof(struct _body_s), ALIGN)
>++#define BODYSIZE	ROUND(sizeof(struct _body_s), MEM_ALIGN)
>+ union _body_u
>+ {	Vmuchar_t	data[BODYSIZE];	/* to standardize size	*/
>+ 	struct _body_s	body;
>+ };
>+ 
>+ /* After all the songs and dances, we should now have:
>+-**	sizeof(Head_t)%ALIGN == 0
>+-**	sizeof(Body_t)%ALIGN == 0
>++**	sizeof(Head_t)%MEM_ALIGN == 0
>++**	sizeof(Body_t)%MEM_ALIGN == 0
>+ ** and	sizeof(Block_t) = sizeof(Head_t)+sizeof(Body_t)
>+ */
>+ struct _block_s
>+@@ -321,7 +321,7 @@ struct _block_s
>+ #define ENDB(sgb)	((Block_t*)((Vmuchar_t*)NEXT(sgb) - sizeof(Head_t)) )
>+ 
>+ /* the start of allocatable memory in a segment */
>+-#define SEGDATA(sg)	((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),ALIGN) )
>++#define SEGDATA(sg)	((Vmuchar_t*)(sg) + ROUND(sizeof(Seg_t),MEM_ALIGN) )
>+ 
>+ /* testing to see if "sg" is the root segment of a region */
>+ #define SEGROOT(sg)	((Vmuchar_t*)(sg)->vmdt >= (sg)->base && \
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmlast.c ./files/patch-src_lib_libast_vmalloc_vmlast.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmlast.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmlast.c	2019-02-25 09:07:46.026063000 +0100
>@@ -0,0 +1,40 @@
>+--- src/lib/libast/vmalloc/vmlast.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmlast.c
>+@@ -61,7 +61,7 @@ int		local;
>+ 
>+ 	LASTLOCK(last, local);
>+ 
>+-	size = size < ALIGN ? ALIGN : ROUND(size,ALIGN);
>++	size = size < MEM_ALIGN ? MEM_ALIGN : ROUND(size,MEM_ALIGN);
>+ 
>+ 	last->last = NIL(Vmuchar_t*); /* wipe record of last allocation */
>+ 
>+@@ -119,7 +119,7 @@ int		local;
>+ 	if(data != (Void_t*)last->last )
>+ 		data = NIL(Void_t*);
>+ 	else
>+-	{	size = last->data - last->last;	/**/DEBUG_ASSERT(size > 0 && size%ALIGN == 0);
>++	{	size = last->data - last->last;	/**/DEBUG_ASSERT(size > 0 && size%MEM_ALIGN == 0);
>+ 		last->data -= size;
>+ 		last->size += size;
>+ 		last->last = NIL(Vmuchar_t*);
>+@@ -166,8 +166,8 @@ int		local;
>+ 	if(data != (Void_t*)last->last )
>+ 		data = NIL(Void_t*);
>+ 	else
>+-	{	oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%ALIGN == 0);
>+-		size = ROUND(size, ALIGN);
>++	{	oldz = last->data - last->last; /**/DEBUG_ASSERT(oldz > 0 && oldz%MEM_ALIGN == 0);
>++		size = ROUND(size, MEM_ALIGN);
>+ 		if(size <= oldz) /* getting smaller */
>+ 		{	sz = oldz - size;
>+ 			last->data -= sz;
>+@@ -249,7 +249,7 @@ int		local;
>+ 
>+ 	LASTLOCK(last, local);
>+ 
>+-	size = ROUND(size,ALIGN);
>++	size = ROUND(size,MEM_ALIGN);
>+ 	align = (*_Vmlcm)(align, 2*sizeof(Block_t));
>+ 
>+ 	if((data = (Vmuchar_t*)KPVALLOC(vm, size + align, lastalloc)) )
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmmaddress.c ./files/patch-src_lib_libast_vmalloc_vmmaddress.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmmaddress.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmmaddress.c	2019-02-25 09:07:46.026379000 +0100
>@@ -0,0 +1,11 @@
>+--- src/lib/libast/vmalloc/vmmaddress.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmmaddress.c
>+@@ -96,7 +96,7 @@ ssize_t _vmpagesize(void)
>+ 		if ((_Vmpagesize = getpagesize()) <= 0)
>+ #endif
>+ 			_Vmpagesize = VM_PAGESIZE;
>+-		_Vmpagesize = (*_Vmlcm)(_Vmpagesize, ALIGN);
>++		_Vmpagesize = (*_Vmlcm)(_Vmpagesize, MEM_ALIGN);
>+ 	}
>+ #if VMCHKMEM
>+ 	_Vmchkmem = _vmchkmem; /* _vmchkmem() can check memory availability */
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmopen.c ./files/patch-src_lib_libast_vmalloc_vmopen.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmopen.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmopen.c	2019-02-25 09:07:46.026715000 +0100
>@@ -0,0 +1,61 @@
>+--- src/lib/libast/vmalloc/vmopen.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmopen.c
>+@@ -97,10 +97,10 @@ int		mode;	/* type of region		*/
>+ 					write(9, "vmalloc: panic: heap initialization error #2\n", 45);
>+ 				return NIL(Vmalloc_t*);
>+ 			}
>+-			/**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0);
>++			/**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0);
>+ 
>+ 			if(vd->mode & VM_MEMORYF) /* point addr to Vmalloc_t */
>+-				addr -= ROUND(sizeof(Vmalloc_t), ALIGN);
>++				addr -= ROUND(sizeof(Vmalloc_t), MEM_ALIGN);
>+ 		}
>+ 	}
>+ 
>+@@ -110,7 +110,7 @@ int		mode;	/* type of region		*/
>+ 		incr = disc->round <= 0 ? _Vmpagesize : ROUND(disc->round, _Vmpagesize);
>+ 
>+ 		/* size of Vmalloc_t if embedded in the same initial segment */
>+-		vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),ALIGN) : 0;
>++		vmsz = (mode&VM_MEMORYF) ? ROUND(sizeof(Vmalloc_t),MEM_ALIGN) : 0;
>+ 
>+ 		vdsz = 0; /* get actual size of Vmdata_t including method specific data */
>+ 		if(!meth->eventf || (*meth->eventf)(vmp, VM_OPEN, &vdsz) < 0 || vdsz <= 0 )
>+@@ -118,13 +118,13 @@ int		mode;	/* type of region		*/
>+ 				write(9, "vmalloc: panic: heap initialization error #3\n", 45);
>+ 			return NIL(Vmalloc_t*);
>+ 		}
>+-		vdsz = ROUND(vdsz, ALIGN);
>++		vdsz = ROUND(vdsz, MEM_ALIGN);
>+ 
>+-		sgsz = ROUND(sizeof(Seg_t), ALIGN); /* size of segment structure */
>++		sgsz = ROUND(sizeof(Seg_t), MEM_ALIGN); /* size of segment structure */
>+ 
>+ 		/* get initial memory segment containing Vmdata_t, Seg_t and some extra */
>+ 		size = vmsz + vdsz + sgsz + 8*_Vmpagesize;
>+-		size = ROUND(size,incr); /**/DEBUG_ASSERT(size%ALIGN == 0 );
>++		size = ROUND(size,incr); /**/DEBUG_ASSERT(size%MEM_ALIGN == 0 );
>+ 		if(!(base = (Vmuchar_t*)(*disc->memoryf)(vmp, NIL(Void_t*), 0, size, disc)) )
>+ 		{	if(initheap)
>+ 				write(9, "vmalloc: panic: heap initialization error #4\n", 45);
>+@@ -136,14 +136,14 @@ int		mode;	/* type of region		*/
>+ 			memset(base, 0, vmsz + vdsz + sgsz);
>+ 
>+ 		/* make sure memory is properly aligned */
>+-		if((algn = (ssize_t)(VMLONG(base)%ALIGN)) == 0 )
>++		if((algn = (ssize_t)(VMLONG(base)%MEM_ALIGN)) == 0 )
>+ 			addr = base;
>+-		else	addr = base + (ALIGN-algn);
>+-		/**/DEBUG_ASSERT(VMLONG(addr)%ALIGN == 0 );
>++		else	addr = base + (MEM_ALIGN-algn);
>++		/**/DEBUG_ASSERT(VMLONG(addr)%MEM_ALIGN == 0 );
>+ 
>+ 		/* addresses of Vmdata_t and root segment */
>+-		vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%ALIGN == 0);
>+-		seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%ALIGN == 0);
>++		vd = (Vmdata_t*)(addr + vmsz); /**/DEBUG_ASSERT(VMLONG(vd)%MEM_ALIGN == 0);
>++		seg = (Seg_t*)(addr + vmsz + vdsz); /**/DEBUG_ASSERT(VMLONG(seg)%MEM_ALIGN == 0);
>+ 
>+ 		/* set Vmdata_t data */
>+ 		vd->mode = mode;
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmpool.c ./files/patch-src_lib_libast_vmalloc_vmpool.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmpool.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmpool.c	2019-02-25 09:07:46.027059000 +0100
>@@ -0,0 +1,20 @@
>+--- src/lib/libast/vmalloc/vmpool.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmpool.c
>+@@ -47,7 +47,7 @@ typedef struct _vmpool_s
>+ 	Pool_t*		free;	/* list of free blocks	*/
>+ } Vmpool_t;
>+ 
>+-#define POOLSIZE(sz)	ROUND(ROUND((sz), sizeof(Pool_t)), ALIGN)
>++#define POOLSIZE(sz)	ROUND(ROUND((sz), sizeof(Pool_t)), MEM_ALIGN)
>+ 
>+ #ifdef DEBUG
>+ static int	N_pool;	/* counter for Vmpool calls	*/
>+@@ -206,7 +206,7 @@ static int poolstat(Vmalloc_t* vm, Vmsta
>+ 	if(pool->size <= 0 )
>+ 		return -1;
>+ 
>+-	size = ROUND(pool->size, ALIGN);
>++	size = ROUND(pool->size, MEM_ALIGN);
>+ 
>+ 	for(pl = pool->free; pl; pl = pl->next )
>+ 		st->n_free += 1;
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmsegment.c ./files/patch-src_lib_libast_vmalloc_vmsegment.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmsegment.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libast_vmalloc_vmsegment.c	2019-02-25 09:07:46.027365000 +0100
>@@ -0,0 +1,32 @@
>+--- src/lib/libast/vmalloc/vmsegment.c.orig	2016-02-28 17:09:23 UTC
>++++ src/lib/libast/vmalloc/vmsegment.c
>+@@ -194,7 +194,7 @@ static Block_t* _vmseginit(Vmdata_t* vmd
>+ 
>+ 	/* available memory in Seg_t for allocation usage */
>+ 	size = (base+size) - SEGDATA(seg);
>+-	size = (size/ALIGN)*ALIGN; /* must be multiple of ALIGN's */
>++	size = (size/MEM_ALIGN)*MEM_ALIGN; /* must be multiple of MEM_ALIGN's */
>+ 
>+ 	/* block at start of memory */
>+ 	seg->begb = (Block_t*)SEGDATA(seg);
>+@@ -256,7 +256,7 @@ static Block_t* _vmsegalloc(Vmalloc_t* v
>+ 	static size_t	Segunit = 0;
>+ 	/**/DEBUG_COUNT(N_segalloc);
>+ 	/**/DEBUG_ASSERT(!blk || (isblock(vmdt, blk) && (SIZE(blk)&BUSY) ) );
>+-	/**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%ALIGN == 0 );
>++	/**/DEBUG_ASSERT(_Vmpagesize > 0 && _Vmpagesize%MEM_ALIGN == 0 );
>+ 
>+ /* transition to a fixed place to unlock before returning */
>+ #undef	RETURN
>+@@ -381,9 +381,9 @@ static Block_t* _vmsegalloc(Vmalloc_t* v
>+ 		}
>+ 
>+ 		/* segment must start at an aligned address */
>+-		if((sz = (size_t)(VMLONG(base)%ALIGN)) == 0)
>++		if((sz = (size_t)(VMLONG(base)%MEM_ALIGN)) == 0)
>+ 			seg = (Seg_t*)base;
>+-		else	seg = (Seg_t*)(base + ALIGN-sz);
>++		else	seg = (Seg_t*)(base + MEM_ALIGN-sz);
>+ 		blk = _vmseginit(vmdt, seg, base, segsz, 0);
>+ 	}
>+ 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src_lib_libcmd_ls.c ./files/patch-src_lib_libcmd_ls.c
>--- /usr/ports/shells/ksh93/files/patch-src_lib_libcmd_ls.c	1970-01-01 01:00:00.000000000 +0100
>+++ ./files/patch-src_lib_libcmd_ls.c	2019-02-25 09:07:46.027661000 +0100
>@@ -0,0 +1,32 @@
>+--- src/lib/libcmd/ls.c.orig	2017-11-30 22:35:04 UTC
>++++ src/lib/libcmd/ls.c
>+@@ -1257,7 +1257,7 @@ ls(State_t* state, register FTSENT* ent)
>+ 	if (!VISIBLE(state, ent))
>+ 	{
>+ 		fts_set(NiL, ent, FTS_SKIP);
>+-		return;
>++		return 0;
>+ 	}
>+ 	switch (ent->fts_info)
>+ 	{
>+@@ -1265,17 +1265,17 @@ ls(State_t* state, register FTSENT* ent)
>+ 		if (ent->fts_parent->fts_info == FTS_DNX)
>+ 			break;
>+ 		error(2, "%s: not found", ent->fts_path);
>+-		return;
>++		return 1;
>+ 	case FTS_DC:
>+ 		if (state->lsflags & LS_DIRECTORY)
>+ 			break;
>+ 		error(2, "%s: directory causes cycle", ent->fts_path);
>+-		return;
>++		return 1;
>+ 	case FTS_DNR:
>+ 		if (state->lsflags & LS_DIRECTORY)
>+ 			break;
>+ 		error(2, "%s: cannot read directory", ent->fts_path);
>+-		return 0;
>++		return 1;
>+ 	case FTS_DOT:
>+ 		#if 0
>+ 		fts_set(NiL, ent, FTS_SKIP);
>diff -ruN /usr/ports/shells/ksh93/files/patch-src-lib-libast-features-wchar ./files/patch-src-lib-libast-features-wchar
>--- /usr/ports/shells/ksh93/files/patch-src-lib-libast-features-wchar	2016-10-28 17:08:14.000000000 +0200
>+++ ./files/patch-src-lib-libast-features-wchar	1970-01-01 01:00:00.000000000 +0100
>@@ -1,10 +0,0 @@
>---- src/lib/libast/features/wchar.orig	2012-01-12 07:40:22 UTC
>-+++ src/lib/libast/features/wchar
>-@@ -51,6 +51,7 @@ endif
>- run{
>- cat <<!
>- 	#if _hdr_wchar && defined(_nxt_wchar)
>-+	#define _STDFILE_DECLARED
>- 	#include ${_nxt_wchar-_nxt_wchar}	/* the native wchar.h */
>- 	#endif
>- 
>diff -ruN /usr/ports/shells/ksh93/files/patch-src-lib-libast-hash-hashalloc.c ./files/patch-src-lib-libast-hash-hashalloc.c
>--- /usr/ports/shells/ksh93/files/patch-src-lib-libast-hash-hashalloc.c	2016-10-28 17:08:14.000000000 +0200
>+++ ./files/patch-src-lib-libast-hash-hashalloc.c	1970-01-01 01:00:00.000000000 +0100
>@@ -1,19 +0,0 @@
>---- src/lib/libast/hash/hashalloc.c.orig	2006-11-07 22:29:04 UTC
>-+++ src/lib/libast/hash/hashalloc.c
>-@@ -151,7 +151,16 @@ hashalloc(Hash_table_t* ref, ...)
>- 				va_copy(*vp, ap);
>- 				vp++;
>- 			}
>-+#if __clang__ && __SIZEOF_POINTER__ == 4
>-+			{
>-+				va_list		np;
>-+
>-+				np = va_listval(va_arg(ap, va_listarg));
>-+				va_copy(ap, np);
>-+			}
>-+#else
>- 			va_copy(ap, va_listval(va_arg(ap, va_listarg)));
>-+#endif
>- 			break;
>- 		case 0:
>- 			if (vp > va)
>diff -ruN /usr/ports/shells/ksh93/files/patch-src-lib-libast-string-tokscan.c ./files/patch-src-lib-libast-string-tokscan.c
>--- /usr/ports/shells/ksh93/files/patch-src-lib-libast-string-tokscan.c	2016-10-28 17:08:14.000000000 +0200
>+++ ./files/patch-src-lib-libast-string-tokscan.c	1970-01-01 01:00:00.000000000 +0100
>@@ -1,19 +0,0 @@
>---- src/lib/libast/string/tokscan.c.orig	2006-11-07 22:29:31 UTC
>-+++ src/lib/libast/string/tokscan.c
>-@@ -233,7 +233,16 @@ tokscan(register char* s, char** nxt, co
>- 			prv_f = f;
>- 			f = va_arg(ap, char*);
>- 			va_copy(prv_ap, ap);
>-+#if __clang__ && __SIZEOF_POINTER__ == 4
>-+			{
>-+				va_list		np;
>-+
>-+				np = va_listval(va_arg(ap, va_listarg));
>-+				va_copy(ap, np);
>-+			}
>-+#else
>- 			va_copy(ap, va_listval(va_arg(ap, va_listarg)));
>-+#endif
>- 			continue;
>- 		case 'c':
>- 			p_char = va_arg(ap, char*);
>diff -ruN /usr/ports/shells/ksh93/Makefile ./Makefile
>--- /usr/ports/shells/ksh93/Makefile	2018-11-02 14:32:34.000000000 +0100
>+++ ./Makefile	2019-02-25 10:44:53.343309000 +0100
>@@ -12,39 +12,35 @@
> 
> PORTNAME=	ksh93
> PORTVERSION=	${KSHVERSION:S/-//g}
>-PORTREVISION=	2
> CATEGORIES=	shells
>-MASTER_SITES=	http://www2.research.att.com/~astopen/download/tgz/ \
>-		LOCAL/sunpoet/${PORTNAME}
>-DISTFILES=	INIT.${INITVERSION}.tgz ast-ksh.${KSHVERSION}.tgz
>+MASTER_SITES=	https://github.com/att/ast/archive/
>+DISTNAME=	${PORTNAME}v
> DIST_SUBDIR=	${PORTNAME}
> 
> MAINTAINER=	saper@saper.info
>-COMMENT=	Official AT&T release of KornShell 93
>+COMMENT=	KornShell 93
> 
> LICENSE=	EPL
> 
>+BROKEN_aarch64=		Fails to compile: needs sbrk
>+
> CONFLICTS=	ksh93-devel-*
> 
> OPTIONS_DEFINE=	EXAMPLES STATIC
> 
>-FETCH_ENV=	HTTP_AUTH=basic:*:I\ accept\ www.opensource.org/licenses/cpl:.
> LDFLAGS+=	-lm
>-MAKE_ENV=	CCFLAGS="${CFLAGS}"
>-NO_WRKSUBDIR=	yes
>+MAKE_ENV=	CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses ${CFLAGS}"
>+WRKSRC=		${WRKDIR}/ast-${PORTNAME}v
> 
>-INITVERSION=	2013-05-24
>-KSHVERSION=	2012-08-01
>+KSHVERSION=	2014-12-24
> 
> STATIC_MAKE_ENV=	LDFLAGS+=-static
> 
>-BROKEN_aarch64=		Fails to compile: needs sbrk
>-
> post-patch:
> 	@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
> 
> do-build:
>-	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make
>+	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make ksh93
> 
> do-install:
> 	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/ksh93
Comment 21 Marcin Cieślak 2019-03-13 00:15:00 UTC
(In reply to Marcin Cieślak from comment #20)

er, sorry for this junk...
Comment 22 Cy Schubert freebsd_committer freebsd_triage 2019-03-13 01:07:10 UTC
Checking out the phab review.
Comment 23 Marcin Cieślak 2019-04-15 08:24:08 UTC
https://reviews.freebsd.org/D19343?id=55482 has been submitted for review, it should address all issues raised so far.
Comment 24 Cy Schubert freebsd_committer freebsd_triage 2019-04-15 20:18:45 UTC
The latest rev on phabricator builds ok and resolves this PR.

I'll wait for linimon@ and Piotr to determine if it looks good for gcc-based arches (the port ignores USE_GCC= so I can't test on amd64).

We'll see what Mark and Piotr have to say about gcc before committing it.
Comment 25 commit-hook freebsd_committer freebsd_triage 2019-04-21 17:30:00 UTC
A commit references this bug:

Author: cy
Date: Sun Apr 21 17:29:55 UTC 2019
New revision: 499547
URL: https://svnweb.freebsd.org/changeset/ports/499547

Log:
  shells/ksh93: Update to 93v 2014-12-24

  PR:		208098 (fixed)
  Submitted by:	saper@saper.info (maintainer)
  Reported by:	fuz@fuz.su
  Reviewed by:	cy@, pkubaj@
  Approved by:	maintainer (implicit, submitter)
  Differential Revision:	https://reviews.freebsd.org/D19343

Changes:
  head/shells/ksh93/Makefile
  head/shells/ksh93/distinfo
  head/shells/ksh93/files/patch-src-lib-libast-features-wchar
  head/shells/ksh93/files/patch-src-lib-libast-hash-hashalloc.c
  head/shells/ksh93/files/patch-src-lib-libast-string-tokscan.c
  head/shells/ksh93/files/patch-src_cmd_INIT_iffe.sh
  head/shells/ksh93/files/patch-src_cmd_proto_proto.c
  head/shells/ksh93/files/patch-src_cmd_std_features_procfs
  head/shells/ksh93/files/patch-src_cmd_std_pss-kvm.c
  head/shells/ksh93/files/patch-src_lib_libast_comp_setlocale.c
  head/shells/ksh93/files/patch-src_lib_libast_features_mmap
  head/shells/ksh93/files/patch-src_lib_libast_features_standards
  head/shells/ksh93/files/patch-src_lib_libast_features_vmalloc
  head/shells/ksh93/files/patch-src_lib_libast_features_wchar
  head/shells/ksh93/files/patch-src_lib_libast_port_astcopy.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfclose.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfhdr.h
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfmode.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfpurge.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfrd.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfseek.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetbuf.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfsetfd.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfsize.c
  head/shells/ksh93/files/patch-src_lib_libast_sfio_sfsk.c
  head/shells/ksh93/files/patch-src_lib_libast_string_strexpr.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_malloc.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmbest.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcshare.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdcsystem.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmdebug.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmhdr.h
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmlast.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmmaddress.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmopen.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmpool.c
  head/shells/ksh93/files/patch-src_lib_libast_vmalloc_vmsegment.c
  head/shells/ksh93/files/patch-src_lib_libcmd_ls.c
Comment 26 Cy Schubert freebsd_committer freebsd_triage 2019-04-21 17:30:44 UTC
Fixed.