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

Fix compiler error on OS X 10.6 #1465

Closed
wants to merge 3,402 commits into from
Closed

Fix compiler error on OS X 10.6 #1465

wants to merge 3,402 commits into from

Conversation

krader1961
Copy link
Contributor

Mac OS X 10.6 (Snow Leopard) causes symbol ERROR_dictionary in
src/lib/libdll/dlfcn.c to be evaluated. Since that symbol isn't defined it
results in a compilation error. Add the identity mapping that is present
in the rest of the source code.

Fixes #1462

krader1961 and others added 30 commits August 26, 2019 22:24
This is the very first step in resolving issue #507. It moves the text for
the documentation of a single command out of the source code and into a
standalone text file. It sets up the framework for converting such files
back into C source for use by the optget() function.

Related #507
This builds on the prior change to extricate builtin command documentation
out of the source and into an external text file for each command.
Which is the next step into converting the documentation to a modern
markup language.

Related #507
This is to facilitate extracting the command documentation into text
files separate from the source code.

Related #507
Move the libcmd builtin documentation into files separate from the
source code.

Related #507
Move the code for `b_readonly()` into its own module. Refactor it so
that the `readonly` and `export` commands only share the `setall()`
function.
This also moves `b_unalias()` into the same module. TBD is refactoring
the code to move the option parsing out of the `unall()` function and
into the respective `b_*()` functions.
Builds on Copr and OBS were failing because `print_scan()` function
definition was not prefixed with `static_fn`.
Recently builtins were moved into separate modules. It broke builds in
Copr and OBS. `print_scan()` function should be declared non-static as
it's used in more than one file. Fix made in previous commit was
incorrect.
Move each of the `bg`, `fg`, and `disown` implementations into separate
modules.
Move each command implementation into its own module.
Separate the break/continue and return/exit implementations into separate
modules to improve clarity. This increases the size of the binary by a
few words but that is well worth it for the improved clarity.
Separate the `cd` and `pwd` implementations into separate modules to
improve code clarity.
With this change all special builtins are now in their own source
module. More importantly this eliminates a lot of cleverness that
obfuscates the actual behavior.
Update fallback version to `2020.0.0-beta1`
We want to be able to separate `b_trap()` and `b_kill()` into separate
source modules. This is a step towards doing so.
The default `od` output format varies depending on the platform. Force
output of octal bytes. Also, eliminate the `head -n1` and tighten up the
matching regex.
Recent changes require a `ninja install` step before `meson test`.
Update the documentation.
The core of this change is moving this statement after the `err:` label:

    if (isfun && fd >= 0) sh_close(fd);

While fixing that I also decided to refactor the function to make the
primary logic of `can_execute()` clearer.

Coverity CID#353337
The default `od` output format varies depending on the platform. Force
output of octal bytes. Also, eliminate the `head -n1` and tighten up the
matching regex. This is the same fix as commit 031d73a but for a
different unit test.
This fixes one, false positive, failure on Cygwin and simplifies and
clarifies that test logic.
This change is a hack. It will be moot once the remaining three uses of
optget() are modified to use optget_long(). But it's a straightforward
way to get the correct version string when running `ksh --version`.

Fixes #1456
The `getconf` command hasn't been a builtin for a long time. No known, non
AST implementation, supports `getconf LIBPATH`. So remove that pointless
test code.
Some platforms (e.g., OpenBSD) allow pretty much any locale string. And it
is not clear why it is the responsibility of ksh to issue a diagnostic if
an invalid locale is specified by the user. Or why we should be testing
for this situation. Even ksh93u+, which uses the AST locale subsystem,
doesn't produce a diagnostic message when doing `LC_CTYPE=xyz.UTF-8`
on OpenBSD. This is a follow up to commit 6b6146e.
Also, simplify the affected test by removing extraneous items.
The test being removed only passes because of the trailing `exit 0`.
Even with ksh93u+ the preceding two commands fail on all platforms I
have access to.
This doesn't change any behavior or fix any bug. It simply clarifies the
behavior of a unit test. See #1457

Rleated #1457
I noticed this while reviewing OpenSuse patches that included this,
pointless, change:

-const char e_crondir[]         = "/usr/spool/cron/atjobs";
+const char e_crondir[]         = "/var/spool/cron";
This is adapted from the ksh93-optimizeleak.dif included with the OpenSuse
ksh source. I confirmed the inner condition is true some of the time and
the early return does not break any unit tests.
The old AST team implementation of an improved `cd` command has several
problems when enabled for every interactive shell. Not least of which
is that the approach of using an alias does not allow it to be, easily,
overriden by a user defined `cd` function. It also fails to preserve some
builtin `cd` command behavior. There may be other problems this doesn't
fix. This is an experiment to see if we can augment commands like `cd`
without having to write all behavior in the C language.  Something other
shells, like fish, have managed for more than a decade.

Fixes #1445
Don't use global vars for the private data used by the cd related
functions (pushd, nextd, etc.). Move them into the `.sh` namespace.

Related #1445
People (and distros) have been building ksh from this project using the
default "debug" build type since we switched from Nmake to Meson. That
results in a ksh program whose performance is far from optimal. So change
the default build type. If a debugging enabled binary is needed, such as
in a CI environment, it must be requested explicitly.

Related #1449
The typo is harmless since the string is not used for anything but fix
it since it is wrong and confusing.
Mac OS X 10.6 (Snow Leopard) causes symbol `ERROR_dictionary` in
src/lib/libdll/dlfcn.c to be evaluated. Since that symbol isn't defined it
results in a compilation error. Add the identity mapping that is present
in the rest of the source code.

Fixes #1462
@krader1961
Copy link
Contributor Author

@ryandesign I booted my ancient OS X 10.6 VM but it isn't able to install Meson using the Homebrew environment it already had. Sorry, I know that using Homebrew rather than MacPorts is heretical. 😄 Is it possible for you to verify that this change fixes the build for you? If not I'll just merge it and you can then report back if it didn't fix the build for you.

@krader1961
Copy link
Contributor Author

Why haven't the new owners of this project closed this pull-request? Could it be because they aren't competent to manage this project? Nah, that can't possibly be the reason. /snark

I also wonder what they intend to do with issue #1462 that resulted in this P.R.

@gordonwoodhull
Copy link
Contributor

In any case, the PR is only relevant to ksh2020.

@gordonwoodhull
Copy link
Contributor

@krader1961, we at AT&T are not actively maintaining this repo - everyone should fork from here if they want to continue development.

Thanks for pointing out that this PR should be closed as part of #1466. I hope that you will take your fork of ksh to a new repo, or that others who prefer ksh2020 will continue your work if you are no longer interested.

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.

error: implicit declaration of function 'ERROR_dictionary' is invalid in C99