Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches to compile on FreeBSD (2017-10-14) #19

Closed
wants to merge 4 commits into from
Closed

Conversation

saper
Copy link
Contributor

@saper saper commented Jul 19, 2016

RELEASE notes for src/cmd/ksh93/RELEASE

16-07-17  --- Release ksh93v- ---
16-07-17  A fix to avoid "non-void function 'ls' should return a value" error.
16-07-17  Some patches for compilation on FreeBSD have been added.

Credit goes to Robert S. Krzaczek

krz8 and others added 3 commits July 13, 2016 23:26
From the ast-open post on 3 Apr 2014:

Below are a small set of patches that should restore a full build of
ast-open to FreeBSD 9. I'm still quite new to iffe, though, so if
there are better ways to do what I've done below, please don't
hesitate to let me know. So much of my work (both professional and
personal) uses ast-open heavily, and this seems like the very least I
can do. To be clear, the build succeeds, but they don't cleanly pass
all regression tests
@dannyweldon
Copy link

Do we know if this still builds okay on Linux with these changes? It looks like travis has not built it because it only builds commits made after travis has been enabled for the repo.

@saper
Copy link
Contributor Author

saper commented Jul 1, 2017

I have amended the commit and pushed again, let's see...

@saper saper changed the title Patches to compile on FreeBSD (2016-07-17) Patches to compile on FreeBSD (2017-10-14) Oct 14, 2017
@krader1961
Copy link
Contributor

FYI, This plus PR #76 allows everything but dlls and pax to be built on macOS Sierra (10.12.6) I recommend merging it.

@siteshwar
Copy link
Contributor

I will have to clean up and rearrange the commits before I merge this one.

@saper
Copy link
Contributor Author

saper commented Oct 26, 2017

@siteshwar thank you, yes, this is a quick dump of what "works for me" to share, but it should be cleaned up

@krader1961
Copy link
Contributor

I should have looked more closely at this before I made my changes to fix building ksh93 on macOS (a BSD derivative). At this point the only part of this PR not already merged simply changes the version number. Something I don't think should be necessary. We shouldn't have to manually update the version every time a commit is merged. It's worthwhile to have the version reflect the commit the build is based on but that should be done dynamically at build time by extracting the git head commit ID or tag.

Sorry this languished so long, @saper.

@krader1961 krader1961 closed this Oct 28, 2017
@saper
Copy link
Contributor Author

saper commented Oct 31, 2017

I have bumped the version number to create my own ksh93 release, since the upstream seemed pretty much dead. I found it useful to add some comments in the release notes.

McDutchie added a commit to ksh93/ksh that referenced this pull request Jan 18, 2021
This now makes ksh build on DragonFly BSD.

src/cmd/ksh93/sh/main.c,
src/cmd/ksh93/tests/basic.sh:
- fixargs() doesn't work on DragonFly either
  (re: 9b7c392, 159fb9e, cefe087).

The following are backported from:
att#26 (comment)
att#19

src/lib/libast/comp/setlocale.c:
- Add missing #include <errno.h> since errno is used.

src/lib/libast/features/standards:
- Do not set any standards macros (_POSIX_SOURCE etc) on FreeBSD or
  DragonflyBSD; they disable too much functionality on those.

src/lib/libast/features/wchar:
- Set _STDFILE_DECLARED on DragonFly, too.

src/lib/libast/include/sfio.h,
src/lib/libast/include/sfio_t.h,
src/lib/libast/sfio/_sfopen.c,
src/lib/libast/sfio/sfclrlock.c,
src/lib/libast/sfio/sfhdr.h,
src/lib/libast/sfio/sfnew.c,
src/lib/libast/sfio/sfset.c:
- Rename SF_* macros to SFIO_* to avoid a conflict with system
  headers.

src/lib/libast/string/strexpr.c:
- Rename error() to err() to avoid a conflict.
McDutchie added a commit to ksh93/ksh that referenced this pull request Jan 18, 2021
This now makes ksh build on DragonFly BSD.

bin/package, src/cmd/INIT/package.sh:
- DragonFly also needs the -lm hack for LDFLAGS.

src/cmd/ksh93/sh/main.c, src/cmd/ksh93/tests/basic.sh:
- fixargs() doesn't work on DragonFly either
  (re: 9b7c392, 159fb9e, cefe087).

The following are backported from:
att#26 (comment)
att#19

src/lib/libast/comp/setlocale.c:
- Add missing #include <errno.h> since errno is used.

src/lib/libast/features/standards:
- Do not set any standards macros (_POSIX_SOURCE etc) on FreeBSD or
  DragonflyBSD; they disable too much functionality on those.

src/lib/libast/features/wchar:
- Set _STDFILE_DECLARED on DragonFly, too.

src/lib/libast/include/sfio.h, src/lib/libast/include/sfio_t.h,
src/lib/libast/sfio/_sfopen.c, src/lib/libast/sfio/sfclrlock.c,
src/lib/libast/sfio/sfhdr.h, src/lib/libast/sfio/sfnew.c,
src/lib/libast/sfio/sfset.c:
- Rename SF_* macros to SFIO_* to avoid a conflict with system
  headers.

src/lib/libast/string/strexpr.c:
- Rename error() to err() to avoid a conflict.
McDutchie added a commit to ksh93/ksh that referenced this pull request Jan 18, 2021
This now makes ksh build on DragonFly BSD.

bin/package, src/cmd/INIT/package.sh:
- DragonFly also needs the -lm hack for LDFLAGS.

src/cmd/ksh93/sh/main.c, src/cmd/ksh93/tests/basic.sh:
- fixargs() doesn't work on DragonFly either
  (re: 9b7c392, 159fb9e, cefe087).

The following are backported from:
att#26 (comment)
att#19

src/lib/libast/comp/setlocale.c:
- Add missing #include <errno.h> since errno is used.

src/lib/libast/features/standards:
- Do not set any standards macros (_POSIX_SOURCE etc) on FreeBSD or
  DragonflyBSD; they disable too much functionality on those.

src/lib/libast/features/wchar:
- Set _STDFILE_DECLARED on DragonFly, too.

src/lib/libast/include/sfio.h, src/lib/libast/include/sfio_t.h,
src/lib/libast/sfio/_sfopen.c, src/lib/libast/sfio/sfclrlock.c,
src/lib/libast/sfio/sfhdr.h, src/lib/libast/sfio/sfnew.c,
src/lib/libast/sfio/sfset.c:
- Rename SF_* macros to SFIO_* to avoid a conflict with system
  headers.

src/lib/libast/string/strexpr.c:
- Rename error() to err() to avoid a conflict.
citrus-it pushed a commit to citrus-it/ast that referenced this pull request Apr 15, 2021
Ksh was not checking for `command` when running a special builtin,
which caused preceding invocation-local variable assignments to
become global. This is the reproducer from the att#72:

$ foo=BUG command eval ':'
$ echo "$foo"

This no longer prints 'BUG', as ksh now makes sure the command builtin
is not running a special builtin before making invocation-local
variable assignments global.

src/cmd/ksh93/sh/xec.c:
 - Backport the bugfix for BUG_CMDSPASGN from ksh93v- 2013-10-10-alpha.

src/cmd/ksh93/tests/builtins.sh:
 - Add a regression test based on the reproducer in att#72.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants