Fix file descriptor leaks in tcp that happen in case of exceptions before a port or a listener gets returned to the caller. These close the file descriptor and report the original errno corresponding to the error that occurred even if close() modified errno.

Originally suggested by Florian Zumbiehl.  This patch is based on his
work, but it also simplifies tcp-listen by removing the unused
multi-value return in ##net#bind-socket, and replacing let-optionals
with the much simpler DSSSL optionals.

Signed-off-by: Moritz Heidkamp <moritz@twoticketsplease.de>
Add make-promise from R7RS to core

This also introduces tests/r7rs-tests: A place for the R7RS tests that
don't belong anywhere else.

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Make vectors, srfi-4 vectors self-evaluating, for R7RS compat. Blobs are made self-evaluating as well, for consistency reasons.

This also adds a convenience predicate number-vector? which checks
whether an object is of any of the SRFI-4 homogeneous number vector
types.

Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>
Clean up R7RS test helpers code and add test-error
Add specialisation for make-promise, retain procedures as they are

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Fix r7rs tests:
* Add exit status to error reporting.
* Fix some of the vector tests themselves, so they don't fail with a hard error.
* Add r7rs-tests to the Windows batch file
Added #\null and #\escape character literal names, for R7RS compatibility.

WRITE now uses this instead of the old #\nul and #\esc, so other impls
can READ s-expression written by CHICKEN.  Unfortunately, the flip side
is that older CHICKENs can't READ data written by newer CHICKENs.
Add support for R7RS's "indented string" escape syntax.

This allows the user to "escape" all whitespace surrounding *one*
newline with a backslash, causing all of this to be completely
collapsed to nothing.  This is useful when writing long string
literals which should be broken up into multiple lines.

This also adds some tests for other R7RS escape syntax, most of which
we already supported anyway.  There's only the escaped hex scalar
value left, which is ambiguous with regard to the old CHICKEN hex
scalar syntax.
remove redundant call to rm eggdir on uninstall

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Improve read-symbolic-link canonicalization

Passing #t for the CANONICALIZE option of read-symbolic-link now behaves
like the --canonicalize option of readlink(1), i.e. it recursively
follows every symlink in every component of the given path. When called
like this, read-symbolic-link like readlink(1) now verifies that all
components exist.

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Fix read-symbolic-link types.db entry

The optional CANONICALIZE argument was missing.

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Make tests work from symlinked paths

The private repository path tests didn't work when run from inside a
path containing symlinks because runtests.sh didn't expand symlinks
while the -private-repository mechanism does. This lead the test
assertion which compares the two paths to fail.

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
use internal process-wait procedure in ##sys#process

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Adds argument-type check on getter-with-setter

===== before:

$ csi -p '(getter-with-setter (void) (void))'
Segmentation fault (core dumped)

===== after:

$ csi -p '(getter-with-setter (void) (void))'
Error: (getter-with-setter) bad argument type - not a procedure: #<unspecified>

	Call history:

	<syntax>	  (getter-with-setter (void) (void))
	<syntax>	  (void)
	<syntax>	  (void)
	<eval>	  (getter-with-setter (void) (void))
	<eval>	  (void)
	<eval>	  (void)	<--

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>
add => syntax for case clauses

Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>
Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Add CASE => syntax to NEWS and manual.
Use inexact comparison for flonum tests.

GCC optimizes trig functions (by inlining? pre-calculating?), which
causes answers to be slightly different from the libc implementation.
Thanks to John Long for reporting and Sven Hartrumpf for initial patch.
handle CR & CRLF-terminated lines when collapsing intraline whitespace

Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
Signed-off-by: Moritz Heidkamp <moritz@twoticketsplease.de>
Add tests for #978 (read-line port position).

Tests are added for string ports, process ports and TCP ports.
Process and TCP tests are disabled by default as they are
dependent on environment or slightly fragile (although the
behavior has been verified here).
Restore row and column number tracking in read-line (partially fixes #978)