The new non-libltdl foreign library loading algorithm from 3.0.6
fails to cover common cases regarding how libtool names and installs
DLL files. Notably, it fails to recognize when libtool has added the
major version number into the filename itself, such as libfoo-1.dll
Also, it does not search in binary directories and the PATH for DLL
files, where libtool is likely to install DLLs.
This adds the option to search for dlls with major version numbers
in the filename, and modifies the search strategy for DLL-using
OSs to check bindir and PATH.
For MSYS, libraries are installed with the 'msys-' prefix. So this
modifies load-foreign-library to handle that prefix as well.
It changes the #:rename-on-cygwin? option to #:host-type-rename? to
better reflect that is works on both Cygwin and MSYS.
Partially based on a patch by Hannes Müller.
* NEWS: updated
* doc/ref/api-foreign.texi: document updates to load-foreign-library
and system-dll-path
* module/system/foreign-library.scm (is-integer-string?): new utility function
(dll-name-match?): new utility function
(find-best-dll-from-matches): new utility function
(dll-exists-with-version): new function that implements new dll search logic
(file-exists-with-extension): add flag argument to allow new dll search
(file-exists-in-path-with-extension): add flag argument to all new dll search
(system-dll-path): new parameter
(lib->msys): new helper function
(load-foreign-library): add new optarg flag #:allow-dll-version-suffix?
Pass new flag to library search functions.
Implement new search strategy for #:search-system-paths? on DLL systems'
replace #:rename-on-cygwin? with #:host-type-rename?
Use that option to rename both MSYS and Cygwin libraries.
(guile-system-extensions-path): prefer bindir to libdir on DLL systems
* test-suite/tests/foreign.test ("dll-name-match?"): new test category
("find-best-dll-from-matches"): new test category
("lib->msys"): new unit tests
doc/ref/posix.texi: note setlocale raises a system-error when locale
doesn't exist
Thanks to Francesco P. Lovergine for suggesting the
addition (https://bugs.debian.org/1078681).
The tutorial was removed in commit f75c5849cd.
* doc/README: Remove reference to a tutorial that no longer exists
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
The ~V is supposed to print ISO week number, not a week number. This
commit fixes that.
* module/srfi/srfi-19.scm (date-week-number-iso): New procedure taken
from the reference implementation.
(directives)<#\V>: Use it.
* test-suite/tests/srfi-19.test ("date->string ~V"): Add tests taken
from the reference test suite.
* doc/ref/srfi-modules.texi (SRFI-19 Date to string): Mention ISO-8601
in description for ~V.
Fixes <https://bugs.gnu.org/74841>.
Edited by lloda <lloda@sarc.name>.
* doc/ref/srfi-modules.texi (SRFI-64 Writing Basic Test Suites): Fix
typo. Add default test runner example. Add test-approximate and
test-error examples. Document valid error types in Guile for test-error.
(SRFI-64 Conditonal Test Suites and Other Advanced Features): Fix typo.
Fixes <https://bugs.gnu.org/75041>.
Suggested-by: Arne Babenhauserheide <arne_bab@web.de>
Looking at the SRFI-19 specification, the argument is called `day', not
`date'. Even the accessor is called `date-day'. So adjust the
documentation to match.
Also adjust the (web http) module, which was using `date' as well.
* doc/ref/srfi-modules.texi (SRFI-19 Date): Use `day' instead of `date'.
* module/web/http.scm (parse-rfc-822-date, parse-rfc-850-date)
(parse-asctime-date): Same.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This is an import of the 'Abstract', 'Rationale', and 'Specification'
sections from the upstream specification text, with some manual
adjustment.
* doc/ref/srfi-modules.texi (SRFI 64): New subsection.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modern PEG supports inversed class like `[^a-z]` that would get any
character not in the `a-z` range. This commit adds support for that and
also for a new `not-in-range` PEG pattern for scheme.
* module/ice-9/peg/codegen.scm (cg-not-in-range): New function.
* module/ice-9/peg/string-peg.scm: Add support for `[^...]`
* test-suite/tests/peg.test: Test it.
* doc/ref/api-peg.texi: Document accordingly.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit adds support for PEG as described in:
<https://bford.info/pub/lang/peg.pdf>
It adds support for the missing features (comments, underscores in
identifiers and escaping) while keeping the extensions (dashes in
identifiers, < and <--).
The naming system tries to be as close as possible to the one proposed
in the paper.
* module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
* test-suite/tests/peg.test: Fix import
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* doc/ref/goops.texi: Insert reference to the "definition" of
next-method the first time next-method is mentioned. Place the
definition of next-method in index. Don't use capital methods in generic
function names (corrected only in one node). In section about
next-method, say that you can provide custom arguments (which we can now
due to the optimizing compiler). New node "Inheritance and accessors"
explaining how new accessor methods are created for subclasses.
This module replaces the method and define-method bindings with their
method* and define-method* counterparts, for use by users who prefer not
to use both kinds of syntactic forms.
* module/oop/goops/keyword-formals.scm: New module.
* am/bootstrap.am: Added
* doc/ref/goops.texi: Document this change.
The current recommendation of `list-copy' is not right and does not lead
to preserving the original list:
scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2)))
scheme@(guile-user)> (define y (list-copy x))
scheme@(guile-user)> (assq-set! y 'b 3)
$1 = ((a . 1) (b . 3))
scheme@(guile-user)> x
$2 = ((a . 1) (b . 3))
Correct approach seems to be use `alist-copy' from SRFI-1 leading to the
expected behavior of:
scheme@(guile-user)> ,use (srfi srfi-1)
scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2)))
scheme@(guile-user)> (define y (alist-copy x))
scheme@(guile-user)> (assq-set! y 'b 3)
$1 = ((a . 1) (b . 3))
scheme@(guile-user)> x
$2 = ((a . 1) (b . 2))
* doc/ref/api-data.texi (Adding or Setting Alist Entries): Recommend
`alist-copy'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
The incorrect procedure is mentioned; see the example that immediately
follows.
* doc/ref/api-foreign.texi (Foreign Functions): fix typo to
pointer->procedure.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
According to the previous wording, omitting all optional arguments led
to empty interface. That however was not the case and was only a
documentation bug (as confirmed by wingo on IRC). So let us fix that.
* doc/ref/api-modules.texi (Using Guile Modules): Fix implication of
omitting optional arguments.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* doc/ref/api-data.texi (Arrays as arrays of arrays): Clarify
ambiguities, fix examples.
* libguile/arrays.c (make-shared-array): Make error messages specific to
each error case, report relevant arguments.
(array_from_pos): Return NULL on error instead of reporting error
ourselves.
(array_from_get_o): Handle the trivial case.
(scm_array_slice, scm_array_cell_ref, scm_array_cell_set_x): Don't
build error arguments before error happens. Let array_from_get_o
handle the trivial case.
Fixes <https://bugs.gnu.org/67063>.
* doc/ref/api-io.texi (Venerable Port Interfaces): Bring unread-string
procedure documentation in line with other procedures in the section.
* libguile/ports.c (scm_unread_string): Make port argument optional.
* test-suite/tests/ports.test: Test unread-char and unread-string
without ports.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* libguile/ports.c (scm_seek): Let SEEK_DATA and SEEK_HOLE through.
(scm_init_ice_9_ports): Define ‘SEEK_DATA’ and ‘SEEK_HOLE’.
* module/ice-9/ports.scm: Export ‘SEEK_DATA’ and ‘SEEK_HOLE’ when
defined.
* test-suite/tests/ports.test ("size of sparse file")
("SEEK_DATA while on data", "SEEK_DATA while in hole")
("SEEK_HOLE while in hole"): New tests.
* NEWS: Update.
* doc/ref/api-procedures.texi: remove make-binding, binding:name,
binding:boxed?, binding:index, binding:start, and binding:end since they
no longer exist.
cf. 1a2711a848
On modern file-systems (BTRFS, ZFS) it is possible to copy a file using
copy-on-write method. For large files it has the advantage of being
much faster and saving disk space (since identical extents are not
duplicated). This feature is stable and for example coreutils' `cp'
does use it automatically (see --reflink).
This commit adds support for this feature into our copy-file procedure.
Same as `cp', it defaults to 'auto, meaning the copy-on-write is
attempted, and in case of failure the regular copy is performed.
No tests are provided, because the behavior depends on the system,
underlying file-system and its configuration. That makes it challenging
to write a test for it. Manual testing was performed instead:
$ btrfs filesystem du /tmp/cow*
Total Exclusive Set shared Filename
36.00KiB 36.00KiB 0.00B /tmp/cow
$ cat cow-test.scm
(copy-file "/tmp/cow" "/tmp/cow-unspecified")
(copy-file "/tmp/cow" "/tmp/cow-always" #:copy-on-write 'always)
(copy-file "/tmp/cow" "/tmp/cow-auto" #:copy-on-write 'auto)
(copy-file "/tmp/cow" "/tmp/cow-never" #:copy-on-write 'never)
(copy-file "/tmp/cow" "/dev/shm/cow-unspecified")
(copy-file "/tmp/cow" "/dev/shm/cow-auto" #:copy-on-write 'auto)
(copy-file "/tmp/cow" "/dev/shm/cow-never" #:copy-on-write 'never)
$ ./meta/guile -s cow-test.scm
$ btrfs filesystem du /tmp/cow*
Total Exclusive Set shared Filename
36.00KiB 0.00B 36.00KiB /tmp/cow
36.00KiB 0.00B 36.00KiB /tmp/cow-always
36.00KiB 0.00B 36.00KiB /tmp/cow-auto
36.00KiB 36.00KiB 0.00B /tmp/cow-never
36.00KiB 0.00B 36.00KiB /tmp/cow-unspecified
$ sha1sum /tmp/cow* /dev/shm/cow*
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /tmp/cow
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /tmp/cow-always
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /tmp/cow-auto
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /tmp/cow-never
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /tmp/cow-unspecified
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /dev/shm/cow-auto
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /dev/shm/cow-never
4c665f87b5dc2e7d26279c4b48968d085e1ace32 /dev/shm/cow-unspecified
This commit also adds to new failure modes for (copy-file).
Failure to copy-on-write when 'always was passed in:
scheme@(guile-user)> (copy-file "/tmp/cow" "/dev/shm/cow" #:copy-on-write 'always)
ice-9/boot-9.scm:1676:22: In procedure raise-exception:
In procedure copy-file: copy-on-write failed: Invalid cross-device link
Passing in invalid value for the #:copy-on-write keyword argument:
scheme@(guile-user)> (copy-file "/tmp/cow" "/dev/shm/cow" #:copy-on-write 'nevr)
ice-9/boot-9.scm:1676:22: In procedure raise-exception:
In procedure copy-file: invalid value for #:copy-on-write: nevr
* NEWS: Add note for copy-file supporting copy-on-write.
* configure.ac: Check for linux/fs.h.
* doc/ref/posix.texi (File System)[copy-file]: Document the new
signature.
* libguile/filesys.c (clone_file): New function cloning a file using
FICLONE, if supported.
(k_copy_on_write): New keyword.
(sym_always, sym_auto, sym_never): New symbols.
(scm_copy_file2): Renamed from scm_copy_file. New #:copy-on-write
keyword argument. Attempt copy-on-write copy by default.
(scm_copy_file): Call scm_copy_file2.
* libguile/filesys.h: Add scm_copy_file2 as SCM_INTERNAL.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
While the `.' might be correct from a grammatical point of view (I do
not know), it turns the example into invalid scheme code, which is not
ideal. New users (like me) might try to copy the whole line and wonder
why it does not work (like I did). So delete it.
* doc/ref/srfi-modules.texi (SRFI-171 General Discussion): Delete the
trailing . from the example.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes <https://bugs.gnu.org/63366>.
Suggested by Sebastian Carlos <sebaaa1754@gmail.com>.
* doc/ref/intro.texi (Introduction): Remove reference to Python and
Perl, which no longer have “benevolent dictators”.
Recognize `raise-exception` in the same way we recognize `throw`, though
it is a bit less optimized and the boot story is not as complicated.
* doc/ref/vm.texi (Non-Local Control Flow Instructions):
* libguile/jit.c (compile_unreachable):
(compile_unreachable_slow):
* libguile/vm-engine.c (VM_NAME):
* module/language/cps/compile-bytecode.scm (compile-function):
* module/system/vm/assembler.scm (emit-unreachable): Add new
"unreachable" instruction, inserted after a call to non-continuable
`raise-exception`.
* module/language/tree-il/compile-cps.scm (raise-exception):
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Recognize raise-exception, and if it is
called with just one argument, prune that branch of the control-flow
graph.
* doc/r5rs/r5rs.texi: Revert c7d170c5d1,
as R5RS is a historical document, and our packaging of it is something
that other people rely on. See also
7fb9c4aff2 when I was also bitten by this
error!
* doc/ref/api-macros.texi (Syntax Rules): Use archived URL from
Internet Archive for syntax-rules primer.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>