Skip to content

Commit

Permalink
Remove SHOPT_SYSRC probe, enable by default
Browse files Browse the repository at this point in the history
It's just not right that it depends on the presence of
/etc/ksh.kshrc or even /etc/bash.bashrec on the build machine
whether /etc/ksh.kshrc is going to be loaded at startup on the
users' machine.

src/cmd/ksh93/Mamfile:
- Remove SHOPT_SYSRC probe code.

src/cmd/ksh93/SHOPT.sh:
- Enable SHOPT_SYSRC by default.

README.md:
- Document that SHOPT_SYSRC should be disabled on systems with a
  default incompatible /etc/ksh.kshrc.

Resolves: #776
  • Loading branch information
McDutchie committed Sep 3, 2024
1 parent fda0454 commit 08ae35b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ For known issues in the current release, see [TODO](https://github.com/ksh93/ksh
To build ksh with a custom configuration of features, edit
[`src/cmd/ksh93/SHOPT.sh`](https://github.com/ksh93/ksh/blob/1.0/src/cmd/ksh93/SHOPT.sh).

On systems such as NetBSD and OpenBSD, where `/bin/ksh` is not ksh93 and the
preinstalled `/etc/ksh.kshrc` profile script is incompatible with ksh93, you'll
want to disable `SHOPT_SYSRC` to avoid loading it on startup -- unless you can
edit it to make it compatible with ksh93. This geneerally involves differences
in the declaration and usage of local variables in functions.

Then `cd` to the top directory and run:

```
Expand Down
5 changes: 0 additions & 5 deletions src/cmd/ksh93/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ make install virtual
exec - -zutalors)
exec - writedef PRINTF_LEGACY 1 ;;
exec - esac ;;
exec - 'SYSRC=')
exec - # if one of these exists, make SHOPT_SYSRC load /etc/ksh.kshrc by default
exec - if test -f /etc/ksh.kshrc || test -f /etc/bash.bashrc
exec - then writedef SYSRC 1
exec - fi ;;
exec - # some other SHOPTs may be probed for using feature tests in features/options
exec - *=?*)
exec - writedef "$n" "$v" ;;
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/ksh93/README
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ The options have the following defaults and meanings:

STATS on Add .sh.stats compound variable.

SYSRC Source /etc/ksh.kshrc on initializing an interactive
shell. This is on by default if /etc/ksh.kshrc or
/etc/bash.bashrc exists at compile time.
SYSRC on Source /etc/ksh.kshrc on initializing an interactive
shell.

TEST_L Add 'test -l' as an alias for 'test -L'. This is on by
default if the OS's external 'test' command supports it.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/SHOPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SHOPT REMOTE= # enable --rc if running as a remote shell
SHOPT SCRIPTONLY=0 # build ksh for running scripts only; compile out the interactive shell
SHOPT SPAWN= # use spawnveg for fork/exec
SHOPT STATS=1 # add .sh.stats variable
SHOPT SYSRC= # attempt . /etc/ksh.kshrc if interactive
SHOPT SYSRC=1 # attempt . /etc/ksh.kshrc if interactive
SHOPT TEST_L= # add 'test -l' as an alias for 'test -L'
SHOPT TIMEOUT= # number of seconds for shell timeout
SHOPT VSH=1 # vi edit mode

0 comments on commit 08ae35b

Please sign in to comment.