platform/upstream/guile.git
8 years agoAdd generic prebuilt links to dist. v2.2.0
Andy Wingo [Wed, 15 Mar 2017 09:02:01 +0000 (10:02 +0100)]
Add generic prebuilt links to dist.

* prebuilt/Makefile.am (EXTRA_DIST): Add generic prebuilt links.

8 years agoUpdate --version and REPL copyright years
Andy Wingo [Wed, 15 Mar 2017 08:12:55 +0000 (09:12 +0100)]
Update --version and REPL copyright years

* module/ice-9/command-line.scm (version-etc):
* module/system/repl/common.scm (*version*): Update release year.

8 years agoGNU Guile 2.2.0.
Andy Wingo [Wed, 15 Mar 2017 08:02:52 +0000 (09:02 +0100)]
GNU Guile 2.2.0.

* GUILE-VERSION (GUILE_MINOR_VERSION, GUILE_MICRO_VERSION): Bump.
  (LIBGUILE_INTERFACE_CURRENT): Incrememt to indicate that we now have a
  defined libtool ABI "interface" of 1, that we support no other
  interface (yet), and that this is the 0th revision of that interface.

8 years agoGUILE_SITE_DIR: Update to find compiled site directories
Freja Nordsiek [Tue, 14 Mar 2017 16:05:09 +0000 (17:05 +0100)]
GUILE_SITE_DIR: Update to find compiled site directories

* meta/guile.m4 (GUILE_SITE_DIR): Update to find compiled site
  directories.
* meta/guile-2.2.pc.in: Add entry for site-ccache directory.

8 years agoBetter eval+promise+gc test
Andy Wingo [Tue, 14 Mar 2017 14:35:38 +0000 (15:35 +0100)]
Better eval+promise+gc test

* test-suite/tests/eval.test ("promises"): Increase clear pass rate on
  this test.

8 years agoResolve unresolved alist test cases
Andy Wingo [Tue, 14 Mar 2017 14:18:41 +0000 (15:18 +0100)]
Resolve unresolved alist test cases

* test-suite/tests/alist.test: Update unresolved cases to match current
  behavior.  Bogus but stable :/

8 years agobuild: Compress with lzip too.
Ludovic Courtès [Wed, 12 Oct 2016 10:03:16 +0000 (12:03 +0200)]
build: Compress with lzip too.

* configure.ac: Add 'dist-lzip' Automake option.

8 years agoFixed reversed version order bug in GUILE_PROGS Autoconf macro.
Freja Nordsiek [Tue, 14 Mar 2017 14:14:47 +0000 (15:14 +0100)]
Fixed reversed version order bug in GUILE_PROGS Autoconf macro.

* meta/guile.m4 (GUILE_PROGS): Build version in correct order.

8 years agoUpdate NEWS
Andy Wingo [Tue, 14 Mar 2017 10:26:49 +0000 (11:26 +0100)]
Update NEWS

* NEWS: Update for 2.2.0.

8 years agoconfigure detects which set of prebuilt binaries to use
Andy Wingo [Tue, 14 Mar 2017 08:43:50 +0000 (09:43 +0100)]
configure detects which set of prebuilt binaries to use

* configure.ac: Use detected endianness and word size to automatically
  select which set of prebuilt binaries to use.
* meta/build-env.in (top_builddir):
* meta/uninstalled-env.in (top_builddir): Update to use
  SCM_PREBUILT_BINARIES for prebuilt entry in GUILE_LOAD_COMPILED_PATH.
* prebuilt/32-bit-big-endian:
* prebuilt/32-bit-little-endian:
* prebuilt/64-bit-little-endian: New links.
* prebuilt/x86_64-pc-linux-gnu: Remove this link now that it's unneeded.

8 years agoNonlocal prompt returns cause all effects
Andy Wingo [Mon, 13 Mar 2017 21:16:56 +0000 (22:16 +0100)]
Nonlocal prompt returns cause all effects

* module/language/cps/effects-analysis.scm (expression-effects): Prompts
  cause &all-effects.  I tried to limit this change to CSE but it was
  actually LICM that was borked, so better to be conservative
* test-suite/tests/control.test ("escape-only continuations"): Add
  test.

8 years agoFix finalizer resuscitation causing excessive GC
Andy Wingo [Mon, 13 Mar 2017 14:47:51 +0000 (15:47 +0100)]
Fix finalizer resuscitation causing excessive GC

* libguile/finalizers.c (async_gc_finalizer):
  (scm_i_register_async_gc_callback): Replace "weak gc callback"
  mechanism with "async gc callback" mechanism.  Very similar but the
  new API is designed to be called a bounded number of times, to avoid
  running afoul of libgc heuristics.
* libguile/weak-list.h: New internal header.
* libguile/Makefile.am (noinst_HEADERS): Add weak-list.h.
* libguile/weak-set.c (vacuum_all_weak_sets):
  (scm_c_make_weak_set, scm_init_weak_set):
* libguile/weak-table.c (vacuum_all_weak_tables):
  (scm_c_make_weak_table, scm_init_weak_table): Arrange to vacuum all
  weak sets from a single async GC callback, and likewise for weak
  tables.

Thanks to Ludovic Courtès for tracking this bug down!

8 years agoGuile 2.1.8. v2.1.8
Andy Wingo [Fri, 10 Mar 2017 10:01:04 +0000 (11:01 +0100)]
Guile 2.1.8.

* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.

8 years agoRevert "Fix "Scheme Syntax" info rendering"
Andy Wingo [Fri, 10 Mar 2017 11:02:21 +0000 (12:02 +0100)]
Revert "Fix "Scheme Syntax" info rendering"

This reverts commit 62f08b8f38990c1849ea61cd622f84b3d2611cd9, which was
causing failing texi2dvi runs.

8 years agoUpdate NEWS
Andy Wingo [Fri, 10 Mar 2017 09:46:10 +0000 (10:46 +0100)]
Update NEWS

* NEWS: Update for 2.1.8.

8 years agoFix atomics compilation on clang
Andy Wingo [Fri, 10 Mar 2017 08:10:50 +0000 (09:10 +0100)]
Fix atomics compilation on clang

* libguile/atomics-internal.h (scm_atomic_subtract_uint32):
  (scm_atomic_compare_and_swap_uint32, scm_atomic_set_pointer):
  (scm_atomic_ref_pointer, scm_atomic_set_scm):
  (scm_atomic_ref_scm, scm_atomic_swap_scm):
  (scm_atomic_compare_and_swap_scm): Use C11 atomic types if we have
  loaded C11 stdatomic.h.

8 years agoFix a couple of typos in the docs
Vladislav Ivanishin [Tue, 18 Oct 2016 15:14:22 +0000 (18:14 +0300)]
Fix a couple of typos in the docs

* doc/ref/scheme-ideas.texi: the some way -> the same way
* doc/ref/scheme-intro.texi: Use @math inside a texinfo command (turns out
  $math$ is not processed in this context and thus is not rendered correctly).

8 years agoVM support for string-set!; slimmer read-string
Andy Wingo [Thu, 9 Mar 2017 16:22:08 +0000 (17:22 +0100)]
VM support for string-set!; slimmer read-string

* doc/ref/vm.texi (Inlined Scheme Instructions): Add string-set!.
* libguile/vm-engine.c (string-set!): New opcode.
* module/ice-9/rdelim.scm (read-string): Reimplement in terms of a
  geometrically growing list of strings, to reduce total heap usage when
  reading big files.
* module/language/cps/compile-bytecode.scm (compile-function): Add
  string-set! support.
* module/language/cps/types.scm (string-set!): Update for &u64 index.
* module/language/tree-il/compile-cps.scm (convert): Unbox index to
  string-set!.
* module/system/vm/assembler.scm (system): Export string-set!.

8 years agoMicro-optimize update-port-position.
Andy Wingo [Thu, 9 Mar 2017 14:53:47 +0000 (15:53 +0100)]
Micro-optimize update-port-position.

* libguile/ports.c (update_port_position): Only fetch line if we need to
  increment it.

8 years agoFix bug in comparison between real and complex
Daniel Llorens [Thu, 9 Mar 2017 14:13:19 +0000 (15:13 +0100)]
Fix bug in comparison between real and complex

This bug was introduced by 35a90592501ebde7e7ddbf2486ca9d315e317d09.

* module/language/cps/specialize-numbers.scm (specialize-operations):
  Check that both operands are real as a condition for
  specialize-f64-comparison.
* test-suite/tests/numbers.test: Add test.

8 years agoRemove contification restriction in case-lambda
Andy Wingo [Thu, 9 Mar 2017 13:47:42 +0000 (14:47 +0100)]
Remove contification restriction in case-lambda

* module/language/cps/compile-bytecode.scm (compile-function): Check for
  fallthrough after $kclause too; possible to need to jump if clause
  tails are contified.
* module/language/cps/contification.scm (compute-contification-candidates):
  Enable inter-clause contification.

8 years agoAll clauses of function have same nlocals
Andy Wingo [Thu, 9 Mar 2017 13:25:37 +0000 (14:25 +0100)]
All clauses of function have same nlocals

* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/slot-allocation.scm ($allocation)
  (lookup-nlocals, compute-frame-size, allocate-slots): Adapt to
  have one frame size per function, for all clauses.

8 years agoAdapt gcprof to preemptive interrupts
Andy Wingo [Thu, 9 Mar 2017 09:48:02 +0000 (10:48 +0100)]
Adapt gcprof to preemptive interrupts

* module/statprof.scm (gcprof): Remove handle-interrupts trampoline from
  captured stacks.

8 years agoAdapt statprof to new preemptive interrupts
Andy Wingo [Thu, 9 Mar 2017 09:42:58 +0000 (10:42 +0100)]
Adapt statprof to new preemptive interrupts

* module/statprof.scm (profile-signal-handler): Cut an additional stack
  frame, corresponding to the handle-interrupts trampoline added
  recently.

8 years agostatprof: 'with-statprof' honors #:display-style.
Ludovic Courtès [Thu, 9 Mar 2017 09:31:30 +0000 (10:31 +0100)]
statprof: 'with-statprof' honors #:display-style.

* module/statprof.scm (with-statprof): Pass #:display-style to 'statprof'.

8 years ago64KB segment alignment
Andy Wingo [Wed, 8 Mar 2017 21:39:29 +0000 (22:39 +0100)]
64KB segment alignment

* module/system/vm/linker.scm (*lcm-page-size*): Rename
  from *page-size*, change to 64 KB.
* libguile/loader.c (load_thunk_from_memory): Only require page size
  alignment, knowing that although Guile might emit ELF with 64k
  alignment, it only really needs page alignment.

8 years agoFix new thread-local fluids test
Andy Wingo [Tue, 7 Mar 2017 20:35:52 +0000 (21:35 +0100)]
Fix new thread-local fluids test

* test-suite/tests/fluids.test ("dynamic states"): Fix test.

8 years agoFix documentation build
Andy Wingo [Tue, 7 Mar 2017 20:34:01 +0000 (21:34 +0100)]
Fix documentation build

* doc/ref/api-control.texi (Fluids and Dynamic States): Fix link.

8 years agoAdd thread local fluids
Andy Wingo [Tue, 7 Mar 2017 19:57:59 +0000 (20:57 +0100)]
Add thread local fluids

* libguile/fluids.h (struct scm_dynamic_state): Add thread_local_values
  table.  Thread locals are flushed to a separate thread-local table.
  The references are strong references since the table never escapes the
  thread.
  (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
  functions.
* libguile/fluids.c (FLUID_F_THREAD_LOCAL):
  (SCM_I_FLUID_THREAD_LOCAL_P): New macros.
  (restore_dynamic_state): Add comment about precondition.
  (save_dynamic_state): Flush thread locals.
  (scm_i_fluid_print): Print thread locals nicely.
  (new_fluid): Add flags arg.
  (scm_make_fluid, scm_make_fluid_with_default, scm_make_unbound_fluid):
  Adapt.
  (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
  functions.
  (fluid_set_x): Special flushing logic for thread-locals.
  (fluid_ref): Special cache miss logic for thread locals.
* libguile/stacks.c (scm_init_stacks):
* libguile/throw.c (scm_init_throw): %stacks and %exception-handler are
  thread-locals.
* libguile/threads.c (guilify_self_2): Init thread locals table.
* test-suite/tests/fluids.test ("dynamic states"): Add test.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add link to
  Thread-Local Variables.
* doc/ref/api-scheduling.texi (Thread Local Variables): Update with real
  thread-locals.
* NEWS: Update.

8 years agopsyntax: Generate identifiers in a deterministic fashion.
Mark H Weaver [Fri, 12 Feb 2016 16:19:38 +0000 (11:19 -0500)]
psyntax: Generate identifiers in a deterministic fashion.

Fixes <http://bugs.gnu.org/20272>.

* module/ice-9/boot-9.scm (module-generate-unique-id!)
(module-gensym): New procedures.
(module): Add 'next-unique-id' field.
(the-root-module): Inherit 'next-unique-id' value from early stub.
(make-module, make-autoload-interface): Adjust calls to
module-constructor.
* module/ice-9/psyntax.scm (gen-label, new-mark): Generate unique
identifiers from the module name and the per-module unique-id.
(build-lexical-var, generate-temporaries): Use
'module-gensym' instead of 'gensym'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/language/tree-il/fix-letrec.scm (fix-letrec!): Use
'module-gensym' instead of 'gensym'.
* module/system/base/syntax.scm (define-record): Likewise.
(transform-record): Likewise.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
8 years agoCheck for working profiling and virtual itimers
Mike Gran [Tue, 7 Mar 2017 07:06:12 +0000 (23:06 -0800)]
Check for working profiling and virtual itimers

* configure.ac (HAVE_USABLE_GETITIMER_PROF, HAVE_USABLE_GETITIMER_VIRTUAL): new tests
* doc/ref/posix.texi (setitimer, getitimer): document provided? 'ITIMER_VIRTUAL and 'ITIMER_PROF
* doc/ref/statprof.texi (statprof): document ITIMER_PROF requirements
* libguile/scmsigs.c (scm_setitimer, scm_getitimer): document (provided? 'ITIMER_VIRTUAL) and (provided? 'ITIMER_PROF)
  (scm_init_scmsigs): add features ITIMER_VIRTUAL and ITIMER_PROF
* test-suite/tests/asyncs.test ("prevention via sigprof"): throw when unsupported
* test-suite/tests/signals.test: throw when not supported
* test-suite/tests/statprof.test: throw when not supported

8 years agoCan't recursively search DLLs with FFI on Cygwin
Mike Gran [Sun, 5 Mar 2017 20:26:57 +0000 (12:26 -0800)]
Can't recursively search DLLs with FFI on Cygwin

* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs.
* test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly
* test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly
* test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly

8 years agoDisable Turkish locale tests on Cygwin
Mike Gran [Sun, 5 Mar 2017 00:42:32 +0000 (16:42 -0800)]
Disable Turkish locale tests on Cygwin

Cygwin's support of Turkish casing rules is broken.

* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): modified

8 years agoFix regression in non-mmap fallback elf loader
Mike Gran [Fri, 3 Mar 2017 17:50:27 +0000 (09:50 -0800)]
Fix regression in non-mmap fallback elf loader

* libguile/loader.c [!HAVE_SYS_MMAN_H] (map_file_contents): updated
  variables and function calls to the current names

8 years agoCygwin: skip tests that require working setrlimits for memory
Mike Gran [Fri, 3 Mar 2017 17:44:10 +0000 (09:44 -0800)]
Cygwin: skip tests that require working setrlimits for memory

On Cygwin, setrlimits cannot be used to set total memory availabe
for a process.

* test-suite/standalone/test-out-of-memory: skip for cygwin
* test-suite/standalone/test-stack-overflow: skip for cygwin

8 years agoRevert "build: Compress with lzip too."
Andy Wingo [Thu, 2 Mar 2017 07:39:42 +0000 (08:39 +0100)]
Revert "build: Compress with lzip too."

This reverts commit 89ce9fb31b00f1f243fe6f2450db50372cc0b86d.  It was
causing the hydra builds to fail.

8 years agoFix makeinfo warnings
Andy Wingo [Wed, 1 Mar 2017 20:49:47 +0000 (21:49 +0100)]
Fix makeinfo warnings

* doc/ref/api-languages.texi (Nil):
* doc/ref/statprof.texi (Statprof): Use headings instead of sections to
  avoid makeinfo warnings.

8 years agoRemove useless subsection from hooks documentation
Andy Wingo [Wed, 1 Mar 2017 20:45:14 +0000 (21:45 +0100)]
Remove useless subsection from hooks documentation

* doc/ref/api-utility.texi (Hook Reference): Remove useless "handling
  hooks from C" section that was also generating warnings.

8 years agoFix scheme-scripts markup.
Andy Wingo [Wed, 1 Mar 2017 20:44:53 +0000 (21:44 +0100)]
Fix scheme-scripts markup.

* doc/ref/scheme-scripts.texi (Scripting Examples): Fix $@ rendering in
  texinfo.

8 years agoUpdate NEWS for prerelease.
Andy Wingo [Wed, 1 Mar 2017 20:38:14 +0000 (21:38 +0100)]
Update NEWS for prerelease.

* NEWS: Update for next prerelease.

8 years agoUpdate NEWS
Andy Wingo [Wed, 1 Mar 2017 20:27:34 +0000 (21:27 +0100)]
Update NEWS

* NEWS: Update 2.0.x NEWS.  Fold 2.1.7 NEWS into main 2.2 body.

8 years agodoc: Describe -e (module) on equal footing with (@ ...).
Arne Babenhauserheide [Thu, 29 Sep 2016 15:11:26 +0000 (17:11 +0200)]
doc: Describe -e (module) on equal footing with (@ ...).

* doc/ref/guile-invoke.texi, doc/ref/scheme-scripts.texi:
describe the -e (module) shorthand as on equal footing with (@ ...)

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
8 years agoi18n: 'number->locale-string' guesses the minimum number of decimals.
Ludovic Courtès [Mon, 13 Feb 2017 20:30:51 +0000 (21:30 +0100)]
i18n: 'number->locale-string' guesses the minimum number of decimals.

This feature was removed by 4aead68cdb86ca60cc372f0cd558cadda90ddec5.

* module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where
DIGIT-COUNT is not an integer.
(number->locale-string): Always pass FRACTION-DIGITS to
'number-decimal-string'.
* test-suite/tests/format.test ("~h localized number")["1234.5"]
["padding", "padchar"]: Remove decimal specifier.
* test-suite/tests/i18n.test ("number->locale-string")
["fraction",
* test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal
specifier.  Remove one decimal.
* doc/ref/api-i18n.texi (Number Input and Output): Update
'number->locale-string' doc to mention the number of decimals.

8 years agoi18n: Fix corner cases for monetary and number string conversions.
Ludovic Courtès [Sun, 12 Feb 2017 23:07:40 +0000 (00:07 +0100)]
i18n: Fix corner cases for monetary and number string conversions.

Fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.

* module/ice-9/i18n.scm (integer->string, number-decimal-string): New
procedures.
(monetary-amount->locale-string): Use them instead of 'number->string'
followed by 'string-split'.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["fraction"]: Add
second argument to 'number->locale-string'.
["fraction, 1 digit"]: Round up.
["fraction, 10 digits", "trailing zeros", "negative integer"]: New
tests.
* test-suite/tests/i18n.test ("format ~h"): Pass the number of decimals
for ~h.
("monetary-amount->locale-string")["French"]: Always expect two decimals
after the comma.
["one cent", "very little money"]: New tests.
* test-suite/tests/format.test ("~h localized number")["1234.5"]:
Specify the number of decimals explicitly.
["padding"]: Expect zero decimals.
["padchar"]: Ask for one decimal.
["decimals", "locale"]: Adjust rounding.

8 years agotests: Choose a more plausible US English locale name.
Ludovic Courtès [Sun, 12 Feb 2017 23:00:22 +0000 (00:00 +0100)]
tests: Choose a more plausible US English locale name.

* test-suite/tests/i18n.test (%american-english-locale-name): Change to
en_US.utf8".

8 years agotests: Use 'pass-if-equal' for (ice-9 i18n) tests.
Ludovic Courtès [Sun, 12 Feb 2017 22:42:09 +0000 (23:42 +0100)]
tests: Use 'pass-if-equal' for (ice-9 i18n) tests.

* test-suite/tests/i18n.test ("number->locale-string")
("format ~h", "monetary-amount->locale-string"): Use 'pass-if-equal'
instead of 'pass-if'.

8 years agoi18n: Do not represent zero as "-0".
Ludovic Courtès [Sun, 12 Feb 2017 21:59:17 +0000 (22:59 +0100)]
i18n: Do not represent zero as "-0".

Partly fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.

* module/ice-9/i18n.scm (monetary-amount->locale-string): Don't negate
AMOUNT when it's zero.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["positive inexact
zero, 1 digit"]: New test.
("monetary-amount->locale-string")["positive inexact zero"]: New test.

8 years agoRecognize sh3 as compilation targets
John Paul Adrian Glaubitz [Sat, 21 Jan 2017 11:49:31 +0000 (12:49 +0100)]
Recognize sh3 as compilation targets

* module/system/base/target.scm (cpu-endianness, triplet-pointer-size):
  Add case for "sh3".

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
8 years agodoc: Fix typo in site packages documentation.
Georgi Kirilov [Wed, 25 Jan 2017 18:21:29 +0000 (20:21 +0200)]
doc: Fix typo in site packages documentation.

* doc/ref/scheme-using.texi (Installing Site Packages): Fix typo

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
8 years agodoc: Fix typo in keywords documentation.
Georgi Kirilov [Wed, 1 Mar 2017 20:01:26 +0000 (21:01 +0100)]
doc: Fix typo in keywords documentation.

* doc/ref/api-data.texi (Keyword Read Syntax): Fix typo

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
8 years agotests: Avoid statprof test failure on systems without 'setitimer'.
Ludovic Courtès [Sat, 11 Feb 2017 21:00:18 +0000 (22:00 +0100)]
tests: Avoid statprof test failure on systems without 'setitimer'.

Partly fixes <http://bugs.gnu.org/25463>.
Reported by rennes@openmailbox.org.

* test-suite/tests/statprof.test ("return values"): Wrap in
'when-implemented'.

8 years agobuild: Honor $SOURCE_DATE_EPOCH for the recorded timestamp.
Ludovic Courtès [Wed, 14 Dec 2016 16:20:00 +0000 (17:20 +0100)]
build: Honor $SOURCE_DATE_EPOCH for the recorded timestamp.

Reported by Jan Nieuwenhuizen <janneke@gnu.org>
at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20272#36>.

* libguile/Makefile.am (libpath.h): Honor 'SOURCE_DATE_EPOCH'.

8 years agoscandir: Avoid 'stat' calls on each entry.
Ludovic Courtès [Fri, 28 Oct 2016 20:14:05 +0000 (22:14 +0200)]
scandir: Avoid 'stat' calls on each entry.

* module/ice-9/ftw.scm (scandir): Rewrite in terms of 'readdir'.

8 years agobuild: Compress with lzip too.
Ludovic Courtès [Wed, 12 Oct 2016 10:03:16 +0000 (12:03 +0200)]
build: Compress with lzip too.

* configure.ac: Add 'dist-lzip' Automake option.

8 years agobuild: Check for /gnu/store file names upon "make dist".
Ludovic Courtès [Wed, 12 Oct 2016 10:01:54 +0000 (12:01 +0200)]
build: Check for /gnu/store file names upon "make dist".

* Makefile.am (assert-no-store-file-names): New rule, taken from Guix.
(dist-hook): Depend on it.

8 years agoDisable REPL server tests if no threads
Andy Wingo [Wed, 1 Mar 2017 11:19:39 +0000 (12:19 +0100)]
Disable REPL server tests if no threads

* test-suite/tests/00-repl-server.test (call-with-repl-server): The REPL
  server needs threads so don't bother testing if we have no threads.
  Also, prevent SIGPIPE from killing the parent process.

8 years agotests: Avoid race condition in REPL server test.
Ludovic Courtès [Fri, 4 Nov 2016 21:45:51 +0000 (22:45 +0100)]
tests: Avoid race condition in REPL server test.

Fixes <http://bugs.gnu.org/24769>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* test-suite/tests/00-repl-server.test ("simple expression"): Add call
to 'select' before 'display'.

8 years agotests: Throw 'unresolved when the REPL server is too slow.
Ludovic Courtès [Fri, 4 Nov 2016 21:44:32 +0000 (22:44 +0100)]
tests: Throw 'unresolved when the REPL server is too slow.

* test-suite/tests/00-repl-server.test (call-with-repl-server):
Use (usleep 100) instead of (sleep 1).  Throw 'unresolved when TRIES is
too high.

8 years agotests: Add REPL server test for CVE-2016-8606.
Ludovic Courtès [Wed, 12 Oct 2016 07:37:18 +0000 (09:37 +0200)]
tests: Add REPL server test for CVE-2016-8606.

This is a followup to 08c021916dbd3a235a9f9cc33df4c418c0724e03.

* test-suite/tests/00-repl-server.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.

8 years agoREPL Server: Guard against HTTP inter-protocol exploitation attacks.
Mark H Weaver [Fri, 9 Sep 2016 11:36:52 +0000 (07:36 -0400)]
REPL Server: Guard against HTTP inter-protocol exploitation attacks.

Reported by Christopher Allan Webber <cwebber@dustycloud.org>
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit adds protection to Guile's REPL servers against HTTP
inter-protocol exploitation attacks, a scenario whereby an attacker can,
via an HTML page, cause a web browser to send data to TCP servers
listening on a loopback interface or private network.  See
<https://en.wikipedia.org/wiki/Inter-protocol_exploitation> and
<https://www.jochentopf.com/hfpa/hfpa.pdf>, The HTML Form Protocol
Attack (2001) by Tochen Topf <jochen@remote.org>.

Here we add a procedure to 'before-read-hook' that looks for a possible
HTTP request-line in the first line of input from the client socket.  If
present, the socket is drained and closed, and a loud warning is written
to stderr (POSIX file descriptor 2).

* module/system/repl/server.scm: Add 'maybe-check-for-http-request'
to 'before-read-hook' when this module is loaded.
(with-temporary-port-encoding, with-saved-port-line+column)
(drain-input-and-close, permissive-http-request-line?)
(check-for-http-request, guard-against-http-request)
(maybe-check-for-http-request): New procedures.
(serve-client): Use 'guard-against-http-request'.
* module/system/repl/coop-server.scm (start-repl-client): Use
'guard-against-http-request'.
* doc/ref/guile-invoke.texi (Command-line Options): In the description
of the --listen option, make the security warning more prominent.
Mention the new protection added here.  Recommend using UNIX domain
sockets for REPL servers.  "a path to" => "the file name of".

8 years agotests: Use the "normalized codeset" in locale names.
Ludovic Courtès [Tue, 11 Oct 2016 09:09:46 +0000 (11:09 +0200)]
tests: Use the "normalized codeset" in locale names.

* test-suite/tests/i18n.test (%french-locale-name)
(%french-utf8-locale-name, %turkish-utf8-locale-name)
(%german-utf8-locale-name, %greek-utf8-locale-name): Use the normalized
codeset for ISO-8859-1 and UTF-8.

8 years agoTreat 'SIG_IGN' as a pointer.
Ludovic Courtès [Tue, 11 Oct 2016 08:57:43 +0000 (10:57 +0200)]
Treat 'SIG_IGN' as a pointer.

* libguile/posix.c (scm_system_star): Cast 'SIG_IGN' to
'scm_t_uintptr_t' and use 'scm_from_uintptr_t'.  This fixes an
'int-conversion' warning with GCC 6.2.

8 years agoDocument 'scm_to_uintptr_t' and 'scm_from_uintptr_t'.
Ludovic Courtès [Tue, 11 Oct 2016 08:55:23 +0000 (10:55 +0200)]
Document 'scm_to_uintptr_t' and 'scm_from_uintptr_t'.

* doc/ref/api-data.texi (Integers): Document them.

8 years agoRemove 'umask' calls from 'mkdir'.
Ludovic Courtès [Tue, 11 Oct 2016 08:14:26 +0000 (10:14 +0200)]
Remove 'umask' calls from 'mkdir'.

Fixes <http://bugs.gnu.org/24659>.

* libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is
unbound; instead, use 0777 as the mode.  Update docstring to clarify
this.
* doc/ref/posix.texi (File System): Adjust accordingly.
* NEWS: Mention it.

8 years ago%port-encoding requires an open port
Andy Wingo [Wed, 1 Mar 2017 18:52:17 +0000 (19:52 +0100)]
%port-encoding requires an open port

* libguile/ports.c (scm_sys_port_encoding)
  (scm_sys_set_port_encoding_x): Require an open port, to match 2.0
  behavior.

8 years agohttp: Do not use 'eq?' to compare characters in parse-request-uri.
Mark H Weaver [Fri, 9 Sep 2016 11:32:53 +0000 (07:32 -0400)]
http: Do not use 'eq?' to compare characters in parse-request-uri.

* module/web/http.scm (parse-request-uri): Use 'eqv?' to compare
characters.

8 years agobuild: .x and .doc files depend on generated includes.
Mark H Weaver [Thu, 11 Aug 2016 07:59:40 +0000 (03:59 -0400)]
build: .x and .doc files depend on generated includes.

Fixes <https://bugs.gentoo.org/show_bug.cgi?id=590528>.

* libguile/Makefile.am (BUILT_INCLUDES): New variable.
(BUILT_SOURCES): Put generated .h to BUILT_INCLUDES.
(DOT_X_FILES, EXTRA_DOT_X_FILES, DOT_DOC_FILES, EXTRA_DOT_DOC_FILES):
Depend on $(BUILT_INCLUDES), in place of scmconfig.h which is included
in $(BUILT_INCLUDES).

8 years agotexinfo: Remove unnecessary (oop goops) dependency.
Ludovic Courtès [Thu, 4 Aug 2016 17:14:30 +0000 (19:14 +0200)]
texinfo: Remove unnecessary (oop goops) dependency.

* module/texinfo/string-utils.scm: Remove #:use-module (oop goops).

8 years agoDo not assume that sizeof (long) == sizeof (void *) == sizeof (SCM).
Mark H Weaver [Wed, 6 Apr 2016 21:36:57 +0000 (17:36 -0400)]
Do not assume that sizeof (long) == sizeof (void *) == sizeof (SCM).

This assumption does not hold on systems that use the LLP64 data model.

Partially fixes <https://debbugs.gnu.org/22406>.
Reported by Peter TB Brett <peter@peter-b.co.uk>.

* libguile/numbers.h (scm_t_inum): Move here from numbers.c, and change
  to be equivalent to 'long' (formerly 'scm_t_signed_bits').
  (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Define based on
  SCM_I_FIXNUM_BIT instead of SCM_T_SIGNED_BITS_MAX.
  (SCM_I_INUM): Adjust definitions to return a 'scm_t_inum', and avoiding
  the assumption that SCM_UNPACK returns a 'long'.
* libguile/numbers.c (scm_t_inum): Move definition to numbers.h.
  Verify that 'scm_t_inum' fits within a SCM value.
  (scm_i_inum2big): Remove preprocessor code that forced a compile error
  unless sizeof (long) == sizeof (void *).

8 years agoAvoid signed integer overflows in numeric conversions.
Mark H Weaver [Wed, 24 Feb 2016 07:17:43 +0000 (02:17 -0500)]
Avoid signed integer overflows in numeric conversions.

Reported by Miroslav Lichvar <mlichvar@redhat.com>
in <https://lists.gnu.org/archive/html/guile-devel/2016-02/msg00045.html>

* libguile/conv-integer.i.c: Avoid signed overflow.
* libguile/numbers.c (scm_is_signed_integer): Avoid signed overflow.

8 years agoRemove extraneous debugging output in test
Andy Wingo [Wed, 1 Mar 2017 11:28:03 +0000 (12:28 +0100)]
Remove extraneous debugging output in test

* test-suite/standalone/test-scm-c-bind-keyword-arguments.c
  (missing_value_error_handler): Remove debugging write.

8 years agoFix open-file mode misinterpretation
Andy Wingo [Wed, 1 Mar 2017 16:34:41 +0000 (17:34 +0100)]
Fix open-file mode misinterpretation

* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument
  is string.  Fixes #25498.

8 years ago"select" no longer throws exception on EINTR
Andy Wingo [Wed, 1 Mar 2017 16:25:59 +0000 (17:25 +0100)]
"select" no longer throws exception on EINTR

* doc/ref/posix.texi (Ports and File Descriptors): Update.
* libguile/filesys.c (scm_select): Use scm_std_select so that pending
  interrupts can be delivered.  On EINTR or EAGAIN, just return directly
  so that calling Scheme code can run asyncs.

8 years agoscm_std_select doesn't tick itself
Andy Wingo [Wed, 1 Mar 2017 16:23:48 +0000 (17:23 +0100)]
scm_std_select doesn't tick itself

* libguile/threads.c (scm_std_select): If there are unblocked asyncs
  pending, return directly instead of ticking ourselves.

8 years agoCosmetic REPL server improvements
Andy Wingo [Wed, 1 Mar 2017 16:23:29 +0000 (17:23 +0100)]
Cosmetic REPL server improvements

* module/system/repl/server.scm (run-server*): Cosmetic improvements.

8 years agoFix trap frame matching
Andy Wingo [Wed, 1 Mar 2017 15:06:53 +0000 (16:06 +0100)]
Fix trap frame matching

* module/system/vm/traps.scm (program-last-ip): Actually return an
  absolute IP.  Fixes traps!

8 years agoFix class slot allocation since GOOPS rewrite
Andy Wingo [Wed, 1 Mar 2017 14:37:05 +0000 (15:37 +0100)]
Fix class slot allocation since GOOPS rewrite

* module/oop/goops.scm (%compute-layout): Fix class slot layout.
  Before, a #:class that was an argument to #:allocation was getting
  interpreted as a keyword with a value.
* test-suite/tests/goops.test ("#:class slot allocation"): Add test.

8 years agoFix (mkstemp! "XX" 0) errors
Andy Wingo [Wed, 1 Mar 2017 13:48:37 +0000 (14:48 +0100)]
Fix (mkstemp! "XX" 0) errors

* libguile/filesys.c (scm_i_mkstemp): Validate "mode" argument as a
  string, and validate writability of template string early too.  Thanks
  to Jean Louis for the bug report.

8 years agoFlush when getting string from r6rs string output port
Andy Wingo [Wed, 1 Mar 2017 13:24:41 +0000 (14:24 +0100)]
Flush when getting string from r6rs string output port

* module/rnrs/io/ports.scm (open-string-output-port): Calling the
  get-string proc should flush the buffer and reset the file position.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests.
  Thanks to Freja Nordsiek for the report.

8 years agoString ports can be truncated
Andy Wingo [Wed, 1 Mar 2017 13:14:06 +0000 (14:14 +0100)]
String ports can be truncated

* libguile/strports.c (string_port_truncate):
  (scm_make_string_port_type): Support truncate-file on string ports.
* test-suite/tests/ports.test ("string ports"): Add tests.

8 years agoMinor expansion of guile-test comments
Andy Wingo [Wed, 1 Mar 2017 09:40:52 +0000 (10:40 +0100)]
Minor expansion of guile-test comments

* test-suite/guile-test: Add -L to example.

8 years agoFavor docstrings for describing the purpose of functions.
Wilfred Hughes [Tue, 6 Sep 2016 02:23:13 +0000 (22:23 -0400)]
Favor docstrings for describing the purpose of functions.

* module/ice-9/boot-9.scm: Where functions have docstring-style
  comments, make them proper docstrings.

8 years agoFix "Scheme Syntax" info rendering
Andy Wingo [Wed, 1 Mar 2017 08:41:57 +0000 (09:41 +0100)]
Fix "Scheme Syntax" info rendering

* doc/ref/api-evaluation.texi (Expression Syntax): Fix quote and
  quasiquote so that they actually look different in Info.

8 years agoBetter errors for odd-length keyword args
Andy Wingo [Tue, 28 Feb 2017 19:42:45 +0000 (20:42 +0100)]
Better errors for odd-length keyword args

* libguile/vm-engine.c (bind-kwargs):
* libguile/vm.c (vm_error_kwargs_missing_value):
* libguile/eval.c (error_missing_value)
  (prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior.
* libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise.
* module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw)
  with a "Keyword argument has no value" instead of the horrible "odd
  argument list length".  Also adapts to the expected args format for
  the keyword-argument-error exception printer in all cases.  Matches
  1.8 optargs behavior also.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value):
  (missing_value_error_handler): Update test.
* test-suite/tests/optargs.test: Add tests.

8 years agoFix segfault introduced with R6RS port commit
Andy Wingo [Tue, 28 Feb 2017 16:02:25 +0000 (17:02 +0100)]
Fix segfault introduced with R6RS port commit

* libguile/init.c (scm_i_init_guile): Move scm_register_r6rs_ports
  later, so that defining port types hsa the SCM trampoline subrs
  defined.
* libguile/bytevectors.c (scm_bootstrap_bytevectors): Cosmetic changes.

8 years ago"Scripting Examples" update.
Andy Wingo [Tue, 28 Feb 2017 15:22:42 +0000 (16:22 +0100)]
"Scripting Examples" update.

* doc/ref/scheme-scripts.texi (Scripting Examples): Mention system* and
  open-pipe.

8 years agoRegister R6RS port and bytevector internals early
Andy Wingo [Thu, 23 Jun 2016 16:31:55 +0000 (18:31 +0200)]
Register R6RS port and bytevector internals early

* libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big
  and scm_sym_little, and don't use the snarf mechanism as we need to
  initialize this value eagerly in case the C API is used before the
  Scheme module is loaded.
  (scm_bootstrap_bytevectors): Initialize the endianness symbols here.
* libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS
  port kinds here, for the same reason.

8 years agoFix support for threads already known to GC
Andy Wingo [Tue, 28 Feb 2017 12:14:02 +0000 (13:14 +0100)]
Fix support for threads already known to GC

* libguile/threads.h (scm_i_thread): Add bool tracking whether the
  thread needs to be unregistered from libgc.
* libguile/threads.c (guilify_self_1): Add needs_unregister arg.
  (on_thread_exit): Only unregister thread if the thread needs it.
  (scm_i_init_thread_for_guile): A thread needs unregistering if
  GC_register_my_thread succeeded.
  (scm_threads_prehistory): Don't unregister initial thread.

  Fixes #19523.  Thanks to Anthonin Bonnefoy for the report.

8 years agoDeclare module exports before loading imports
Andy Wingo [Tue, 28 Feb 2017 10:31:52 +0000 (11:31 +0100)]
Declare module exports before loading imports

* module/ice-9/boot-9.scm (define-module*): Process module imports after
  module exports.  Allows for an additional kind of circular module
  imports (see https://bugs.gnu.org/15540).
* test-suite/tests/modules.test ("circular imports"): Add test.

8 years agoRevert "futures: Limit the number of nested futures on the same stack."
Andy Wingo [Tue, 28 Feb 2017 09:45:21 +0000 (10:45 +0100)]
Revert "futures: Limit the number of nested futures on the same stack."

This reverts commit 8a177d316c0062afe74f9a761ef460e297435e59, though
keeping the additional tests.  (Guile 2.2 doesn't have a fixed stack
limit).

8 years agoFix (* x -1) for GOOPS types
Andy Wingo [Tue, 28 Feb 2017 09:12:57 +0000 (10:12 +0100)]
Fix (* x -1) for GOOPS types

* libguile/numbers.c (scm_product): Only reduce (* x -1) to (- x) when X
  is a bignum.  Fixes weirdness when X is not a number and instead
  multiplication should dispatch to GOOPS.  Thanks to Alejandro Sanchez
  for the report.

8 years agoExplain why no native accessors for `s8' and `u8' exist
Diogo F. S. Ramos [Sun, 26 Feb 2017 22:19:00 +0000 (19:19 -0300)]
Explain why no native accessors for `s8' and `u8' exist

* doc/ref/api-data.texi: Instead of saying it is obvious, explain why
  no native endianness accessors exist for the `s8' and `u8' variants.

8 years agoFix guild compile --to=cps / --from=cps
Andy Wingo [Thu, 23 Feb 2017 10:37:44 +0000 (11:37 +0100)]
Fix guild compile --to=cps / --from=cps

* module/language/cps/spec.scm (read-cps, write-cps): Fix CPS
  serialization and parsing, so that "guild compile" works with --to=cps
  and --from=cps.

8 years agoFix kfun parse-cps bug
Andy Wingo [Thu, 23 Feb 2017 10:37:06 +0000 (11:37 +0100)]
Fix kfun parse-cps bug

* module/language/cps.scm (parse-cps): Fix bug parsing kfun.

8 years agoFixed specific version of guile search in autoconf macro GUILE_PROGS.
Freja Nordsiek [Mon, 10 Oct 2016 08:50:19 +0000 (15:50 +0700)]
Fixed specific version of guile search in autoconf macro GUILE_PROGS.

* meta/guile.m4 (GUILE_PROGS): Search for guile with suffixes
  first ('-X.Y' and 'X.Y' where X.Y denotes the version) before
  searching for guile with no suffix.  Patch co-authored by Andy Wingo.

8 years agoFix typo in old NEWS.
Andy Wingo [Thu, 23 Feb 2017 08:29:31 +0000 (09:29 +0100)]
Fix typo in old NEWS.

* NEWS: Fix typo.

8 years agoFix multi-arity dispatch in GOOPS
Andy Wingo [Wed, 22 Feb 2017 22:07:27 +0000 (23:07 +0100)]
Fix multi-arity dispatch in GOOPS

* module/oop/goops.scm (multiple-arity-dispatcher): Fix dispatch for
  max-arity+1 when a generic is already in multiple-arity dispatch.
  Fixes #24454.
* test-suite/tests/goops.test ("dispatch"): Add test.

8 years agoFix compute-frame-sizes for case-lambda jumps
Andy Wingo [Wed, 22 Feb 2017 21:20:07 +0000 (22:20 +0100)]
Fix compute-frame-sizes for case-lambda jumps

* module/system/vm/frame.scm (compute-frame-sizes): Fix for jumps to the
  next arity.

8 years agoUse labs instead of abs where needed
Andy Wingo [Tue, 21 Feb 2017 21:12:18 +0000 (22:12 +0100)]
Use labs instead of abs where needed

* libguile/numbers.c (log_of_fraction): Use labs instead of abs on
  longs.  Thanks to Matt Wette for the tip.

8 years agoFix make-polar signedness of zeros on macOS
Matt Wette [Tue, 21 Feb 2017 21:07:39 +0000 (22:07 +0100)]
Fix make-polar signedness of zeros on macOS

* configure.ac: Check for __sincos.
* libguile/numbers.c (scm_c_make_polar): Fall back to __sincos if
  possible.  Fixes zero signedness of make-polar on macOS.