Skip to content

Commit

Permalink
AT&T AST (att/ast) on github has rewound their repo back to ksh93u+. See
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cschuber authored and kwm81 committed Feb 24, 2020
1 parent 59827a2 commit 5f23d48
Show file tree
Hide file tree
Showing 16 changed files with 319 additions and 131 deletions.
59 changes: 45 additions & 14 deletions shells/ksh93/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# $FreeBSD$

# Make sure that your configuration DOES NOT set ANY gcc-related
# variables. ksh93 will not compile if you set even the seemingly
# most unrelated variable related to gcc configuration. This means
# especially any flag which attempts to set the cputype. Setting the
# cputype does absolutely nothing except cause systems to fail in
# horrible ways. For any modern processor, setting the cputype only
# serves to expose gcc bugs and does nothing to speed up any known
# program. If you are really unconvinced, go ahead but do not
# complain to me about it.

# Do not update this port to 93v. 93v was an abandoned beta when
# David Korn left the project. It was subsequently reverted to 93u.
# https://github.com/att/ast/issues/1466#issuecomment-589942449

PORTNAME= ksh93
DISTVERSION= 2020.0.1
DISTVERSION= 93u
PORTREVISION= 1
PORTEPOCH= 1
PORTEPOCH= 2
CATEGORIES= shells
DIST_SUBDIR= ksh93

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

LICENSE= EPL

USES= compiler:c11 meson ninja python:build
BROKEN_aarch64= Fails to compile: needs sbrk

USES= compiler:c11

USE_GITHUB= yes
GH_ACCOUNT= att
Expand All @@ -20,15 +37,18 @@ GH_PROJECT= ast
KSH_CONFLICTS= pdksh-*
KSH93_CONFLICTS= ksh93-devel-* ast-ksh-*

MESON_BUILD_DIR= build

OPTIONS_DEFAULT= KSH93
OPTIONS_DEFAULT= KSH93 EXAMPLES
OPTIONS_DEFINE= EXAMPLES STATIC
OPTIONS_SINGLE= BIN_KSH
OPTIONS_SINGLE_BIN_KSH= KSH KSH93
KSH_DESC= Install to ${PREFIX}/bin/ksh
KSH93_DESC= Install to ${PREFIX}/bin/ksh93

KSH93_EXTRA_PATCHES= ${FILESDIR}/extra-patch-install-as-ksh93
CFLAGS+= -DMAP_TYPE
LDFLAGS+= -lm
MAKE_ENV= CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses" CFLAGS="${CFLAGS}"

STATIC_MAKE_ENV= LDFLAGS+=-static

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

post-patch:
@${REINPLACE_CMD} -e '/for name in/ s|python.*|${PYTHON_CMD}|g' ${WRKSRC}/scripts/python.sh
@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
.if ${PORT_OPTIONS:MKSH93}
@${MV} ${WRKSRC}/src/cmd/ksh93/docs/ksh.1 ${WRKSRC}/src/cmd/ksh93/docs/ksh93.1
.endif
.if ${PORT_OPTIONS:MKSH}
@# Keep portlint happy
PNAME= ksh93
.else
PNAME= ksh
.endif

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 ksh93

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${STAGEDIR}${PREFIX}/bin/${PNAME}
${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/${PNAME}.1
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${STAGEDIR}${EXAMPLESDIR}/

do-test:
cd ${WRKSRC}/src/cmd/ksh93/tests/ && ${SETENV} SHELL=${WRKSRC}/bin/ksh ${WRKSRC}/bin/ksh shtests

.include <bsd.port.post.mk>
6 changes: 3 additions & 3 deletions shells/ksh93/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1578621862
SHA256 (att-ast-2020.0.1_GH0.tar.gz) = dc022c80021bbe27aabcdcd90cc5caeabff1955cf5fdfcc32ebd410b0da141be
SIZE (att-ast-2020.0.1_GH0.tar.gz) = 2023438
TIMESTAMP = 1582352303
SHA256 (ksh93/att-ast-93u_GH0.tar.gz) = 4cf10ae50306361a18d900008961093b5c2c51d69f4e50d14b911a8ce014d37f
SIZE (ksh93/att-ast-93u_GH0.tar.gz) = 12960931
25 changes: 0 additions & 25 deletions shells/ksh93/files/extra-patch-install-as-ksh93

This file was deleted.

78 changes: 0 additions & 78 deletions shells/ksh93/files/patch-ksh-2020.0.0-cve-2019-14868.patch

This file was deleted.

10 changes: 0 additions & 10 deletions shells/ksh93/files/patch-scripts_builtin_documentation.sh

This file was deleted.

36 changes: 36 additions & 0 deletions shells/ksh93/files/patch-src_cmd_std_features_procfs
Original file line number Diff line number Diff line change
@@ -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

12 changes: 12 additions & 0 deletions shells/ksh93/files/patch-src_cmd_std_pss-kvm.c
Original file line number Diff line number Diff line change
@@ -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>

36 changes: 36 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_features_mmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- src/lib/libast/features/mmap.orig 2020-02-08 10:39:38.000000000 -0800
+++ src/lib/libast/features/mmap 2020-02-08 20:49:37.791733000 -0800
@@ -16,14 +16,7 @@

#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 *t, *u, *f;
@@ -326,17 +319,12 @@
cat{

/* 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
#endif
}end
23 changes: 23 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_features_standards
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- src/lib/libast/features/standards.orig 2020-02-08 10:39:38.000000000 -0800
+++ src/lib/libast/features/standards 2020-02-08 21:58:23.687268000 -0800
@@ -1,5 +1,19 @@
set stdio
-if tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ 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{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
#define _ALL_SOURCE 1
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 21000101L
10 changes: 10 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_features_vmalloc
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_features_wchar
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_port_astcopy.c
Original file line number Diff line number Diff line change
@@ -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

12 changes: 12 additions & 0 deletions shells/ksh93/files/patch-src_lib_libast_sfio_sfhdr.h
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 5f23d48

Please sign in to comment.