Since ‘*lcm-page-size*’ is 64 KiB, this saves disk space for small ‘.go’
files.
* module/system/vm/linker.scm (link-elf)[write-padding]: Rewrite in
terms of ‘seek’.
When generating the list of test files, ignore any whose names begin
with a dot. If nothing else, this avoids crashing on the symlinks that
Emacs creates for files with pending changes. In that case it creates a
symlink to nowhere until the content is saved or reverted, and those
symlinks produce test failures like this:
Backtrace:
3 (primitive-load "/home/rlb/src/guile/utf8-debug/test-su?")
In ice-9/eval.scm:
619:8 2 (_ #(#(#(#<directory (guile-user) 7f0239b32c80> #) #) #))
In ice-9/ports.scm:
450:11 1 (call-with-input-file "../../libguile/.#strings.c" #<p?> ?)
In unknown file:
0 (open-file "../../libguile/.#strings.c" "r" #:encoding # ?)
ERROR: In procedure open-file:
In procedure open-file: No such file or directory: "../../libguile/.#strings.c"
FAIL: test-bad-identifiers
* test-suite/standalone/test-bad-identifiers: ignore files with names
beginning with a dot.
Adjust guile-test to ignore any test files with names beginning with a
dot.
If nothing else, this avoids make check and ./check-guile failures when
Emacs has unsaved changes to a test file. In that case Emacs creates a
symlink to nowhere until the content is saved or reverted.
* test-suite/guile-test: ignore test files whose names begin with a dot.
* 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
* module/language/cps/effects-analysis.scm (compute-clobber-map):
Previously a whole-object read would not be clobbered by a specific
field write. This crops up for the &read introduced at the site of
`cons` for the synthetic car and cdr definitions. This error was there
before but didn't cause bugs before 3.0.10 because cons got eagerly
lowered to separate allocation and initialization instructions.
* module/language/tree-il/inlinable-exports.scm (inlinable-exp): Call
assq-ref in the right order. Embarrassing!
* module/language/tree-il/peval.scm (peval): Print the symbols so that
we can diagnose later failures.
* module/system/foreign.scm (read-fields, write-fields): Don't return
the final offset, as the offset after the final field is not necessarily
the end of the struct, because of padding.
* module/system/foreign.scm (bytevector-complex-single-native-ref)
(bytevector-complex-single-native-set!)
(bytevector-complex-double-native-ref)
(bytevector-complex-double-native-set!): Be more static in our
definitions.
(compile-time-eval):
(switch/compile-time-keys): New helpers.
(align): Make available at compile-time.
(read-field, read-fields, write-field, write-fields): New helpers. More
efficient than the alist.
(write-c-struct, read-c-struct): Rework in terms of new helpers.
(parse-c-struct): Just use sizeof to get the size.
* libguile/foreign.h:
* libguile/foreign.c: Always define complex-float and complex-double.
Fall back to alignof float / 2*sizeof float if no complex numbers. (But
with C99 surely it exists everywhere.)
* module/system/foreign.scm (*writers*, *readers*): Always include
complex-float and complex-double readers and writers.
* test-suite/tests/foreign.test: Always run the complex tests.
* module/language/tree-il/peval.scm (peval): Handle all lambda inlining
the same, and extend with support for multiple clauses and keyword
arguments.
* test-suite/tests/peval.test ("case-lambda"): Enable kwarg inlining.
Can help reduce case-lambda* / lambda* at Tree-IL optimization-time.
* module/language/tree-il/demux-lambda.scm: New file.
* am/bootstrap.am (SOURCES): Add new file.
* module/language/tree-il/optimize.scm (make-optimizer):
* module/system/base/optimize.scm (available-optimizations): Enable
demux-lambda at level 2.
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>
* module/ice-9/psyntax.scm (analyze-variable): Previously, a reference
to a top-level variable in a module other than the current module would
be silently rewritten to reference the current module, if the variable
was unbound in its original module. This was a hack from the early days
of when we extended psyntax to know about the module system. Fix to
properly use the scope of the introduced binding instead of the scope of
the macro use site.
* test-suite/tests/syntax.test ("macro-introduced cross-module unbound
identifiers"): Add test.
* module/ice-9/psyntax-pp.scm: Regenerate.
config.rpath in the top-level was heavily outdated and unused. The
version of the script in build-aux/ was overwritten by autogen.sh;
commit 7f18b659b9 already tried to remove it two years ago, but did
not add it to .gitignore
* config.rpath, build-aux/config.rpath: Remove.
* .gitignore: Ignore build-aux/config.rpath.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Both macros were missing a quote for the procedure call, causing the
actual return value to be compiled into the ftw.go, instead of the
procedure call. Snippet from disassembly of ftw.go does confirm that:
55 (make-immediate 2 3990) ;; 997 at ice-9/ftw.scm:319:46
56 (make-long-immediate 1 120002) ;; 30000 at ice-9/ftw.scm:320:46
That effectively prevented ftw from entering directories without access
for others. Simple reproduction:
scheme@(guile-user)> ,use (ice-9 ftw)
scheme@(guile-user)> (mkdir "/tmp/xxxx")
scheme@(guile-user)> (chmod "/tmp/xxxx" #o0700)
scheme@(guile-user)> (ftw "/tmp/xxxx" (lambda (_ __ f) (pk f) #t))
;;; (directory-not-readable)
$1 = #t
scheme@(guile-user)> (system "ls -al /tmp/xxxx")
total 0
drwx------ 1 wolf wolf 0 Oct 11 22:54 .
drwxrwxrwt 1 root root 888 Oct 11 22:54 ..
$2 = 0
The fix is to quote the procedure call, leading to the intended
behavior.
Fixes <https://bugs.gnu.org/55344>.
* module/ice-9/ftw.scm (getuid-or-false): Quote the (getuid).
(getgid-or-false): Quote the (getgid).
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Until now, the ./meta/guile was not mentioned anywhere, and therefore it
was not obvious how to run the locally compiled Guile without installing
it.
While modifying the file, I took the liberty to also mention a bit about
compiling Guile using Guix.
Finally, the header lines where cleaned up, ensuring all of them end at
70 and have a leading space.
* HACKING (Hacking It Yourself): Add Guix instructions. Add a note
about meta/guile script.
(Sample GDB Initialization File),
(Naming conventions): Clean up the header line.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/ice-9/psyntax.scm (expand-top-sequence): When making a fresh
name for an introduced identifier, the hash isn't enough: it's quite
possible for normal programs to have colliding hash values, because
Guile's hash functions on pairs doesn't traverse the whole tree.
Therefore, append a uniquifying counter if the introduced name is
already defined in the current expansion unit.
* test-suite/tests/syntax.test ("duplicate top-level introduced
definitions"): Add test.
If `join-thread' timeout, the thread mutex is not unlocked, resulting in
deadlock to the next call to it or deadlock of the thread itself when it
terminates.
Thus, always unlock the mutex.
Fixes <https://bugs.gnu.org/55356>.
* module/ice-9/threads.scm (join-thread): Always unlock thread mutex.
* test-suite/tests/threads.test (join-thread): New test to ensure the
mutex is released.
* NEWS: Update.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes a regression introduced in
5a8502a494 and uncovered with
‘-DSCM_DEBUG_TYPING_STRICTNESS=2’ builds.
* libguile/scmsigs.c (scm_i_close_signal_pipe): Test
‘scm_i_signal_delivery_thread’ with ‘scm_is_true’ rather than pointer
equality.
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”.
Fixes <https://bugs.gnu.org/68087>.
* libguile/scmsigs.h (scm_i_signals_pre_fork, scm_i_signals_post_fork):
New declarations.
(scm_i_signal_delivery_thread): Change type to SCM..
* libguile/threads.c (scm_all_threads): Adjust accordingly and exclude
threads that have ‘t->exited’. Access ‘thread_count’ after grabbing
‘thread_admin_mutex’.
* libguile/posix.c (scm_fork): Add calls to ‘scm_i_signals_pre_fork’ and
‘scm_i_signals_post_fork’.
* libguile/scmsigs.c (signal_delivery_thread): Close signal_pipe[0] upon
exit and set it to -1.
(once): New file-global variable, moved from…
(scm_i_ensure_signal_delivery_thread): … here.
(stop_signal_delivery_thread, scm_i_signals_pre_fork)
(scm_i_signals_post_fork): New functions.
* test-suite/standalone/test-sigaction-fork: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.