1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00
Commit graph

15984 commits

Author SHA1 Message Date
Ludovic Courtès
f2764cb103 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'.
2017-02-11 22:00:18 +01:00
Mark H Weaver
458ae248ab 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>
2016-12-30 21:58:44 +01:00
Ludovic Courtès
54b43451ef 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'.
2016-12-14 17:20:00 +01:00
Ludovic Courtès
2fbde7f02a 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'.
2016-11-04 22:45:51 +01:00
Ludovic Courtès
8d6209ea56 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.
2016-11-04 22:44:32 +01:00
Ludovic Courtès
272473fee4 scandir: Avoid 'stat' calls on each entry.
* module/ice-9/ftw.scm (scandir): Rewrite in terms of 'readdir'.
2016-10-28 22:17:10 +02:00
Ludovic Courtès
89ce9fb31b build: Compress with lzip too.
* configure.ac: Add 'dist-lzip' Automake option.
2016-10-12 12:23:48 +02:00
Ludovic Courtès
5c6bd9598d 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.
2016-10-12 12:23:46 +02:00
Ludovic Courtès
cd1b530b2a Bump version number to 2.0.13.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_REVISION): Increment.
2016-10-12 10:38:16 +02:00
Ludovic Courtès
606cf7f7f4 Update 'NEWS'. 2016-10-12 10:33:06 +02:00
Ludovic Courtès
52cf9b2a2c build: Avoid use of Bash's $(...) construct in 'configure'.
This is a followup to be8be776df.

* acinclude.m4 (GUILE_CHECK_GUILE_FOR_BUILD): Use backquotes instead of
$(...).
2016-10-12 10:33:06 +02:00
Ludovic Courtès
66689cc004 tests: Add REPL server test for CVE-2016-8606.
This is a followup to 08c021916d.

* test-suite/tests/00-repl-server.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.
2016-10-12 09:37:18 +02:00
Mark H Weaver
08c021916d 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".
2016-10-11 11:29:09 +02:00
Ludovic Courtès
4a21e5f200 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.
2016-10-11 11:09:46 +02:00
Ludovic Courtès
7043b7ff64 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.
2016-10-11 10:57:43 +02:00
Ludovic Courtès
79bac3bf31 Add 'scm_to_uintptr_t' and 'scm_from_uintptr_t'.
* libguile/numbers.h (scm_to_uintptr_t, scm_from_uintptr_t): New
macros.
* doc/ref/api-data.texi (Integers): Document them.
* NEWS: Mention it.
2016-10-11 10:57:18 +02:00
Ludovic Courtès
2456089116 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.
2016-10-11 10:23:57 +02:00
Mark H Weaver
4f324684cc Check for closed port in 'port-encoding' and 'set-port-encoding!'.
* libguile/ports.c (scm_port_encoding, scm_set_port_encoding_x): Use
SCM_VALIDATE_OPPORT.
2016-09-09 07:34:52 -04:00
Mark H Weaver
622bd8f14b http: Do not use 'eq?' to compare characters in parse-request-uri.
* module/web/http.scm (parse-request-uri): Use 'eqv?' to compare
characters.
2016-09-09 07:32:53 -04:00
Andy Wingo
78eb40c066 Move system* to posix.c, impl on open-process
* libguile/simpos.c: Trim includes.
  (scm_system_star): Move to posix.c.
* libguile/simpos.h (scm_system_star): Remove.
* libguile/posix.h (scm_system_star): Add.
* libguile/posix.c (scm_system_star): Move here and implement in terms
  of open-process.  This lets system* work on Windows.  Inspired by a
  patch by Eli Zaretskii.
  (start_child): Exit with 127 if the command isn't found.
2016-08-31 10:47:03 +02:00
Mark H Weaver
9eb8c3652d
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 .i and other 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).
2016-08-11 05:44:03 -04:00
Mark H Weaver
86278b4bbd
Revert "Snarfing .x depends on built headers"
This reverts commit edd6d6e280.

As reported at <https://bugs.gentoo.org/show_bug.cgi?id=590528#c10>,
that commit failed to fix the bug.

That commit was based on the mistaken belief that the make rule syntax
".c.x: $(BUILT_INCLUDES)" means the same as ".c.x:" but with the added
prerequisites "$(BUILT_INCLUDES)".  However, as explained in section
10.7 (Old-Fashioned Suffix Rules) of the GNU Make manual:

      Suffix rules cannot have any prerequisites of their own.  If they
   have any, they are treated as normal files with funny names, not as
   suffix rules.  Thus, the rule:

        .c.o: foo.h
                $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

   tells how to make the file '.c.o' from the prerequisite file 'foo.h',
   and is not at all like the pattern rule:

        %.o: %.c foo.h
                $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

   which tells how to make '.o' files from '.c' files, and makes all
   '.o' files using this pattern rule also depend on 'foo.h'.
2016-08-11 05:43:50 -04:00
James Clarke
664586aff4 Recognize alpha as compilation target
* module/system/base/target.scm (cpu-endianness): Add case for "alpha".
(triplet-pointer-size): Likewise.
2016-08-08 22:21:09 +02:00
sirgazil
c5f00813e9 Fix typo about variable definitions
* doc/ref/api-binding.texi (Top Level Variable Definitions): Fix typo.
2016-08-08 22:20:51 +02:00
Ethan Stefan Day
6a22d42fbc Documentation fixes
* doc/ref/api-compound.texi:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi: Fix typos and clarify.
2016-08-08 22:20:51 +02:00
David Kastrup
a3ad59be1b Let assv/assoc shortcircuit to assq where feasible
* libguile/alist.c (scm_sloppy_assv, scm_sloppy_assoc):
  (scm_assv, scm_assoc): Shortcircuit to scm_assq where feasible.
2016-08-07 23:22:43 +02:00
Andy Wingo
681acfd8ba Fix iconv encoding of long strings
* libguile/print.c (display_string_using_iconv): If the encoding the
  full utf8 buffer would overflow the output buffer, just keep trucking
  instead of erroring.  Fixes #22667.
* test-suite/tests/iconv.test ("round-trip"): Add some tests.
2016-08-07 23:20:00 +02:00
Marek Vasut
f9f438d471 Recognize nios2 as compilation target
Add support for the nios2 architecture.

Signed-off-by: Marek Vasut <marex@denx.de>
2016-08-07 13:32:08 +02:00
Andy Wingo
be8be776df Capture full path to GUILE_FOR_BUILD.
* acinclude.m4: Capture full path to GUILE_FOR_BUILD.  Fixes #22342.
2016-08-07 13:32:03 +02:00
Calvin Heim
85f1894dfa Fix grammar in api-compound.texi
* doc/ref/api-compound.texi: Fix grammar.
2016-08-07 13:31:50 +02:00
sirgazil
aca6a8a46e Fix typo about pattern variables
* doc/ref/sxml-match.texi (Matching XML Elements): Fix typo.
2016-08-07 13:31:43 +02:00
Andy Wingo
355986773d Manual recommends against SRFI-10
* doc/ref/srfi-modules.texi (SRFI-10): Deprecate, or at least recommend
  against.
2016-08-07 13:31:37 +02:00
Andy Wingo
edd6d6e280 Snarfing .x depends on built headers
* libguile/Makefile.am (BUILT_INCLUDES): New variable.
  (BUILT_SOURCES): Put .i and other generated .h to BUILT_INCLUDES.
  (.c.x, .c.doc): Depend on BUILT_INCLUDES.  Fixes
  https://bugs.gentoo.org/show_bug.cgi?id=590528.
2016-08-07 12:25:35 +02:00
Ludovic Courtès
26cf7843c6 texinfo: Remove unnecessary (oop goops) dependency.
* module/texinfo/string-utils.scm: Remove #:use-module (oop goops).
2016-08-04 19:15:09 +02:00
Eli Zaretskii
8a1fb459eb Avoid compilation warnings about alloca in read.c
* libguile/read.c: Include alloca.h.
2016-07-24 18:13:29 +03:00
Andy Wingo
b491b32cd1 Fix --without-threads against threaded BDW-GC
* libguile/gc.c (scm_storage_prehistory): Prevent BDW-GC from spawning
  marker threads if Guile was built without threading support.
2016-07-24 15:29:48 +02:00
Andy Wingo
bee0bbf4a5 Reimplement null-threads as inline functions
* libguile/null-threads.h: Reimplement null-threads stubs for pthread
  data types, initializers, and functions in terms of types and inline
  functions instead of CPP macros.  Fixes unused-value warnings, and
  tightens things up in general.
  (scm_i_pthread_cleanup_push, scm_i_pthread_cleanup_pop): Remove these,
  as they were unused and incorrect -- they would never run the cleanup
  handler even if 1 was passed to pop.
2016-07-24 13:16:45 +02:00
Andy Wingo
1d128fb4e8 Use non-deprecated HAVE_STRUCT_TM_TM_ZONE
* libguile/stime.c: Change uses of the deprecated HAVE_TM_ZONE to the
  new HAVE_STRUCT_TM_TM_ZONE.
2016-07-23 14:07:11 +02:00
Andy Wingo
681914d2f0 Use gnulib for basename / dirname
* libguile/filesys.c (scm_dirname, scm_basename): Rewrite to use
  gnulib's dirname-lgpl.
2016-07-23 13:49:39 +02:00
Andy Wingo
86770e10fe Gnulib: Add dirname-lgpl.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Add dirname-lgpl.
2016-07-23 13:49:39 +02:00
Ludovic Courtès
141e390b59 doc: Add unquote and unquote-splicing examples.
Suggested by Vincent Legoll <vincent.legoll@gmail.com>.

* doc/ref/api-evaluation.texi (Expression Syntax): Add an unquote and an
unquote-splicing example.
2016-07-22 16:40:01 +02:00
Eli Zaretskii
3dcd6341ac Untabify posix-w32.c 2016-07-16 20:00:56 +03:00
Eli Zaretskii
5079adea75 Improve process handling on MS-Windows
* libguile/posix-w32.c: Include gc.h and threads.h.
(proc_record): New structure tag.
<procs, proc_size>: New static variables.
(find_proc, proc_handle, record_proc, delete_proc): New utility
functions.
(start_child): Return value is now pid_t, as it is on Posix
platforms.  Record the new process and returns its PID, instead of
returning a handle.  Fix the recursive call.
(waitpid, kill, getpriority, setpriority, sched_getaffinity)
(sched_setaffinity): Look up the PID in the recorded subprocesses
before trying to open a process that is not our subprocess.  Make
sure any open handle is closed before returning, unless it's our
subprocess.
2016-07-16 19:58:25 +03:00
Andy Wingo
3f9ae30bd9 Fix mkstemp! with 1 argument
* libguile/filesys.c (scm_i_mkstemp): Add SCM_OPN to flags if mode
  argument not given.
2016-07-16 15:45:37 +02:00
Andy Wingo
0cf62c576d Allow mkstemp! to have optional "mode" argument
* m4/mkstemp.m4: Remove.
* lib/mkstemp.c: Remove.
* lib/mkostemp.c: New file.
* m4/mkostemp.m4: New file.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Remove mkstemp module, replace with mkostemp.

* libguile/fports.h:
* libguile/fports.c (scm_i_mode_to_open_flags): Factor out helper to
  parse mode string to open flags.
  (scm_open_file_with_encoding): Use the new helper.
* libguile/filesys.c:
  (scm_i_mkstemp): Adapt to take optional second argument, being a mode
  string.  Use mkostemp.
  (scm_mkstemp): Backwards compatible shim that calls scm_i_mkstemp.

* doc/ref/posix.texi:
* NEWS: Update.

* module/system/base/compile.scm (call-with-output-file/atomic): Pass
  "wb" as mode, to cause O_BINARY to be added on MinGW.
2016-07-16 15:37:55 +02:00
Andy Wingo
c691c0e15a Fix bug compiling fixpoint combinator
* module/language/tree-il/peval.scm (<operand>): Rename "alias-value"
  field to "alias", which is now an operand and not an expression.
  This allows the operand to capture its environment; before, the
  alias was being visited in its use environment instead of its
  definition environment.
  (peval): Adapt to operand change.
* test-suite/tests/peval.test ("partial evaluation"): New test.
2016-07-16 12:05:21 +02:00
Ricardo Wurmus
2d6e224003 doc: Do not gender the programmer.
* doc/ref/api-foreign.texi: Replace "his" with "their".
* doc/ref/sxml.texi: Likewise.
2016-07-16 10:59:54 +02:00
Eli Zaretskii
cfb2d58c92 Update uname implementation in posix-w32
* libguile/posix-w32.c (uname): Update to modern processors (ia64 and
  x86_64) and OS versions (Vista to Windows 10).  Delete trailing
  whitespace.
2016-07-16 10:54:45 +02:00
Andy Wingo
21e40ea74c Fix unused static variables in net_db.c
* libguile/net_db.c (SCM_DEFINE_CONSTANT): New helper.  Use it to
  define constants and avoid the unneeded static variables that were
  used before, named "sym_" but actually holding variables.  Thanks to
  Eli Zaretskii for the report.
2016-07-16 10:51:38 +02:00
Andy Wingo
08d368012b Fix MinGW build error
* configure.ac: Fix for recent rename of win32-uname.c to posix-w32.c.
2016-07-16 10:35:21 +02:00