Commit Graph

490 Commits

Author SHA1 Message Date
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
Timothy Sample f387269c0b Only use readline for TTYs.
* gash/gash.scm: Hide the readline interface behind a check for
'isatty?', and default to just running the plain REPL.
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
Timothy Sample f4dd0feb77 Do not clobber status before 'cond' expressions.
This spurious status reset must have been an attempt to make sure that
when no branch is taken, the status ends up as zero.  It is not
necessary and causes problems when trying to branch based on the value
of '$?'.

* geesh/shell.scm (sh:cond): Remove spurious 'set-status!'.
2019-05-20 01:17:22 -04:00
Timothy Sample ae769985be Reset signal and exit handlers in subshells.
* geesh/shell.scm (%subshell): In the child process, restore all
signal handlers to their original actions and unset the current
'atexit' handler.
2019-05-20 01:17:22 -04:00
Timothy Sample c169a90753 Use default value when unpacking variable vector.
* geesh/environment.scm (getvar): Use 'dflt' when we have a vector but
'value' is '#f'.
2019-05-20 01:17:22 -04:00
Timothy Sample 64aa779315 lexer: Do not let comments delimit words.
The '#' character only introduces a comment if it occurs where a word
would begin.  If it occurs within a word, it is not treated specially.

* geesh/lexer.scm (get-word): Do not treat '#' specially.
2019-05-20 01:17:22 -04:00
Timothy Sample 4d1e0c96a4 shell: Make 'continue' work in while loops.
* geesh/shell.scm (sh:while): Use 'call-with-continue' when invoking
the body thunk.
2019-05-20 01:17:22 -04:00
Timothy Sample 0dc3f63cad Handle '$LINENO'.
* geesh/lexer.scm (get-parameter-expansion): Include the current line
number with the variable name if it is 'LINENO'.
(call-with-metered-input-port): Set the line number of the soft port.
* geesh/word.scm (parameter-ref): Unpack the included line number when
the parameter name is 'LINENO'.
2019-05-20 01:17:22 -04:00
Jan Nieuwenhuizen c6a3d13c69 word: Add context to "not implemented" errors.
* geesh/word.scm (word->qword): Include the word form in "not
implemented" error messages.
2019-05-20 01:17:22 -04:00
Jan Nieuwenhuizen 2d99ab62d0 Update AUTHORS.
* AUTHORS: Add Timothy Sample as a main author; remove files that no
longer exist.
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 3584866b73 Remove special characters from test names.
* tests/01-script-$0.sh: Rename this...
* tests/01-script-arg-0.sh: ...to this.
* tests/01-script-$#.sh: Rename this...
* tests/01-script-arg-length.sh: ...to this.
* tests/01-script-$#.stdout: Rename this...
* tests/01-script-arg-length.stdout: ...to this.
* tests/01-script-$@.sh: Rename this...
* tests/01-script-arg-list.sh: ...to this.
* tests/01-script-$@.stdout: Rename this...
* tests/01-script-arg-list.stdout: ...to this.
* check.sh: Update test names.
2019-05-16 10:49:38 -04:00
Timothy Sample fe7a322d4e Move test/* to tests.
* test/*: Move these...
* tests: ...to this directory.
* check.sh, test.sh, .gitignore: Update references.
2019-05-16 10:49:38 -04:00
Timothy Sample c5f2f56268 Move test data to tests/data.
* test/data/*: Move these...
* tests/data: ...to this directory.
* test/20-pipe-sed-cat.sh, test/20-pipe-sed-cat.stdout,
test/20-pipe-sed.sh, test/20-pipe-sed.stdout, test/41-dot.sh,
test/42-sh-export.sh, test/42-sh.sh, test/50-redirect-in-out.sh,
test/50-redirect-in.sh, test/50-redirect-sed.sh, test/60-subst.sh,
test/100-sed-autoconf-basename.sh, test/100-sed-file.sh,
test/100-sed-fooRbar.sh, test/100-tar-Z-old.sh,
test/100-tar-Z-old.stdout, test/100-tar-Z-pipe.sh,
test/100-tar-Z-pipe.stdout, test/100-tar-Z.sh, test/100-tar-Z.stdout,
test/100-tar-ro.sh, test/100-tar.sh, test/100-tar.stdout,
test/100-tr.sh: Update references.
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 c5e5a34fc0 Move bin/gash to scripts.
* bin/gash.in: Move this...
* scripts/gash.in: ...here.
* configure, build-aux/build-guile.sh, makefile,
  check.sh, test.sh, .gitignore: Update references.
2019-01-12 11:42:35 -05:00
Timothy Sample bbcb78de14 Use built-in compress without an external file.
When the system does not provide a compress executable, we use our
own.  Before, this was done by installing an executable named
'compress' along with Gash.  This commit allows the compressed-port
functions to use our built-in compress without needing an external
executable.

* gash/config.scm.in (exec-internal-compress): New function.
(%compress): Fall back to it on systems without compress.
* gash/guix-utils.scm (filtered-port, filtered-output-port): When the
given command list begins with a procedure, apply it to its arguments
instead of using execl.
2019-01-12 11:42:26 -05:00
Timothy Sample 35444457f8 Remove unused variable from Gash config.
* gash/config.scm.in (%commands): Remove variable.
2019-01-12 11:42:17 -05:00
Timothy Sample 23e53f4e49 Merge branch 'gash'
This commit brings in the entire history of the Gash project.  There
are a few conflicts, which are explained below.

* .dir-locals.el: Combine both files.
* .gitignore: Combine both files.
* COPYING: Use the Geesh version with HTTPS URLs.
* README: Use the Gash README.
* guix.scm: Use the Geesh package definition (the Gash one is
preserved in gash.guix.scm).
2018-12-13 13:42:21 -05: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 b67fdc6fbf Remove testing leftovers in the Guix package 2018-12-12 13:11:16 -05:00
Timothy Sample 1cda08dd4a sed: Replace blank regexes with the last regex. 2018-12-11 13:13:46 -05:00
Timothy Sample cb8b2758e0 test: Use script file for sed basename test.
As of this commit, Gash does not process the quotes around the script
properly, and ends up calling sed with no arguments.
2018-12-11 13:13:46 -05:00
Timothy Sample 8c5a9ea96f test: Rename sed dirname test to basename. 2018-12-11 13:13:46 -05:00
Timothy Sample 7aa7a883e0 sed: Add basic support for script files. 2018-12-11 13:13:46 -05:00
Timothy Sample 489f092131 sed: Add quit function. 2018-12-11 13:13:46 -05:00
Timothy Sample 5be7ed331d sed: Support command lists. 2018-12-11 13:13:46 -05:00
Timothy Sample 1302c8bf28 sed: Support single pattern addresses. 2018-12-11 13:13:46 -05:00
Timothy Sample 194c098ab7 sed: Fully parse commands before processing them. 2018-12-11 13:12:45 -05:00
Jan Nieuwenhuizen 0568f73a21 test: failing 100-sed-autoconf-dirname test. 2018-12-09 04:30:32 +01:00
Jan Nieuwenhuizen 8757ab67fb basename: fix /, add autoconf basename, dirname tests. 2018-12-09 04:13:27 +01:00
Jan Nieuwenhuizen f8a4f8aeae doc: Some updates. 2018-12-08 08:36:36 +01:00
Jan Nieuwenhuizen 1d6a0cff99 test: 42-sh-export: New failing test. 2018-12-08 07:55:55 +01: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 5287348cdc Add metadata to the Guix package
* guix.scm: Fill out home-page, synopsis, description, and license
fields.
2018-12-05 22:17:41 -05:00
Timothy Sample 88b376c014 Make the Guix package use the current sources
* guix.scm: Use Guile-Git to find the list of source files, and use
those files for the source field of the package.
2018-12-05 22:17:41 -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 177953c4b0 Add support for $$
* geesh/environment.scm (*root-pid*): New variable.
(get-root-pid): New public function.
* geesh/word.scm (parameter-ref): Handle '$'.
2018-12-05 16:23:51 -05:00
Timothy Sample 6b38897dc5 Initialize $PWD properly
* geesh/environment.scm (initial-pwd): New function.
(initial-variables): New function.
(*variables*): Initialize to the result of initial-variables.
2018-12-05 16:22:51 -05:00
Timothy Sample 2db92dd274 Work around missing case expressions
* geesh/eval.scm (exps->thunk): Filter out '#f' expressions.
2018-12-05 16:21:58 -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 66e89c1a05 Add return and exit semantics
* geesh/environment.scm (*return-tag*): New variable.
(call-with-return): New public function.
(sh:return): New public function.
(*atexit*): New variable.
(*exiting?*) New variable.
(set-atexit!): New public function.
(sh:exit): New public function.
* geesh/repl.scm (run-repl): Call sh:exit at the end of a script.
* geesh/shell.scm (sh:exec-let): Use call-with-return for functions.
* geesh/built-ins/dot.scm (main): Use call-with-return.
2018-12-05 16:08:09 -05:00
Timothy Sample 2fdbfe2ca4 Add a prefix to break and continue
These names are too common, and it will be even worse with 'exit'
and 'return'.

* geesh/environment.scm (break): Rename this...
(sh:break) ...to this.
(continue): Rename this...
(sh:continue) ...to this.
* geesh/built-ins/break.scm (main): Update call.
* geesh/built-ins/continue.scm (main): Ditto.
2018-12-05 16:08:09 -05:00