Skip to content

Commit 1054008

Browse files
committedFeb 22, 2020
AT&T AST (att/ast) on github has rewound their repo back to ksh93u+. See
att/ast#1464 and att/ast#1466. The reason for the rewind back to 93u+ instead of 93v- was that it was an abandoned unstable buggy unfinished beta. A full explanation of this can be found here, att/ast#1466 (comment). The version number is reverted back to 93u and an EPOCH bump, though not needed, documents this siesmic shift.
1 parent 4289173 commit 1054008

16 files changed

+319
-131
lines changed
 

‎shells/ksh93/Makefile

+45-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
# $FreeBSD$
22

3+
# Make sure that your configuration DOES NOT set ANY gcc-related
4+
# variables. ksh93 will not compile if you set even the seemingly
5+
# most unrelated variable related to gcc configuration. This means
6+
# especially any flag which attempts to set the cputype. Setting the
7+
# cputype does absolutely nothing except cause systems to fail in
8+
# horrible ways. For any modern processor, setting the cputype only
9+
# serves to expose gcc bugs and does nothing to speed up any known
10+
# program. If you are really unconvinced, go ahead but do not
11+
# complain to me about it.
12+
13+
# Do not update this port to 93v. 93v was an abandoned beta when
14+
# David Korn left the project. It was subsequently reverted to 93u.
15+
# https://github.com/att/ast/issues/1466#issuecomment-589942449
16+
317
PORTNAME= ksh93
4-
DISTVERSION= 2020.0.1
18+
DISTVERSION= 93u
519
PORTREVISION= 1
6-
PORTEPOCH= 1
20+
PORTEPOCH= 2
721
CATEGORIES= shells
22+
DIST_SUBDIR= ksh93
823

924
MAINTAINER= cy@FreeBSD.org
1025
COMMENT= AT&T KornShell 93
1126

1227
LICENSE= EPL
1328

14-
USES= compiler:c11 meson ninja python:build
29+
BROKEN_aarch64= Fails to compile: needs sbrk
30+
31+
USES= compiler:c11
1532

1633
USE_GITHUB= yes
1734
GH_ACCOUNT= att
@@ -20,15 +37,18 @@ GH_PROJECT= ast
2037
KSH_CONFLICTS= pdksh-*
2138
KSH93_CONFLICTS= ksh93-devel-* ast-ksh-*
2239

23-
MESON_BUILD_DIR= build
24-
25-
OPTIONS_DEFAULT= KSH93
40+
OPTIONS_DEFAULT= KSH93 EXAMPLES
41+
OPTIONS_DEFINE= EXAMPLES STATIC
2642
OPTIONS_SINGLE= BIN_KSH
2743
OPTIONS_SINGLE_BIN_KSH= KSH KSH93
2844
KSH_DESC= Install to ${PREFIX}/bin/ksh
2945
KSH93_DESC= Install to ${PREFIX}/bin/ksh93
3046

31-
KSH93_EXTRA_PATCHES= ${FILESDIR}/extra-patch-install-as-ksh93
47+
CFLAGS+= -DMAP_TYPE
48+
LDFLAGS+= -lm
49+
MAKE_ENV= CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses" CFLAGS="${CFLAGS}"
50+
51+
STATIC_MAKE_ENV= LDFLAGS+=-static
3252

3353
KSH_PLIST_SUB= 93=""
3454
KSH93_PLIST_SUB= 93="93"
@@ -39,14 +59,25 @@ KSH93_PLIST_SUB= 93="93"
3959
BROKEN= GCC 9.1 changes the output of `gcc -E` which breaks the conf.sh script, fixed in shells/ksh93-devel
4060
.endif
4161

42-
post-patch:
43-
@${REINPLACE_CMD} -e '/for name in/ s|python.*|${PYTHON_CMD}|g' ${WRKSRC}/scripts/python.sh
44-
@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
4562
.if ${PORT_OPTIONS:MKSH93}
46-
@${MV} ${WRKSRC}/src/cmd/ksh93/docs/ksh.1 ${WRKSRC}/src/cmd/ksh93/docs/ksh93.1
47-
.endif
48-
.if ${PORT_OPTIONS:MKSH}
49-
@# Keep portlint happy
63+
PNAME= ksh93
64+
.else
65+
PNAME= ksh
5066
.endif
5167

68+
post-patch:
69+
@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
70+
71+
do-build:
72+
@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make ksh93
73+
74+
do-install:
75+
${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/${PNAME}
76+
${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/${PNAME}.1
77+
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
78+
cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/
79+
80+
do-test:
81+
cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests
82+
5283
.include <bsd.port.post.mk>

‎shells/ksh93/distinfo

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
TIMESTAMP = 1578621862
2-
SHA256 (att-ast-2020.0.1_GH0.tar.gz) = dc022c80021bbe27aabcdcd90cc5caeabff1955cf5fdfcc32ebd410b0da141be
3-
SIZE (att-ast-2020.0.1_GH0.tar.gz) = 2023438
1+
TIMESTAMP = 1582352303
2+
SHA256 (ksh93/att-ast-93u_GH0.tar.gz) = 4cf10ae50306361a18d900008961093b5c2c51d69f4e50d14b911a8ce014d37f
3+
SIZE (ksh93/att-ast-93u_GH0.tar.gz) = 12960931

‎shells/ksh93/files/extra-patch-install-as-ksh93

-25
This file was deleted.

‎shells/ksh93/files/patch-ksh-2020.0.0-cve-2019-14868.patch

-78
This file was deleted.

‎shells/ksh93/files/patch-scripts_builtin_documentation.sh

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--- src/cmd/std/features/procfs.orig 2017-11-30 22:35:04 UTC
2+
+++ src/cmd/std/features/procfs
3+
@@ -1,6 +1,6 @@
4+
hdr kvm,procinfo,pstat,asm/param
5+
6+
-sys procfs,sysctl
7+
+sys procfs,sysctl,user
8+
9+
lib getprocs
10+
lib kvm_open,kvm_getprocs kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm
11+
@@ -10,7 +10,11 @@ mem extern_proc.p_pid,extern_proc.p_star
12+
mem procsinfo64.pi_pri procinfo.h
13+
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
14+
15+
+num PIOCPSINFO
16+
+
17+
typ struct.prpsinfo -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
18+
+typ struct.kinfo_proc sys/types.h sys/procfs.h sys/user.h
19+
+typ struct.kp_proc sys/types.h sys/procfs.h sys/user.h
20+
21+
tst lib_info note{ info(2) kernel table api }end link{
22+
#include <info.h>
23+
@@ -587,11 +591,11 @@ cat{
24+
#define PSS_METHOD PSS_METHOD_getprocs
25+
#endif
26+
27+
-#if !PSS_METHOD && defined(_PS_dir)
28+
+#if !PSS_METHOD && defined(_PS_dir) && (_PS_scan_binary || _num_PIOCPSINFO)
29+
#define PSS_METHOD PSS_METHOD_procfs
30+
#endif
31+
32+
-#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs
33+
+#if !PSS_METHOD && _hdr_kvm && _sys_sysctl && _lib_kvm_open && _lib_kvm_getprocs && _typ_struct_kinfo_proc && _typ_struct_kp_proc
34+
#define PSS_METHOD PSS_METHOD_kvm
35+
#endif
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- src/cmd/std/pss-kvm.c.orig 2017-11-30 22:35:04 UTC
2+
+++ src/cmd/std/pss-kvm.c
3+
@@ -43,6 +43,9 @@ NoN(pss_kvm)
4+
#if _sys_proc
5+
#include <sys/proc.h>
6+
#endif
7+
+#if _sys_user
8+
+#include <sys/user.h>
9+
+#endif
10+
#include <sys/sysctl.h>
11+
#include <sys/tty.h>
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--- src/lib/libast/features/mmap.orig 2020-02-08 10:39:38.000000000 -0800
2+
+++ src/lib/libast/features/mmap 2020-02-08 20:49:37.791733000 -0800
3+
@@ -16,14 +16,7 @@
4+
5+
#define Failed(file) (remove(file),1)
6+
7+
- int
8+
- #if _STD_
9+
- main(int argc, char** argv)
10+
- #else
11+
- main(argc,argv)
12+
- int argc;
13+
- char** argv;
14+
- #endif
15+
+ int main(int argc, char** argv)
16+
{
17+
caddr_t mm;
18+
char *t, *u, *f;
19+
@@ -326,17 +319,12 @@
20+
cat{
21+
22+
/* some systems get it wrong but escape concise detection */
23+
- #ifndef _NO_MMAP
24+
#if __CYGWIN__
25+
#define _NO_MMAP 1
26+
#endif
27+
- #endif
28+
29+
#if _NO_MMAP
30+
#undef _lib_mmap
31+
#undef _lib_mmap64
32+
- #undef _mmap_anon
33+
- #undef _mmap_devzero
34+
- #undef _mmap_worthy
35+
#endif
36+
}end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- src/lib/libast/features/standards.orig 2020-02-08 10:39:38.000000000 -0800
2+
+++ src/lib/libast/features/standards 2020-02-08 21:58:23.687268000 -0800
3+
@@ -1,5 +1,19 @@
4+
set stdio
5+
-if tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
6+
+# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit*
7+
+# functionality to known API; they don't enable anything. The general intent in
8+
+# BSD is to enable everything by default (effectively, providing the
9+
+# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay
10+
+# careful that we don't get fooled by presence of FreeBSD that underpins some
11+
+# subsystems in Mac OS X; there are other Apple-specific portability hacks
12+
+# elsewhere we should not interfere with.
13+
+if tst note{ FreeBSD }end compile{
14+
+ #include <sys/param.h>
15+
+ #if !defined(__FreeBSD__) || defined(APPLE)
16+
+ #error not a FreeBSD system
17+
+ #endif
18+
+ }end {
19+
+ }
20+
+elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
21+
#define _ALL_SOURCE 1
22+
#define _POSIX_SOURCE 1
23+
#define _POSIX_C_SOURCE 21000101L
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- src/lib/libast/features/vmalloc.orig 2016-02-28 17:09:23 UTC
2+
+++ src/lib/libast/features/vmalloc
3+
@@ -217,7 +217,4 @@ cat{
4+
#if _mmap_anon
5+
#define _mem_mmap_anon 1
6+
#endif
7+
- #if _mmap_devzero
8+
- #define _mem_mmap_zero 1
9+
- #endif
10+
}end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- src/lib/libast/features/wchar.orig 2017-11-30 22:35:04 UTC
2+
+++ src/lib/libast/features/wchar
3+
@@ -6,6 +6,7 @@ set include .
4+
cat{
5+
#ifndef _AST_WCHAR_H
6+
#define _AST_WCHAR_H 1
7+
+ #define _STDFILE_DECLARED
8+
}end
9+
10+
lib mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- src/lib/libast/port/astcopy.c.orig 2016-02-28 17:09:23 UTC
2+
+++ src/lib/libast/port/astcopy.c
3+
@@ -30,14 +30,10 @@
4+
#include <ast.h>
5+
#include <ast_mmap.h>
6+
7+
-#if _mmap_worthy > 1
8+
-
9+
#include <ls.h>
10+
11+
#define MAPSIZE (1024*256)
12+
13+
-#endif
14+
-
15+
#undef BUFSIZ
16+
#define BUFSIZ 4096
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- src/lib/libast/sfio/sfhdr.h.orig 2016-02-28 17:09:23 UTC
2+
+++ src/lib/libast/sfio/sfhdr.h
3+
@@ -209,9 +209,6 @@
4+
5+
/* see if we can use memory mapping for io */
6+
#if _LARGEFILE64_SOURCE && !_lib_mmap64
7+
-#undef _mmap_worthy
8+
-#endif
9+
-#if !_mmap_worthy
10+
#undef _hdr_mman
11+
#undef _sys_mman
12+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- src/lib/libast/sfio/sfseek.c.orig 2020-02-08 10:39:38.000000000 -0800
2+
+++ src/lib/libast/sfio/sfseek.c 2020-02-09 20:01:11.420655000 -0800
3+
@@ -204,18 +204,9 @@
4+
#ifdef MAP_TYPE
5+
if(f->bits&SF_MMAP)
6+
{ /* if mmap is not great, stop mmaping if moving around too much */
7+
-#if _mmap_worthy < 2
8+
- if((f->next - f->data) < ((f->endb - f->data)/4) )
9+
- { SFSETBUF(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
10+
- hardseek = 1; /* this forces a hard seek below */
11+
- }
12+
- else
13+
-#endif
14+
- { /* for mmap, f->here can be virtual except for hardseek */
15+
- newpos(f,p);
16+
- if(!hardseek)
17+
- goto done;
18+
- }
19+
+ newpos(f,p);
20+
+ if(!hardseek)
21+
+ goto done;
22+
}
23+
#endif
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
--- src/lib/libast/string/strexpr.c.orig 2017-11-30 22:35:04 UTC
2+
+++ src/lib/libast/string/strexpr.c
3+
@@ -44,7 +44,7 @@
4+
#define peekchr(ex) (*(ex)->nextchr)
5+
#define ungetchr(ex) ((ex)->nextchr--)
6+
7+
-#define error(ex,msg) return(seterror(ex,msg))
8+
+#define err(ex,msg) return(seterror(ex,msg))
9+
10+
typedef struct /* expression handle */
11+
{
12+
@@ -87,7 +87,7 @@ expr(register Expr_t* ex, register int p
13+
case 0:
14+
ungetchr(ex);
15+
if (!precedence) return(0);
16+
- error(ex, "more tokens expected");
17+
+ err(ex, "more tokens expected");
18+
case '-':
19+
n = -expr(ex, 13);
20+
break;
21+
@@ -113,17 +113,17 @@ expr(register Expr_t* ex, register int p
22+
case 0:
23+
goto done;
24+
case ')':
25+
- if (!precedence) error(ex, "too many )'s");
26+
+ if (!precedence) err(ex, "too many )'s");
27+
goto done;
28+
case '(':
29+
n = expr(ex, 1);
30+
if (getchr(ex) != ')')
31+
{
32+
ungetchr(ex);
33+
- error(ex, "closing ) expected");
34+
+ err(ex, "closing ) expected");
35+
}
36+
gotoperand:
37+
- if (operand) error(ex, "operator expected");
38+
+ if (operand) err(ex, "operator expected");
39+
operand = 1;
40+
continue;
41+
case '?':
42+
@@ -140,7 +140,7 @@ expr(register Expr_t* ex, register int p
43+
if (getchr(ex) != ':')
44+
{
45+
ungetchr(ex);
46+
- error(ex, ": expected for ? operator");
47+
+ err(ex, ": expected for ? operator");
48+
}
49+
if (n)
50+
{
51+
@@ -189,7 +189,7 @@ expr(register Expr_t* ex, register int p
52+
break;
53+
case '=':
54+
case '!':
55+
- if (peekchr(ex) != '=') error(ex, "operator syntax error");
56+
+ if (peekchr(ex) != '=') err(ex, "operator syntax error");
57+
if (precedence > 7) goto done;
58+
getchr(ex);
59+
x = expr(ex, 8);
60+
@@ -237,7 +237,7 @@ expr(register Expr_t* ex, register int p
61+
if (precedence > 11) goto done;
62+
x = expr(ex, 12);
63+
if (c == '*') n *= x;
64+
- else if (x == 0) error(ex, "divide by zero");
65+
+ else if (x == 0) err(ex, "divide by zero");
66+
else if (c == '/') n /= x;
67+
else n %= x;
68+
break;
69+
@@ -246,15 +246,15 @@ expr(register Expr_t* ex, register int p
70+
pos = --ex->nextchr;
71+
if (isdigit(c)) n = strton(ex->nextchr, &ex->nextchr, NiL, 0);
72+
else if (ex->convert) n = (*ex->convert)(ex->nextchr, &ex->nextchr, ex->handle);
73+
- if (ex->nextchr == pos) error(ex, "syntax error");
74+
+ if (ex->nextchr == pos) err(ex, "syntax error");
75+
goto gotoperand;
76+
}
77+
if (ex->errmsg) return(0);
78+
- if (!operand) error(ex, "operand expected");
79+
+ if (!operand) err(ex, "operand expected");
80+
}
81+
done:
82+
ungetchr(ex);
83+
- if (!operand) error(ex, "operand expected");
84+
+ if (!operand) err(ex, "operand expected");
85+
return(n);
86+
}
87+

‎shells/ksh93/pkg-plist

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
@shell bin/ksh%%93%%
2-
bin/shcomp%%93%%
32
man/man1/ksh%%93%%.1.gz
3+
share/examples/ksh93/dirs
4+
share/examples/ksh93/popd
5+
share/examples/ksh93/pushd
6+

0 commit comments

Comments
 (0)
Please sign in to comment.