From e41cbc79e39d62f0343a48efc4d832ed99c83aaf Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 14:52:00 +0100 Subject: [PATCH 01/16] configure.ac: Don't try to dump Lisps which we couldn't find. --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ac42a38..19f91ae 100644 --- a/configure.ac +++ b/configure.ac @@ -61,8 +61,9 @@ AC_ARG_ENABLE([imagedump], AC_DEFUN([mdw_CHECK_LISP], [AC_CHECK_PROGS([$1], [$2]) AC_ARG_VAR([$1], [Path to the $1 Lisp system.]) -case ,$enable_imagedump, in - ,yes, | *,$2,*) dump=t ;; +case $[]$1:,$enable_imagedump, in + :*) dump=nil ;; + *:,yes, | *:*,$2,*) dump=t ;; *) dump=nil ;; esac AM_CONDITIONAL([DUMP_$1], [test $dump = t])]) -- 2.11.0 From 82cc08353498d235b64d63baadabf84c28d3e2e2 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 14:51:24 +0100 Subject: [PATCH 02/16] dump-ecl: Insert missing space before line-splicing `\'. --- dump-ecl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dump-ecl b/dump-ecl index 1f5373e..4ec27b4 100755 --- a/dump-ecl +++ b/dump-ecl @@ -167,7 +167,7 @@ EOF -s -o "ecl-run.o" ${eclopt}compile "ecl-run.lisp") ## Finally link everything together. -run "$ecl" ${eclopt}norc -o "$image"\ +run "$ecl" ${eclopt}norc -o "$image" \ ${eclopt}link "$tmp/asdf.o" "$tmp/ecl-run.o" ###----- That's all, folks -------------------------------------------------- -- 2.11.0 From 6445760568e196c3239cdd08ec5432f96628f4cf Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 14:48:39 +0100 Subject: [PATCH 03/16] lib.c (config_set_var_n): Return a pointer even if we don't change the var. Spotted by old GCC; not sure why newer versions are silent here. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 4f93285..edb6e33 100644 --- a/lib.c +++ b/lib.c @@ -1089,7 +1089,7 @@ struct config_var *config_set_var_n(struct config *conf, struct config_var *var = config_find_var_n(conf, sect, CF_CREAT, name, namelen); - if (var->f&~f&CF_OVERRIDE) return; + if (var->f&~f&CF_OVERRIDE) return (var); free(var->val); var->val = xstrndup(value, valuelen); var->n = valuelen; var->f = f; return (var); -- 2.11.0 From 9ecf91d0ae3972c531a7312eb2e53d4a6b385860 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 14:50:27 +0100 Subject: [PATCH 04/16] dump-runlisp-image.c: Initialize the random number generator a bit. This is only used to pick names for temporary directories, so it doesn't matter that it's rather predictable. Indeed, even using the same sequence every time wasn't particularly bad, but we can do better, and so we should. --- dump-runlisp-image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dump-runlisp-image.c b/dump-runlisp-image.c index 7bd9eba..97f854d 100644 --- a/dump-runlisp-image.c +++ b/dump-runlisp-image.c @@ -1408,6 +1408,7 @@ int main(int argc, char *argv[]) /* Initial setup. */ set_progname(argv[0]); init_config(); + srand(time(0)); /* Parse the options. */ optprog = (/*unconst*/ char *)progname; -- 2.11.0 From 2fb0f2a61ed61747f7b8c206849dadc41079e850 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 14:57:35 +0100 Subject: [PATCH 05/16] configure.ac: Don't sanity-check `$mdw_ecl_opts' if there's no `ecl' anwyay. In particular, it'll look crazy... --- configure.ac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 19f91ae..983aa80 100644 --- a/configure.ac +++ b/configure.ac @@ -92,12 +92,12 @@ if test "x$ECL" != x; then gnu) AC_DEFINE([ECL_OPTIONS_GNU], [1], [Define 1 if ECL uses GNU-style `--FOO' options]) ;; esac + case $mdw_ecl_opts in + gnu) ECLOPT=-- ;; + trad) ECLOPT=- ;; + *) AC_MSG_ERROR([internal error: unexpected value for `$mdw_ecl_opts']) ;; + esac fi -case $mdw_ecl_opts in - gnu) ECLOPT=-- ;; - trad) ECLOPT=- ;; - *) AC_MSG_ERROR([internal error: unexpected value for `$mdw_ecl_opts']) ;; -esac AC_SUBST([ECLOPT]) dnl-------------------------------------------------------------------------- -- 2.11.0 From 2c39b5e665053788124969a3ec17231563db3766 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 15:22:33 +0100 Subject: [PATCH 06/16] tests.at: Use correct `m4_bpatsubst' instead of wrong `m4_bregexp'. This was preventing tests for non-installed Lisps from being skipped. --- tests.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.at b/tests.at index 8c5d0c6..d769420 100644 --- a/tests.at +++ b/tests.at @@ -51,7 +51,7 @@ unset RUNLISP_USERCONFIG m4_define([PREPARE_LISP_TEST], [SETUP_RUNLISP_ENV lisp=$1 -LISP=$m4_translit(m4_bregexp([$1], [/.*$], []), [a-z], [A-Z]) +LISP=$m4_translit(m4_bpatsubst([$1], [/.*$], []), [a-z], [A-Z]) AT_SKIP_IF([test "x$LISP" = x]) case $lisp in */*) opt=${lisp#*/} lisp=${lisp%%/*} ;; -- 2.11.0 From acbcd7d7005baa17b888bd27df570171c3e2a51b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 16:24:32 +0100 Subject: [PATCH 07/16] lib.c: Don't try pointer arithmetic on void pointers. Here, `av->o' is a count of array slots, not bytes, so this is wrong: rewrite to use the correct kind of pointer. Fortunately, nothing actually uses this machinery. It's honestly a bit vexing that GCC lets me get away with this. Spotted by Coverity. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.c b/lib.c index edb6e33..0d618f6 100644 --- a/lib.c +++ b/lib.c @@ -267,7 +267,7 @@ void argv_ensure(struct argv *av, size_t n) if (need <= av->sz) return; newsz = av->sz ? 2*av->sz : 8; while (newsz < need) newsz *= 2; - av->v = xrealloc(av->v - av->o, newsz*sizeof(char *)) + av->o; + av->v = xrealloc(av->v - av->o, newsz*sizeof(char *)); av->v += av->o; av->sz = newsz; } -- 2.11.0 From f50ecbe185f8866970ab62157b2e45bf613907d2 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 13 May 2021 16:27:12 +0100 Subject: [PATCH 08/16] lib.c: Use the size of the element when allocating an array. Oops: a pure blunder. Fortunately, these are actually the same size on most current platforms, but that's not a good excuse. Spotted by Coverity. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 0d618f6..251d932 100644 --- a/lib.c +++ b/lib.c @@ -932,7 +932,7 @@ static void set_config_section_parents(struct config *conf, * to have, so we can allocate the `parents' vector and fill it in. */ sect->nparents = av.n/2; - sect->parents = xmalloc(sect->nparents*sizeof(sect->parents)); + sect->parents = xmalloc(sect->nparents*sizeof(*sect->parents)); for (i = 0; i < av.n; i += 2) { n = av.v[i + 1] - av.v[i]; parent = config_find_section_n(conf, 0, av.v[i], n); -- 2.11.0 From e2f25104858cae26c66491007c78b03aa5fc83a8 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:33:23 +0100 Subject: [PATCH 09/16] Makefile.am (clean): Also delete the versioned dump files. --- Makefile.am | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 20c8dc3..d8d3408 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,35 +114,35 @@ noinst_DATA += $(IMAGES) if DUMP_SBCL IMAGES += sbcl+asdf.core -CLEANFILES += sbcl+asdf.core +CLEANFILES += sbcl+asdf.core sbcl+asdf.core-* sbcl+asdf.core: dump-runlisp-image runlisp-base.conf $(DUMP_RUNLISP_IMAGE) sbcl endif if DUMP_CCL IMAGES += ccl+asdf.image -CLEANFILES += ccl+asdf.image +CLEANFILES += ccl+asdf.image ccl+asdf.image-* ccl+asdf.image: dump-runlisp-image runlisp-base.conf $(DUMP_RUNLISP_IMAGE) ccl endif if DUMP_CLISP IMAGES += clisp+asdf.mem -CLEANFILES += clisp+asdf.mem +CLEANFILES += clisp+asdf.mem clisp+asdf.mem-* clisp+asdf.mem: dump-runlisp-image runlisp-base.conf $(DUMP_RUNLISP_IMAGE) clisp endif if DUMP_ECL IMAGES += ecl+asdf -CLEANFILES += ecl+asdf +CLEANFILES += ecl+asdf ecl+asdf-* ecl+asdf: dump-runlisp-image runlisp-base.conf dump-ecl - $(DUMP_RUNLISP_IMAGE) ecl + $(DUMP_RUNLISP_IMAGE) -odata-dir=$(srcdir) ecl endif if DUMP_CMUCL IMAGES += cmucl+asdf.core -CLEANFILES += cmucl+asdf.core +CLEANFILES += cmucl+asdf.core cmucl+asdf.core-* cmucl+asdf.core: dump-runlisp-image runlisp-base.conf $(DUMP_RUNLISP_IMAGE) cmucl endif -- 2.11.0 From e4b13205c44ec284966bfe9931ad48fed3484497 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:33:51 +0100 Subject: [PATCH 10/16] Makefile.am: Also distribute the `README' file. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index d8d3408..435b764 100644 --- a/Makefile.am +++ b/Makefile.am @@ -173,6 +173,7 @@ uninstall-hook:: ## Documentation. SUBDIRS += doc +EXTRA_DIST += README.org ## Testing. SUBDIRS += t -- 2.11.0 From 45b65b59b4626cc40b86c0a8f49452893f2f6a4b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:36:04 +0100 Subject: [PATCH 11/16] toy-runlisp: Delete old cruft. --- toy-runlisp | 85 ------------------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100755 toy-runlisp diff --git a/toy-runlisp b/toy-runlisp deleted file mode 100755 index 0723aff..0000000 --- a/toy-runlisp +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/sh -e - -case $# in - 0 | 1) echo >&2 "usage: $0 LISP SCRIPT [ARGS ...]"; exit 127 ;; -esac -lisp=$1 script=$2; shift 2 - -__CL_ARGV0=$script; export __CL_ARGV0 # this is stupid - -lispscript=$(printf "%s" "$script" | sed 's/[\"]/\\&/g') - -load_asdf_rune="\ -(let ((*load-verbose* nil) - #+cmu (ext:*require-verbose* nil)) - (require \"asdf\"))" - -ignore_shebang_rune="\ -(set-dispatch-macro-character - #\# #\! - (lambda (stream char arg) - (declare (ignore char arg)) - (values (read-line stream))))" - -clisp_startup_rune="\ -(progn - $ignore_shebang_rune - $load_asdf_rune - (setf *standard-input* (ext:make-stream :input)) - (load \"$lispscript\" :verbose nil :print nil) - (ext:quit))" - -abcl_startup_rune="\ -(let ((script \"$lispscript\")) - $load_asdf_rune - $ignore_shebang_rune - (setf *error-output* - (java:jnew \"org.armedbear.lisp.Stream\" - 'sys::system-stream - (java:jfield \"java.lang.System\" \"err\") - 'character - java:+true+)) - (handler-case (load script :verbose nil :print nil) - (error (error) - (format *error-output* \"~A (unhandled error): ~A~%\" script error) - (ext:quit :status 255))))" - -#set -x -case $lisp in - - sbcl) - exec sbcl --noinform --eval "$load_asdf_rune" --script "$script" "$@" - ;; - - ecl) - exec ecl --norc --eval "$load_asdf_rune" --shell "$script" -- "$@" - ;; - - clisp) - exec clisp -norc -q -x "$clisp_startup_rune" -- "$@" - ;; - - cmucl) - exec cmucl -batch -noinit -nositeinit -quiet \ - -eval "$load_asdf_rune" \ - -eval "$ignore_shebang_rune" \ - -load "$script" -eval "(ext:quit)" -- "$@" - ;; - - ccl) - exec ccl -b -n -Q \ - -e "$load_asdf_rune" \ - -e "$ignore_shebang_rune" \ - -l "$script" -e "(ccl:quit)" -- "$@" - ;; - - abcl) - exec abcl --batch --noinform --noinit --nosystem \ - --eval "$abcl_startup_rune" -- "$@" - ;; - - *) - echo >&2 "$0: unsupported Lisp \`$lisp'" - exit 127 - ;; -esac -- 2.11.0 From 7df3865a1a670b751d006d507f37af625d5e1b56 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:36:52 +0100 Subject: [PATCH 12/16] configure.ac: Add option to configure the image directory. --- configure.ac | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 983aa80..aa86546 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,12 @@ AC_CHECK_PROGS([AUTOM4TE], [autom4te]) dnl-------------------------------------------------------------------------- dnl Checking for Lisp implementations. -imagedir=$localstatedir/$PACKAGE_NAME; AC_SUBST(imagedir) +AC_ARG_WITH([imagedir], + [AS_HELP_STRING([--with-imagedir=DIR], + [store and look for custom Lisp images in DIR])], + [imagedir=$withval], [imagedir=$localstatedir/$PACKAGE_NAME]) +AC_SUBST(imagedir) + mdw_DEFINE_PATHS([ mdw_DEFINE_PATH([IMAGEDIR], [$imagedir]) mdw_DEFINE_PATH([ETCDIR], [$sysconfdir/$PACKAGE_NAME]) -- 2.11.0 From f2649a94f56b8088f36e6014fa588e0d60ae54c1 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:37:34 +0100 Subject: [PATCH 13/16] Makefile.am: Distribute the `confsubst' script. Oops. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 435b764..178949c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -192,5 +192,6 @@ dist-hook:: ## Additional build tools. EXTRA_DIST += config/auto-version +EXTRA_DIST += config/confsubst ###----- That's all, folks -------------------------------------------------- -- 2.11.0 From fe28ef9d3cbbf7aefd42af24532267bb82e2067a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:42:40 +0100 Subject: [PATCH 14/16] Makefile.am: Drop `.fasl' files in build directory when making images. This also means that we don't pick up cached cruft from the usual ASDF cache tree. --- Makefile.am | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 178949c..b13d107 100644 --- a/Makefile.am +++ b/Makefile.am @@ -101,9 +101,16 @@ man_MANS += dump-runlisp-image.1 doc_DATA += dump-runlisp-image.pdf EXTRA_DIST += dump-runlisp-image.1.in -DUMP_RUNLISP_IMAGE = $(v_dump)./dump-runlisp-image -f -O$@ \ +DUMP_RUNLISP_IMAGE = $(v_dump)\ + ASDF_OUTPUT_TRANSLATIONS='( \ + :output-translations \ + :ignore-inherited-configuration \ + (t ("$(abs_builddir)/" "fasl/" \ + :implementation-type :**/ :*.*.*)))' \ + ./dump-runlisp-image -f -O$@ \ -c$(srcdir)/runlisp-base.conf \ -odata-dir=$(srcdir) +clean-local::; rm -fr fasl v_dump = $(v_dump_@AM_V@) v_dump_ = $(v_dump_@AM_DEFAULT_V@) -- 2.11.0 From 47a219e85c4215cea80c75ed9b26ed7dc404a8e2 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 19:52:03 +0100 Subject: [PATCH 15/16] t/package.m4: Delete generated file. --- .gitignore | 1 + t/package.m4 | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 t/package.m4 diff --git a/.gitignore b/.gitignore index 767821d..be476ad 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ Makefile.in /config/install-sh /config/missing /configure +/t/package.m4 /t/testsuite diff --git a/t/package.m4 b/t/package.m4 deleted file mode 100644 index e43d152..0000000 --- a/t/package.m4 +++ /dev/null @@ -1,6 +0,0 @@ -### package information -m4_define([AT_PACKAGE_NAME], [runlisp]) -m4_define([AT_PACKAGE_TARNAME], [runlisp]) -m4_define([AT_PACKAGE_VERSION], [UNKNOWN]) -m4_define([AT_PACKAGE_STRING], [runlisp UNKNOWN]) -m4_define([AT_PACKAGE_BUGREPORT], [mdw@distorted.org.uk]) -- 2.11.0 From 60db9fabc6aca55ad76fc8aae5b01e61eac38715 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 14 May 2021 21:41:25 +0100 Subject: [PATCH 16/16] dump-runlisp-image.c: Delete traces of decoy `-d' (`--cleanup') option. This morphed into the `-R' and `-U' options before ever being implemented. --- dump-runlisp-image.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dump-runlisp-image.c b/dump-runlisp-image.c index 97f854d..3f9131e 100644 --- a/dump-runlisp-image.c +++ b/dump-runlisp-image.c @@ -1318,7 +1318,7 @@ static void version(FILE *fp) static void usage(FILE *fp) { fprintf(fp, "\ -usage: %s [-RUadfinqrv] [+RUdfinr] [-c CONF] [-o [SECT:]VAR=VAL]\n\ +usage: %s [-RUafinqrv] [+RUfinr] [-c CONF] [-o [SECT:]VAR=VAL]\n\ [-O FILE|DIR] [-j NJOBS] [LISP ...]\n", progname); } @@ -1345,7 +1345,6 @@ Image dumping:\n\ -R, --remove-other Delete image files for other Lisp systems.\n\ -U, --remove-unknown Delete unrecognized files in image dir.\n\ -a, --all-configured Select all configured implementations.\n\ - -d, --cleanup Delete images which are no longer wanted.\n\ -f, --force Dump images even if they already exist.\n\ -i, --check-installed Check Lisp systems exist before dumping.\n\ -j, --jobs=NJOBS Run up to NJOBS jobs in parallel.\n\ @@ -1422,7 +1421,7 @@ int main(int argc, char *argv[]) break for (;;) { - i = mdwopt(argc - 1, argv + 1, "hVO:R+U+ac:d+f+i+j:n+o:qr+v", opts, 0, 0, + i = mdwopt(argc - 1, argv + 1, "hVO:R+U+ac:f+i+j:n+o:qr+v", opts, 0, 0, OPTF_NEGATION | OPTF_NOPROGNAME); if (i < 0) break; switch (i) { -- 2.11.0