Commit Graph

68 Commits

Author SHA1 Message Date
Timothy Sample 597a6bcfb1 Touch up metadata and copyright notices.
* build-aux/gitlab-ci.yml,
build-aux/pre-inst-env.in,
configure.ac,
test.sh,
tests/spec/Makefile.am,
tests/spec/check-spec: Add copyright notices and GPLv3+ license notice.
* guix.scm: Add a "special exception" permissive license notice.
* doc/syntax.txt: Add title, introduction, copyright notice, and a
simple all-permissive license.
* COPYING.CC0: New file.
* NEWS: Reformat and add CC0 license notice.
* README: Add CC0 license notice.
* Makefile.am: Add copyright notices and GPLv3+ license notice.
(EXTRA_DIST): Add COPYING.CC0.
2019-05-22 00:44:39 -04:00
Timothy Sample eaf8b5da61 Make sure that the tarball has everything.
* Makefile.am (distcheck-hook): New target.
2019-05-22 00:44:39 -04:00
Timothy Sample a4efd9359e Use Automake recipes from Guile.
* build-aux/guile-rules.am: Delete file.
* build-aux/guile.am: New file.
* .gitignore: Do not ignore it.
* Makefile.am: Adapt variable names to the new file.
2019-05-22 00:44:39 -04:00
Timothy Sample ad73b36116 Fix 'make distclean'.
* Makefile.am (distclean-local): Run 'make distclean' for the
specification tests.
2019-05-22 00:44:33 -04:00
Timothy Sample 95545c9269 Fix building from an external directory.
* Makefile.am (scripts/gash): Make sure the 'scripts' directory exists
in the build tree.
(SH_LOG_COMPILER): Call 'test.sh' from the source tree.
* test.sh: Change the default test shell from 'scripts/gash' to
'gash'; export a 'TEST_TMP' variable that tells tests where to store
temporary files; and make sure all output is written to the build
directory.
tests/50-redirect-append.sh: Use the 'TEST_TMP' variable.
tests/60-subst.sh: Ditto.
2019-05-20 18:07:47 -04:00
Timothy Sample 0c57fc9ef9 Move 'textual-ports' under 'compat'.
* gash/textual-ports.scm: Move this...
* gash/compat/textual-ports.scm: ...here.
* Makefile.am, gash/lexer.scm, gash/parser.scm, gash/shell.scm,
tests/unit/shell.scm: Update references.
2019-05-20 18:07:47 -04:00
Timothy Sample 878b9c3dca Add support for Guile 2.0.9.
* gash/compat.scm: New file.
* gash/compat/hash-table.scm: New file.
* Makefile.am: Add them.
* .dir-locals.scm: Add indentation for 'if-guile-version-below'.
* guix.scm (guile-2.0.9): New variable.
* gash/built-ins/echo.scm (escape->control): Use '#\esc'.
* gash/environment.scm: Use '(gash compat hash-table)'.
* gash/built-ins/break.scm,
gash/built-ins/cd.scm,
gash/built-ins/command.scm,
gash/built-ins/continue.scm,
gash/built-ins/dot.scm,
gash/built-ins/exec.scm,
gash/built-ins/exit.scm,
gash/built-ins/pwd.scm,
gash/built-ins/return.scm,
gash/built-ins/set.scm,
gash/built-ins/shift.scm,
gash/built-ins/trap.scm,
gash/built-ins/type.scm,
gash/built-ins/umask.scm,
gash/eval.scm,
tests/unit/automake.scm: Use '(gash compat)'.

squash! Add support for Guile 2.0.9.
2019-05-20 18:07:47 -04:00
Timothy Sample c61b1d6fef Make the Guix package work without Git.
This commit generates a '.tarball-manifest' file that gets placed in
the distribution tarball and simply lists all the files that are in
the Git tree.  It is used to determine which files should be
considered source files when building the package using Guix.

* guix.scm (make-select): Fall back on reading from
'.tarball-manifest' if a Git repository is not available.
2019-05-20 18:07:47 -04:00
Timothy Sample 511dae3577 Add missing files to the distribution tarball.
* Makefile.am (EXTRA_DIST): Add various scripts, metadata, helpful
files, and tests.
2019-05-20 18:07:47 -04:00
Timothy Sample fcf32d1cad Setup documentation generation.
* Makefile.am (info_TEXINFOS, gash_TEXINFOS): New targets.
* guix.scm: Add 'texinfo' to build inputs.
* doc/gash.info: Delete file.
* .gitignore: Ignore generated documentation files.
2019-05-20 18:07:47 -04:00
Timothy Sample 2e51c3f9ab Add missing tests to the Makefile.
* Makefile.am (FULL_TESTS): Add tests/05-assignment-backtick.sh,
tests/10-if-line.sh, tests/10-if-redirect.sh, and
tests/20-pipe-sed-cat.sh.
2019-05-20 18:07:47 -04:00
Timothy Sample ea7266e8f1 Add missing '.PHONY' indicator to Makefile.
* Makefile.am (test-list): Mark as phony.
2019-05-20 18:07:32 -04:00
Timothy Sample 0f6eb40f44 Reorder Makefile and add section comments.
* Makefile.am: Reorder rules and add section header comments to
make the structure clear.
2019-05-20 01:18:54 -04:00
Timothy Sample 315815bbd6 Factor out and update the usual Guile rules.
* build-aux/guile-rules.am: New file.
* .gitignore: Do not ignore it.
* Makefile.am: Include it, remove the rules it replaces, update
changed variable names, and use appending for 'EXTRA_DIST' and
'CLEANFILES'.
2019-05-20 01:18:54 -04:00
Timothy Sample 7c1c3ad5c8 Setup ChangeLog generation.
Use the 'gitlog-to-changelog' script from Gnulib to generate a
ChangeLog from the Git commit log when creating the distribution
tarball.

* build-aux/gitlog-to-changelog: New file.
* .gitignore: Do not ignore it.
* Makefile.am (gen-ChangeLog): New target.
(dist-hook): Depend on it.
* ChangeLog: New file.
2019-05-20 01:18:54 -04:00
Timothy Sample 55ba522d38 Delete test output files when cleaning.
* Makefile.am (CLEANFILES): Include the '.1' and '.2' output files
from the integration tests.
2019-05-20 01:18:54 -04:00
Timothy Sample e39abd1566 Stop 'make clean' from deleting tests.
* Makefile.am (CLEANFILES): Fix the string replacements so that useful
tests do not get deleted.
2019-05-20 01:18:54 -04:00
Timothy Sample ff34039b62 Remove unused modules.
* gash/builtins.scm,
gash/io.scm,
gash/job.scm,
gash/pipe.scm,
gash/script.scm,
gash/shell-utils.scm,
gash/util.scm: Delete files.
* Makefile.am: Remove them.
* gash/gash.scm (main, prompt): Remove calls to deleted job control
procedures.
2019-05-20 01:18:54 -04:00
Timothy Sample df43ca7215 Add support for Guile 2.0.
* configure.ac (GUILE_PKG): Add 2.0.
* gash/textual-ports.scm: New file.
* Makefile.am: Add it.
* gash/lexer.scm, gash/parser.scm, gash/shell.scm: Use it in place of
'(ice-9 textual-ports)'.
* tests/unit/shell.scm: Use it in place of '(ice-9 textual-ports)';
replace '(ice-9 textual-ports)' with '(rnrs io ports)' in sub-scripts;
and add a shim for 'setvbuf'.
2019-05-20 01:18:54 -04:00
Timothy Sample 10400ed2ad Remove PEG modules and the PEG-based parser.
* gash/grammar.scm,
gash/peg.scm,
gash/peg/cache.scm,
gash/peg/codegen.scm,
gash/peg/simplify-tree.scm,
gash/peg/string-peg.scm,
gash/peg/using-parsers.scm: Delete files.
Makefile.am: Remove them.
2019-05-20 01:18:54 -04:00
Timothy Sample 874d165b11 Remove the unused 'geesh' module.
* gash/geesh.scm: Delete file.
* Makefile.am: Do not compile it.
* gash/gash.scm (%geesh-parser?): Remove unused variable.
(parse, parse-string, file-to-ast): Remove unused procedures.
2019-05-20 01:18:54 -04:00
Jan Nieuwenhuizen 5b74c6426a echo: Implement escapes.
* gash/built-ins/echo.scm (escape->control): New function.
(echo): Support '-e' and '-E' options even when clumped.
* Makefile.am (XFAIL_TESTS): Remove tests/20-pipe-sed.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen 18aefdda18 tests: Add 100-test-false.sh.
* tests/100-test-false.sh: New file.
* Makefile.am (FULL_TESTS): Add it.
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen 06099ddead tests: Add 43-trap-subshell.sh.
* tests/43-trap-subshell.sh: New file.
* tests/43-trap-subshell.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/43-trap-subshell.sh.
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen 7640a09382 Support redirects with empty commands.
* gash/eval.scm (exp->thunk): Return 'noop' if 'exp' is '#f'.
* tests/50-redirect-clobber.sh: New file.
* tests/50-redirect-clobber.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-clobber.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:36 -04:00
Jan Nieuwenhuizen 13f43973f5 Do not export unset variables.
* gash/environment.scm (get-environ): Filter out unset variables.
* tests/42-sh-export-new.sh: New file.
* tests/42-sh-export-new.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/42-sh-export-new.sh.
(XFAIL_TESTS): Remove tests/42-export-new.sh and tests/42-sh-export.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:22 -04:00
Jan Nieuwenhuizen 2e4e078975 Fix some environment-dependent tests.
* gash/environment.scm (initial-variables): Add 'SHELL' and 'SHELLOPTS'.
* tests/100-cd.sh, tests/100-cd.stdout: Use '/tmp' instead of '/bin'.
* tests/50-redirect-in-out.sh, tests/50-redirect-space.sh,
tests/50-redirect.sh: Use '/tmp' and PID for temporary files.
* tests/50-redirect-sed.sh: Make sure 'DESTDIR' is unset and use
'/bin/GASH' in place of '/bin/gash'.
* tests/50-redirect-sed.stdout, tests/data/diff.scm: Use '/bin/GASH' in
place of '/bin/gash'.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-sed.sh,
tests/50-redirect-space.sh, and tests/100-cd.sh; remove
tests/50-redirect-merge.sh.
(BROKEN_TESTS): Remove tests/10-if-redirect.sh,
tests/50-redirect-sed.sh, tests/50-redirect-space.sh, and
tests/100-cd.sh; add tests/50-redirect-merge.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:07 -04:00
Jan Nieuwenhuizen 56610b0669 Add export test.
* tests/42-export-new.sh: New file.
* tests/42-export-new.stdout: New file.
* Makefile.am (FULL_TESTS, XFAIL_TESTS): Add 42-export-new.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:57 -04:00
Timothy Sample 1bd92e2893 Remove (almost) all references to Geesh.
gash/environment.scm: Remove file.
geesh/*: Move these files into the 'gash' folder and replace all
instances of the word 'geesh'.
scripts/geesh.in: Remove file.
HACKING, INSTALL, Makefile.am, configure.ac, guix.scm,
tests/bootstrap/bash-without-bash.scm, tests/spec/Makefile.am,
tests/spec/check-spec, tests/spec/oil.scm, tests/unit/*,
tools/coverage.in: Replace all instances of the word 'geesh'.

Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
2019-05-20 01:17:40 -04:00
Jan Nieuwenhuizen 7fcfe66407 Add the 'command' built-in.
* geesh/built-ins/command.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*built-ins*): Add 'command'.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:30 -04:00
Jan Nieuwenhuizen 57e8e3bd64 Add the 'type' built-in.
* geesh/built-ins/type.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*built-ins*): Add 'type'.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:22 -04:00
Jan Nieuwenhuizen cf5611f6d4 Replace geesh script with gash.
* geesh/repl.scm (run-repl): Add optional parse? parameter.
* gash/gash.scm (main): Rewrite to use Geesh parser and evaluator.
* scripts/geesh.in: Remove.
* Makefile.am: Remove scripts/geesh; adjust XFAIL_TESTS.
* .gitignore: Update.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:14 -04:00
Timothy Sample 171796317f Remove external commands.
* gash/bournish-commands.scm, gash/commands/*, gash/compress.scm,
gash/guix-utils.scm, gash/lzw.scm, gash/ustar.scm: Delete files.
* gash/builtins.scm, gash/gash.scm, gash/script.scm: Remove references
to deleted modules.
* tests/100-basename-*, tests/100-dirname-*, tests/100-sed-*,
tests/100-tar-*, tests/100-tr-*: Delete files.
* Makefile.am: Remove deleted modules and tests.
2019-05-16 10:49:38 -04:00
Timothy Sample 42f9fb2671 Stabilize test suite.
* test.sh: Increase test timeout from 1 to 10.
* Makefile.am (FULL_TESTS): Move tests/10-if-redirect.sh,
tests/50-redirect-space.sh, tests/50-redirect-sed.sh, and
tests/100-cd.sh from here...
(BROKEN_TESTS): ...to here.
2019-05-16 10:49:38 -04:00
Timothy Sample 117a33d18e Use Automake to run Gash tests.
* Makefile.am: Add Gash tests and use test.sh as the log compiler.
* test.sh: Use TEST_SHELL instead of SHELL to parameterize which shell
is being tested.
* tests/06-command-compound-word.sh: Adjust this test so that it works
even if the srcdir variable is set.
* .gitignore: Add tests/*.trs
2019-05-16 10:49:38 -04:00
Timothy Sample 7e8caba055 Build Gash with Autotools.
This commit allows most of Gash to be built with Autotools.  It also
removes some of the Gash build scripts.

* configure.ac: Add checks for compress, gzip, bzip2, and xz;
configure gash/config.scm.
* Makefile.am: Add Gash modules and the 'gash' script.
* scripts/gash.in: Rename 'guile_site_dir' to 'MODDIR' and
'guile_site_ccache_dir' to 'GODIR'.
* configure: Delete file.
* makefile: Delete file.
* build-aux/build-guile.sh: Delete file.
* build-aux/pre-inst-env.in: Delete file.
* build-aux/trace.sh: Delete file.
* .gitignore: Add configure; remove exceptions for the deleted
build-aux files.
2019-05-16 10:49:16 -04:00
Timothy Sample 110167674e Reorganize tests
* tests/bash-without-bash.scm: Move this...
* tests/bootstrap/bash-without-bash.scm: ...here.
* tests/*.scm*: Move these...
* tests/unit: ...into this directory.
* configure.ac: Update paths.
* Makefile.am: Ditto.
* .gitignore: Ditto.
2018-12-12 14:23:09 -05:00
Timothy Sample 15ae84bc58 Add test for bootstrapping Bash
* tests/bash-without-bash.scm: New file.
* Makefile.am (check-bootstrap): New target.
2018-12-05 22:21:30 -05:00
Timothy Sample acaaa3c322 Use git-version-gen for versioning
* build-aux/git-version-gen: New file.
* .gitignore: Do not ignore it.
* configure.ac: Use it to generate the version string.
* guix.scm: Ditto.
* Makefile.am: Make .tarball-version.
2018-12-05 22:17:41 -05:00
Timothy Sample 9fd1eb9edf Set search paths explicitly in the geesh script
* configure.ac: Do not treat scripts/geesh as an AC_CONFIG_FILE.
* Makefile.am: Do the substitutions here (at make-time).
* scripts/geesh.in: Update %load-path and %load-compiled-path
explicitly before loading anything.
2018-12-05 16:08:09 -05:00
Timothy Sample 79e5c6eafc Add the trap built-in
* geesh/built-ins/trap.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*special-built-ins*): Add trap.
2018-12-05 16:08:09 -05:00
Timothy Sample 3769dce584 Add the return and exit built-ins
* geesh/built-ins/return.scm: New file.
* geesh/built-ins/exit.scm: New file.
* geesh/Makefile.am: Add them.
* geesh/built-ins.scm (*special-built-ins*): Add return and exit.
2018-12-05 16:08:09 -05:00
Timothy Sample 2543ecd2bb Add the exec built-in
* geesh/built-ins/exec.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*special-built-ins*): Add exec.
2018-12-05 16:08:09 -05:00
Timothy Sample bacbb43650 Add the umask built-in
* geesh/built-ins/umask.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*built-ins*): Add umask.
2018-12-05 16:08:09 -05:00
Timothy Sample a7c5d8cceb Add the shift built-in
* geesh/built-ins/shift.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*special-built-ins*): Add shift.
2018-12-05 16:08:09 -05:00
Timothy Sample c1f8a870ed Add the dot and eval built-ins
* geesh/built-ins/utils.scm (get-evaluator): New public function.
* geesh/built-ins/dot.scm: New file.
* geesh/built-ins/eval.scm: New file.
* geesh/Makefile.am: Add them.
* geesh/built-ins.scm (*special-built-ins*): Add dot and eval.
2018-12-05 16:08:09 -05:00
Timothy Sample 2c1dd2d67e Add the colon built-in
* geesh/built-ins/colon.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*special-built-ins*): Add colon.
2018-12-05 16:08:09 -05:00
Timothy Sample 271301e77d Add the cd and pwd built-ins
* geesh/built-ins/cd.scm: New file.
* geesh/built-ins/pwd.scm: New file.
* Makefile.am: Add them.
* geesh/built-ins.scm (*built-ins*): Add cd and pwd.
2018-12-05 16:08:09 -05:00
Timothy Sample 4ef6907851 Globalize the environment module
Instead of passing around references to the environment, just treat it
as a global.  The old way was just the remains of an idea to make the
environment immutable and keep the interpreter from manipulating any
global state.  By making everything global and mutable, we will have
less impedance mismatch with POSIX going forward.

The following changelog is only a sketch, since nearly every function
has changed.

* geesh/environment.scm: Replace this module with one that treats the
environment as a global resource.
* tests/environment.scm: Delete file.
* Makefile.am: Remove it from the list of tests.
* geesh/shell.scm, geesh/eval.scm, geesh/repl.scm, geesh/word.scm,
geesh/built-ins/break.scm, geesh/built-ins/continue.scm,
geesh/built-ins/echo.scm, geesh/built-ins/export.scm,
geesh/built-ins/false.scm, geesh/built-ins/read.scm,
geesh/built-ins/readonly.scm, geesh/built-ins/set.scm,
geesh/built-ins/true.scm, geesh/built-ins/unset.scm: Remove 'env'
parameters and use the new environment module.
* .dir-locals.el: Update indentation of functions that no longer take
an 'env' parameter and add with-arguments, with-environ, and
with-variables from the new environment module.
* tests/shell.scm, tests/word.scm: Update environment creation and
manipulation in tests.
2018-12-05 16:08:09 -05:00
Timothy Sample 0d41cec2d6 Add the set built-in
* geesh/environment.scm: Export set-environment-arguments!.
* geesh/built-ins/set.scm: New file.
* Makefile.am: Add them.
* geesh/built-ins.scm: Add set.
2018-12-05 16:08:09 -05:00