Maxim Cournoyer <maxim.cournoyer@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 14 Sep 2024 01:36:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 13 21:36:37 2024 Received: from localhost ([127.0.0.1]:44485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1spHiG-0007ng-PB for submit <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:37 -0400 Received: from mail-pl1-f179.google.com ([209.85.214.179]:59522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1spHiD-0007n2-IY for 66046 <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:34 -0400 Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2053f6b8201so25896885ad.2 for <66046 <at> debbugs.gnu.org>; Fri, 13 Sep 2024 18:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726277717; x=1726882517; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XtN6jyhz3HEO8LSqqtB0MoKEim0CLIk/N+iFpFFXCYc=; b=liGAAJfURTbAJlzGHzcRWK8+mANCIgxtBptwLn8B7Kzu05JJhaNierPrECGgiyXG11 Ap+iSwNZUreqQk1s1b9oMd5gPWOfI9+A4TTHb4TUJ8r6Yv8dZng83eh78feJYsvWyys9 e3/iAg40v8SKzb4dXc4X8nsOJJIlAt0QXKPL5LXucrDxCcQgjAbO9hy0XWWr+8mrg6CT eON6I/pPF+8RKenK1YsyPTW93QhCn+DLs2YkssbfEUd99jLRJs1+9atUJwbRruPL17RU 4I342/A/vSkBagTkrgqHu6n1VK8XFhucKmFV5iKfvOHdUfJYte/CygpEPsOfBPtN5NPV iXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726277717; x=1726882517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XtN6jyhz3HEO8LSqqtB0MoKEim0CLIk/N+iFpFFXCYc=; b=pinoUIIksNKL2k1AfOPDscflNmmMf7iySmoL6rqAU92E/cxNIlGEIIqTdCRtI2UNp9 jZWgyxpmZloSqe7OjBJOcSh/cXBZKYCuMxZF2baR2efC9KV79oo5WgzK0tc3CdcTDEUs CBKAMo/aMdLizT1X5FrSJmO8IZ87bX/SfC52EYaRuUoizCS/2bIaK8jpyjyqo2oD1RAf /UWFRHX19x11zoyO0b7WfVESASYKll9ajjmhqvnyBuIQoX3VocO9GJwErnqS7uzWiDDo YSf3GSXcS0nZQk5BVWokard+oJ0hWoQg6GxKqhy5iNhSLuetcwjcd6AbZYChincdYpwP aFBw== X-Gm-Message-State: AOJu0YyfWHpgiKyzKUWcUsqniUtFcvLdkNP/pFPV9nM0bhZLYAAxOWGC 80SMG0QuAVjDaltSxaOD/jIttdx7tLHORNF3AvJPlWtyGK0qfc2hLylpKJVN X-Google-Smtp-Source: AGHT+IFlaYg4nU9zTcJnnhrTos14yVtSMfX7+skpWSBDNFqB8sOTnv75hAj4iM6pdaih34aPPDRhpg== X-Received: by 2002:a17:902:d510:b0:206:b4cf:3107 with SMTP id d9443c01a7336-2076e422055mr135988795ad.49.1726277716851; Fri, 13 Sep 2024 18:35:16 -0700 (PDT) Received: from hurd.lan ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207945da802sm2164505ad.50.2024.09.13.18.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 18:35:16 -0700 (PDT) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v4 3/3] ice-9: Fix 'include' when used in compilation contexts. Date: Sat, 14 Sep 2024 10:34:29 +0900 Message-ID: <20240914013501.6445-3-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240914013501.6445-1-maxim.cournoyer@HIDDEN> References: <20240914013501.6445-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes bug #66046. Introduce a '%file-port-stripped-prefixes' fluid that captures the pre-canonicalized file name used when compiling a file, before it gets modified in fport_canonicalize_filename. That reference that can then used by 'include' when searching for included files. * libguile/fports.c (sys_file_port_stripped_prefixes): New C fluid. (fport_canonicalize_filename): Register dirnames / stripped prefixes pairs in. (%file-port-stripped-prefixes): New corresponding Scheme fluid. * module/ice-9/boot-9.scm (call-with-include-port): New procedure, shadowing that from psyntax, that extends it to use the above fluid to compute a fallback include file directory name to try. * module/ice-9/psyntax.scm (call-with-include-port): Add comment. Strip documentation, as it's now an internal. --- Changes in v4: - Rebase & add NEWS entry Changes in v3: - Move tests hunks to test commit Changes in v2: - Move fluid to where the file name stripping happens, in libguile - Make the fluid value an alist of the last 100 stripped prefixes - Expound test to catch edge case (include in an include) NEWS | 2 ++ libguile/fports.c | 41 +++++++++++++++++++++++++-- module/ice-9/boot-9.scm | 61 ++++++++++++++++++++++++++++++++++++++++ module/ice-9/psyntax.scm | 8 ++---- 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 03bc819bc..8fe6ff6f9 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ Changes in 3.0.11 (since 3.0.10) ** test-hashing should now work on 32-bit systems ** GUILE-VERSION changes should propagate to .version and relevant Makefiles (<https://debbugs.gnu.org/72084>) +** Fix 'include' not finding included files when byte compiling Guile + (<https://bugs.gnu.org/66046>) Changes in 3.0.10 (since 3.0.9) diff --git a/libguile/fports.c b/libguile/fports.c index 8f19216b7..12048828a 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -1,4 +1,4 @@ -/* Copyright 1995-2004,2006-2015,2017-2020,2022 +/* Copyright 1995-2004,2006-2015,2017-2020,2022-2023 Free Software Foundation, Inc. This file is part of Guile. @@ -43,6 +43,7 @@ #include <sys/select.h> #include <full-write.h> +#include "alist.h" #include "async.h" #include "boolean.h" #include "dynwind.h" @@ -59,6 +60,7 @@ #include "ports-internal.h" #include "posix.h" #include "read.h" +#include "srfi-13.h" #include "strings.h" #include "symbols.h" #include "syscalls.h" @@ -123,6 +125,7 @@ SCM_DEFINE (scm_file_port_p, "file-port?", 1, 0, 0, static SCM sys_file_port_name_canonicalization; +static SCM sys_file_port_stripped_prefixes; static SCM sym_relative; static SCM sym_absolute; @@ -143,7 +146,34 @@ fport_canonicalize_filename (SCM filename) "%load-path")); rel = scm_i_relativize_path (filename, path); - return scm_is_true (rel) ? rel : filename; + if (scm_is_true (rel)) + { + SCM relative_dir = scm_dirname (rel); + SCM stripped_prefixes = scm_fluid_ref + (sys_file_port_stripped_prefixes); + + /* Extend the association list if needed, but keep its size + capped to limit memory usage. */ + if (scm_is_false (scm_assoc_ref(stripped_prefixes, relative_dir))) + { + SCM stripped_prefix = scm_string_drop_right + (filename, scm_string_length (rel)); + + stripped_prefixes = scm_cons (scm_cons (relative_dir, + stripped_prefix), + stripped_prefixes); + + if (scm_to_int (scm_length (stripped_prefixes)) > 100) + stripped_prefixes = scm_list_head (stripped_prefixes, + scm_from_int(100)); + + scm_fluid_set_x (sys_file_port_stripped_prefixes, + stripped_prefixes); + } + + return rel; + } + return filename; } else if (scm_is_eq (mode, sym_absolute)) { @@ -766,4 +796,11 @@ scm_init_fports () sys_file_port_name_canonicalization = scm_make_fluid (); scm_c_define ("%file-port-name-canonicalization", sys_file_port_name_canonicalization); + + /* Used by `include' to locate the true source when relative + canonicalization strips a leading part of the source file. */ + sys_file_port_stripped_prefixes = scm_make_fluid_with_default (SCM_EOL); + + scm_c_define ("%file-port-stripped-prefixes", + sys_file_port_stripped_prefixes); } diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 627910ad9..9da5a4a74 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2030,6 +2030,67 @@ non-locally, that exit determines the continuation." +;;; {Include} +;;; + +;;; This redefined version of call-with-include-port (first defined in +;;; psyntax.scm) also try to locate an included file using the +;;; %file-port-stripped-prefixes fluid. +(define call-with-include-port + (let ((syntax-dirname (lambda (stx) + (define src (syntax-source stx)) + (define filename (and src (assq-ref src 'filename))) + (and (string? filename) + (dirname filename))))) + (lambda* (filename proc #:key (dirname (syntax-dirname filename))) + "Like @code{call-with-input-file}, except relative paths are +searched relative to @var{dirname} instead of the current working +directory. Also, @var{filename} can be a syntax object; in that case, +and if @var{dirname} is not specified, the @code{syntax-source} of +@var{filename} is used to obtain a base directory for relative file +names. As a special case, when the @var{%file-port-stripped-prefixes} +fluid is set, its value is searched for a directory matching the dirname +inferred from FILENAME." + (let* ((filename (syntax->datum filename)) + (candidates + (cond ((absolute-file-name? filename) + (list filename)) + (dirname ;filename is relative + (let* ((rel-names (fluid-ref %file-port-stripped-prefixes)) + (stripped-prefix (and rel-names + (assoc-ref rel-names dirname))) + (fallback (and stripped-prefix + (string-append stripped-prefix + dirname)))) + (map (lambda (d) + (in-vicinity d filename)) + `(,dirname ,@(if fallback + (list fallback) + '()))))) + (else + (error + "attempt to include relative file name \ +but could not determine base dir")))) + (p (let loop ((files candidates)) + (when (null? files) + (error "could not open any of" candidates)) + (catch 'system-error + (lambda _ + (open-input-file (car files))) + (lambda _ + (loop (cdr files)))))) + (enc (file-encoding p))) + + ;; Choose the input encoding deterministically. + (set-port-encoding! p (or enc "UTF-8")) + + (call-with-values (lambda () (proc p)) + (lambda results + (close-port p) + (apply values results))))))) + + + ;;; {Time Structures} ;;; diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 5fbd8f458..34207b38f 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -3270,6 +3270,8 @@ ;; Scheme code corresponding to the intermediate language forms. ((_ e) (emit (quasi #'e 0))))))) +;; Note: this procedure is later refined in ice-9/boot-9.scm after we +;; have basic exception handling. (define call-with-include-port (let ((syntax-dirname (lambda (stx) (define src (syntax-source stx)) @@ -3277,12 +3279,6 @@ (and (string? filename) (dirname filename))))) (lambda* (filename proc #:key (dirname (syntax-dirname filename))) - "Like @code{call-with-input-file}, except relative paths are -searched relative to the @var{dirname} instead of the current working -directory. Also, @var{filename} can be a syntax object; in that case, -and if @var{dirname} is not specified, the @code{syntax-source} of -@var{filename} is used to obtain a base directory for relative file -names." (let* ((filename (syntax->datum filename)) (p (open-input-file (cond ((absolute-file-name? filename) -- 2.46.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 14 Sep 2024 01:36:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 13 21:36:34 2024 Received: from localhost ([127.0.0.1]:44483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1spHiE-0007nS-35 for submit <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:34 -0400 Received: from mail-pl1-f175.google.com ([209.85.214.175]:45322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1spHiB-0007mx-45 for 66046 <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:31 -0400 Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2068acc8b98so25415885ad.3 for <66046 <at> debbugs.gnu.org>; Fri, 13 Sep 2024 18:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726277714; x=1726882514; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gN7qvG0XWU/wdNq2CJr5Ypz3YBHfnjc7G1D/b3rYBhw=; b=O5oM063B7sLfUcnzloZSbixj1keKzqBxxi7zK8wsMTVg9u3rTIC5Ka3KHAeXE0pc+o Jgzjij2Jf0jJ+h8VdxD2a8/PLchENAc1tXTNXQwZ0mCBBBK0jdLxdiOFnwxWjftCN50X 12o/OzOEBVwfl6CbnCrH1u+JO27sR3WA+PwCWkEWPhCM76NQ5Q5cHpU3EUgvjAhaRTNX q2pFHvItntjDBUgs6VITd0x3QMWrsu8Ru3X0+5997ZdOQjJ1vjkV19fAwYeqRIZcDDlg +rOTiIjbLvWlrr8VUZ5/gqcIJT/wdJPlXLMh5niEmXmdKnU0KnvWNqbLSNDembMGpksa 6ZLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726277714; x=1726882514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gN7qvG0XWU/wdNq2CJr5Ypz3YBHfnjc7G1D/b3rYBhw=; b=qCIaYNueeGy1NdxT2X0TnsMW1voFm9Sv08iqfI0/8n3ZBPB3QrVwBD0s5tvTHx80SQ Gvcg9uZYcWuMcmBtQZtJnRq5a0BoNymxty5ke01DET360g+aWI13brfkgq6CeELZ6rIt Fux+w5W2wT4QnDRUOdxgULeOPq1IAhURsCZUOjiv+5YrZRHRiolaBeOWNPbjXaLamp50 Et+MiuzLOOeGQGLKdTH/tRx1l431woohgGfBWjuN+dNBqh5utJFqxTVCbm1XmDxUsnc5 kdtp5613+QfrDGXHNv+HVS60w5MsAiMo9W/8VOayfrPx/Xq4hHw+6uK9gF098j1oo/pu qNkQ== X-Gm-Message-State: AOJu0Yz5ak35RFkvkKJ7C71Qf0f+wcvxyzBKtA4f32LJmX1MUDY7KocY ecvpGbUHJrDhnko43gq9sbWlSs8DvmccHWE6pHrFiyOoLK/tsuhI4qyAND9c X-Google-Smtp-Source: AGHT+IFrUFYVPcLT09O5oqMjNOu3/TfC4UYyOmKI3PObXzZ2Pr0JKaauUhlDksxfkPW43ZG5nXRSVA== X-Received: by 2002:a17:903:240b:b0:205:5f54:75a2 with SMTP id d9443c01a7336-2076e43ef3emr116955335ad.51.1726277714255; Fri, 13 Sep 2024 18:35:14 -0700 (PDT) Received: from hurd.lan ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207945da802sm2164505ad.50.2024.09.13.18.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 18:35:13 -0700 (PDT) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v4 2/3] tests: Add new compile-file tests. Date: Sat, 14 Sep 2024 10:34:28 +0900 Message-ID: <20240914013501.6445-2-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240914013501.6445-1-maxim.cournoyer@HIDDEN> References: <20240914013501.6445-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Add a test for bug #66046. To run just the compiler tests: ./meta/guile -L test-suite -L . test-suite/tests/compiler.test * test-suite/tests/compiler.test (with-temporary-directory): New syntax. (delete-file-recursively): New procedure. ("compile-file: relative include works") ("compile-file: relative include works with load path canonicalization"): New tests. --- (no changes since v1) test-suite/tests/compiler.test | 84 ++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index 0b47d0e32..5cb7a8ef6 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -1,6 +1,6 @@ ;;;; compiler.test --- tests for the compiler -*- scheme -*- -;;;; Copyright (C) 2008-2014, 2018, 2021-2022, 2024 Free Software Foundation, Inc. -;;;; +;;;; Copyright (C) 2008-2014, 2018, 2021-2024 Free Software Foundation, Inc. +;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either @@ -18,15 +18,50 @@ (define-module (tests compiler) #:use-module (test-suite lib) #:use-module (test-suite guile-test) + #:use-module (ice-9 ftw) #:use-module (system base compile) #:use-module ((language tree-il) #:select (tree-il-src call-args)) #:use-module ((system vm loader) #:select (load-thunk-from-memory)) - #:use-module ((system vm program) #:select (program-sources source:addr))) + #:use-module ((system vm program) #:select (program-sources source:addr)) + #:use-module (srfi srfi-26)) (define read-and-compile (@@ (system base compile) read-and-compile)) +;;; Based on 'with-directory-excursion', from (guix build utils). +(define-syntax-rule (with-temporary-directory body ...) + "Run BODY with DIR as the process's current directory." + (let ((init (getcwd)) + (dir (mkdtemp "tempdir.XXXXXX"))) + (dynamic-wind + (lambda () + (chdir dir)) + (lambda () + body ...) + (lambda () + (chdir init) + (delete-file-recursively dir))))) + +;;; XXX: Adapted from (guix build utils). +(define* (delete-file-recursively dir) + "Delete DIR recursively, like `rm -rf', without following symlinks." + (file-system-fold (const #t) ;enter + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat)) (with-test-prefix "basic" @@ -441,3 +476,46 @@ (set! proc ((load-thunk-from-memory bytecode))) (procedure? proc))) (pass-if-equal "proc executes" 42 (proc)))) + +(with-test-prefix "compile-file" + ;; Setup test library sources in a temporary directory. + (let ((hello-sexp '(define-library (hello) + (import (scheme base) + (scheme write)) + (export hello) + (include "hello/hello-impl.scm"))) + (hello-impl-sexp '(begin + (include "../external/nothing.scm") + (include "body.scm"))) + (hello-body-sexp '(define (hello) + (display "hello!\n")))) + (with-temporary-directory + (mkdir "module") + (call-with-output-file "module/hello.scm" + (cut write hello-sexp <>)) + (mkdir "module/hello") + (call-with-output-file "module/hello/hello-impl.scm" + (cut write hello-impl-sexp <>)) + (call-with-output-file "module/hello/body.scm" + (cut write hello-body-sexp <>)) + (mkdir "module/external") + (call-with-output-file "module/external/nothing.scm" (const #t)) + (mkdir "build") + (chdir "build") + + (pass-if "relative include works" + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t) + + ;; This used to fail, because compile-file's #:canonicalization + ;; defaults to 'relative, which causes 'scm_relativize_path' to + ;; strip the prefix not in the load path, to avoid baking an + ;; invalid source file reference in the byte compiled output file + ;; (see: https://bugs.gnu.org/66046). This was fixed by having a + ;; '%file-port-stripped-prefixes' fluid to preserve the stripped + ;; prefix, to be used by 'include' to reconstruct the original + ;; complete relative file name. + (pass-if "relative include works with load path canonicalization" + (add-to-load-path (string-append (getcwd) "/../module")) + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t)))) -- 2.46.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 14 Sep 2024 01:36:32 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 13 21:36:32 2024 Received: from localhost ([127.0.0.1]:44480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1spHiB-0007nC-GF for submit <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:32 -0400 Received: from mail-pl1-f169.google.com ([209.85.214.169]:48506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1spHi8-0007mt-Qf for 66046 <at> debbugs.gnu.org; Fri, 13 Sep 2024 21:36:29 -0400 Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2055f630934so25102505ad.1 for <66046 <at> debbugs.gnu.org>; Fri, 13 Sep 2024 18:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726277712; x=1726882512; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JBox/ACzsZb9tYimHNkyuZhUy6NLV8rWRnbTRdrMmyw=; b=BmzEMXG4gZY5/TrpbVlMTi0FC7KJueD6TRMQ30dE+WTa8/U/kEsdSQIrxks9Uy1i/e cnKb3FAI8Ecf0SlVYpnAMbCAnoBrR83ovl+E2AOwOVDpJn1kPfY24Bn8Fxzo2Q/YVnDZ dtUwrnlg/fwhFTD7RgRRQSfKCXBapxpZ8WNNix1M0HYekxyf2Euz/BXTI7e4PXLRyiNu rgxV+Lfq3bSss0aJTM6lMEenMARlBRHHaje5M+9xmqOvwJ8jcFe2wrj5bKJmU1QgmRy4 i+AoNfnEArTK22/L1hG4FJUuVA8i04EcDgvBb+ynwvpDZ2kRC6GRBnDg2xm1oRw5g3nL 2FWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726277712; x=1726882512; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JBox/ACzsZb9tYimHNkyuZhUy6NLV8rWRnbTRdrMmyw=; b=s75hcKMVEHcdBOlP/oFdzoG7sTeGOIW80NYlkarQu88wZTTyf3IF4EZ72/hFnhtpQr VsPeU7skW+IFJDAm3MdSplWvM0xkC3twvTuLywrp7J9KYQ+xdswjSzQ9u7u6fVPr7+9g JnSneGPJYgFtKHtt/WbmY+K96vd0GrqifefZklA4ANzQ0sgBunpmm1HB2jTla+CgQznv /78K/cF4acNteAQ/7AMIYakb7B4LRWsT+nTp9H86AR56MEO1IUwrBRPwKGAuReOIsUYL DDKxojMD6YrV+O0KOhJrr/+hEYInJ1Ai9h/KueI7GFo6mCZS6g26jSw8dI0ZLN71QxXD y5TA== X-Gm-Message-State: AOJu0YwPi5JhE+UiM03MzqmlAqGkQbEvDbXWs4JHOVYCDOwbmwDRBCFB 9bx9103W4l0KiyD0MRWd7EDIKB5yYMpRBumZuZe75HsGwhPB2Y8anzDauP8h X-Google-Smtp-Source: AGHT+IEvTj6wd0XqyXpATTyICjf9T2jSt7gw4rDmoXd5ZJOrhCmVQuhFvub9KvTZ8ts8w0ywPSUmsg== X-Received: by 2002:a17:902:f689:b0:206:96bf:b0d6 with SMTP id d9443c01a7336-2076e41703amr132357035ad.51.1726277711820; Fri, 13 Sep 2024 18:35:11 -0700 (PDT) Received: from hurd.lan ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207945da802sm2164505ad.50.2024.09.13.18.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 18:35:11 -0700 (PDT) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v4 1/3] libguile/fports.c: Remove extraneous include. Date: Sat, 14 Sep 2024 10:34:27 +0900 Message-ID: <20240914013501.6445-1-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) * libguile/fports.c: Delete "hashtab.h" include, which is unused. --- (no changes since v1) libguile/fports.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libguile/fports.c b/libguile/fports.c index 9d4ca6ace..8f19216b7 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -52,7 +52,6 @@ #include "fluids.h" #include "gc.h" #include "gsubr.h" -#include "hashtab.h" #include "keywords.h" #include "modules.h" #include "numbers.h" base-commit: d0790d766bedf08fb65231eff53f6c8044eb94f1 -- 2.46.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:18:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:18:19 2023 Received: from localhost ([127.0.0.1]:59767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5pvf-0007VT-68 for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:19 -0500 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]:55575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5pvc-0007Ur-Dp for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:17 -0500 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-677fb277b7cso26283976d6.3 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669887; x=1701274687; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oPGfs6cvFugqZDBaYwNe/PPtGPsiSjIFofnk/9j4aGQ=; b=eHuHOCeOAaHfFcEAmA430eWOjLHCSyanva6RzmFn6ypVn1yrIlLZYQlhShJiOQfoRk OWjwDOOW54MjajGIuhPfgcoR6d4qh3cvIuMTs7+VctWzwZIfWYMkUmJ7vL1WPodmn6jG f2m3SME8PXTXxqHMNV5OTRbZRwHCZhma/Bd6daTLJ91Fcngxs9YoAlXXq8mLdXuje/3W sYSkzjqdX7lpNYZFH9E9J9xijCWwDBqr7PSpAQaHBnlAury4B1TijiVrbqjIz5F4shoU gF9ADGt2LLxozJ51mn+8DkUX9NZpnhUvAjaeF+eW/VQal0ocQ8EVsnX0Ce4n6dp0P7pY vIxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669887; x=1701274687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oPGfs6cvFugqZDBaYwNe/PPtGPsiSjIFofnk/9j4aGQ=; b=lvtx8Ke5BCWAHzjRcmYKYhnGk2lXcdKOFCJcVGqjLi1j1Brg6X4Cr82WQs+k2rg1rl E8CdIYM8mWvtiYw63UINb9bLMLCnkNbgqivfTF2uHfq9wPawAO9MpjkM8rVI174R2+/E GmhE/DI8i5/MM8Cn9ZYFPmMlRtwF5sb1MP8ziH3R+E5qGX0DvWL+rcTgDjiBzGnYCjUl 4+W2ynqaIfJzy0PyTGdYbowQt+K/KgRJRNZqOyygZSoHxxH24ZuxwoI1OkZpdkeR8YMv Ye6pBCINxoePRLcpxDAO1hlPghK7fUvDB/IvJ4nnS+W0WjptRhnJpXIpY2dOvsABC0yE yi5A== X-Gm-Message-State: AOJu0Yy36h9hBnjXaWYQ8RILl35tsz/hxI+bcGSXraEDNY8oodFDZKna b1TzlxEGK3vxsDOQ0nvJCTTVIwi50ao= X-Google-Smtp-Source: AGHT+IFuaYJq9QOApCzA7/Fq0sqD0NjDr96D/xpMosRDmE7HUYCal1ITpRRJxMgBe7EXDt8FPVZ5Wg== X-Received: by 2002:ad4:5ccc:0:b0:66d:a1dd:22af with SMTP id iu12-20020ad45ccc000000b0066da1dd22afmr3181498qvb.11.1700669887100; Wed, 22 Nov 2023 08:18:07 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id s18-20020ad45012000000b00677f33079casm4929450qvo.40.2023.11.22.08.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:18:06 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v3 3/3] ice-9: Fix 'include' when used in compilation contexts. Date: Wed, 22 Nov 2023 11:17:52 -0500 Message-ID: <20231122161801.32398-3-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122161801.32398-1-maxim.cournoyer@HIDDEN> References: <20231122161801.32398-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes bug #66046. Introduce a '%file-port-stripped-prefixes' fluid that captures the pre-canonicalized file name used when compiling a file, before it gets modified in fport_canonicalize_filename. That reference that can then used by 'include' when searching for included files. * libguile/fports.c (sys_file_port_stripped_prefixes): New C fluid. (fport_canonicalize_filename): Register dirnames / stripped prefixes pairs in. (%file-port-stripped-prefixes): New corresponding Scheme fluid. * module/ice-9/boot-9.scm (call-with-include-port): New procedure, shadowing that from psyntax, that extends it to use the above fluid to compute a fallback include file directory name to try. * module/ice-9/psyntax.scm (call-with-include-port): Add comment. Strip documentation, as it's now an internal. --- Changes in v3: - Move tests hunks to test commit Changes in v2: - Move fluid to where the file name stripping happens, in libguile - Make the fluid value an alist of the last 100 stripped prefixes - Expound test to catch edge case (include in an include) libguile/fports.c | 41 +++++++++++++++++++++++++-- module/ice-9/boot-9.scm | 61 ++++++++++++++++++++++++++++++++++++++++ module/ice-9/psyntax.scm | 8 ++---- 3 files changed, 102 insertions(+), 8 deletions(-) diff --git a/libguile/fports.c b/libguile/fports.c index 8f19216b7..12048828a 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -1,4 +1,4 @@ -/* Copyright 1995-2004,2006-2015,2017-2020,2022 +/* Copyright 1995-2004,2006-2015,2017-2020,2022-2023 Free Software Foundation, Inc. This file is part of Guile. @@ -43,6 +43,7 @@ #include <sys/select.h> #include <full-write.h> +#include "alist.h" #include "async.h" #include "boolean.h" #include "dynwind.h" @@ -59,6 +60,7 @@ #include "ports-internal.h" #include "posix.h" #include "read.h" +#include "srfi-13.h" #include "strings.h" #include "symbols.h" #include "syscalls.h" @@ -123,6 +125,7 @@ SCM_DEFINE (scm_file_port_p, "file-port?", 1, 0, 0, static SCM sys_file_port_name_canonicalization; +static SCM sys_file_port_stripped_prefixes; static SCM sym_relative; static SCM sym_absolute; @@ -143,7 +146,34 @@ fport_canonicalize_filename (SCM filename) "%load-path")); rel = scm_i_relativize_path (filename, path); - return scm_is_true (rel) ? rel : filename; + if (scm_is_true (rel)) + { + SCM relative_dir = scm_dirname (rel); + SCM stripped_prefixes = scm_fluid_ref + (sys_file_port_stripped_prefixes); + + /* Extend the association list if needed, but keep its size + capped to limit memory usage. */ + if (scm_is_false (scm_assoc_ref(stripped_prefixes, relative_dir))) + { + SCM stripped_prefix = scm_string_drop_right + (filename, scm_string_length (rel)); + + stripped_prefixes = scm_cons (scm_cons (relative_dir, + stripped_prefix), + stripped_prefixes); + + if (scm_to_int (scm_length (stripped_prefixes)) > 100) + stripped_prefixes = scm_list_head (stripped_prefixes, + scm_from_int(100)); + + scm_fluid_set_x (sys_file_port_stripped_prefixes, + stripped_prefixes); + } + + return rel; + } + return filename; } else if (scm_is_eq (mode, sym_absolute)) { @@ -766,4 +796,11 @@ scm_init_fports () sys_file_port_name_canonicalization = scm_make_fluid (); scm_c_define ("%file-port-name-canonicalization", sys_file_port_name_canonicalization); + + /* Used by `include' to locate the true source when relative + canonicalization strips a leading part of the source file. */ + sys_file_port_stripped_prefixes = scm_make_fluid_with_default (SCM_EOL); + + scm_c_define ("%file-port-stripped-prefixes", + sys_file_port_stripped_prefixes); } diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index a5f2eea9b..a79d49ae1 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2030,6 +2030,67 @@ non-locally, that exit determines the continuation." +;;; {Include} +;;; + +;;; This redefined version of call-with-include-port (first defined in +;;; psyntax.scm) also try to locate an included file using the +;;; %file-port-stripped-prefixes fluid. +(define call-with-include-port + (let ((syntax-dirname (lambda (stx) + (define src (syntax-source stx)) + (define filename (and src (assq-ref src 'filename))) + (and (string? filename) + (dirname filename))))) + (lambda* (filename proc #:key (dirname (syntax-dirname filename))) + "Like @code{call-with-input-file}, except relative paths are +searched relative to @var{dirname} instead of the current working +directory. Also, @var{filename} can be a syntax object; in that case, +and if @var{dirname} is not specified, the @code{syntax-source} of +@var{filename} is used to obtain a base directory for relative file +names. As a special case, when the @var{%file-port-stripped-prefixes} +fluid is set, its value is searched for a directory matching the dirname +inferred from FILENAME." + (let* ((filename (syntax->datum filename)) + (candidates + (cond ((absolute-file-name? filename) + (list filename)) + (dirname ;filename is relative + (let* ((rel-names (fluid-ref %file-port-stripped-prefixes)) + (stripped-prefix (and rel-names + (assoc-ref rel-names dirname))) + (fallback (and stripped-prefix + (string-append stripped-prefix + dirname)))) + (map (lambda (d) + (in-vicinity d filename)) + `(,dirname ,@(if fallback + (list fallback) + '()))))) + (else + (error + "attempt to include relative file name \ +but could not determine base dir")))) + (p (let loop ((files candidates)) + (when (null? files) + (error "could not open any of" candidates)) + (catch 'system-error + (lambda _ + (open-input-file (car files))) + (lambda _ + (loop (cdr files)))))) + (enc (file-encoding p))) + + ;; Choose the input encoding deterministically. + (set-port-encoding! p (or enc "UTF-8")) + + (call-with-values (lambda () (proc p)) + (lambda results + (close-port p) + (apply values results))))))) + + + ;;; {Time Structures} ;;; diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 7811f7118..0e0370457 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -3256,6 +3256,8 @@ ;; Scheme code corresponding to the intermediate language forms. ((_ e) (emit (quasi #'e 0))))))) +;; Note: this procedure is later refined in ice-9/boot-9.scm after we +;; have basic exception handling. (define call-with-include-port (let ((syntax-dirname (lambda (stx) (define src (syntax-source stx)) @@ -3263,12 +3265,6 @@ (and (string? filename) (dirname filename))))) (lambda* (filename proc #:key (dirname (syntax-dirname filename))) - "Like @code{call-with-input-file}, except relative paths are -searched relative to the @var{dirname} instead of the current working -directory. Also, @var{filename} can be a syntax object; in that case, -and if @var{dirname} is not specified, the @code{syntax-source} of -@var{filename} is used to obtain a base directory for relative file -names." (let* ((filename (syntax->datum filename)) (p (open-input-file (cond ((absolute-file-name? filename) -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:18:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:18:19 2023 Received: from localhost ([127.0.0.1]:59765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5pve-0007VQ-Ly for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:19 -0500 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]:57836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5pva-0007Un-Sd for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:15 -0500 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-677fe97ddf8so27588426d6.3 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669886; x=1701274686; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3evInoajaUu4MlpHeBtuNd4sid+gn8/R1yE+pSupXUM=; b=hA41x65O339Z/GQJXXDXXWLF+6bZPAFcEj+EJcSwoepsuY87iS/Dj9a4z9awe62B7E oYGHiY1yv0CIu4Gnm+yrt1+QR12kDFsfPLjVD1hdIx/5hctjVgh5B7tQ8fV8jrY4VCQJ P68ndHECZv19Ddljmavd75J8nyERbiwXmD/tdV4NPZTE2JS+Ler3WBf6N6IxBQaUpll3 jj0CnxL5zPkICvAwPSphhyarIb7V9KOEWAcqVEL0FtRnwSFK1vcplWCmEXlAvqa/g+qj 26wkAy8XtmOJWfgpN42GQmZaZ1qrCDbjMEwMA4D8e5f8qV4CPt7bWL2TgNd1HzzqCKua FpNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669886; x=1701274686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3evInoajaUu4MlpHeBtuNd4sid+gn8/R1yE+pSupXUM=; b=FyY43IUbhNsrD4NijVCvFGzPYg6nJgBBnPG6jYB8VXog8Qi2eQJw5F3ejTNFOhLVdd 7WBMRUtyV97egk+dc07VG1fiYXIIUQPzMMx/WDOcp5ITSA4QRpuoOT0mVjqFL9bwJmUL 9DR4zxuW7HSj20dks5fHyuLoYrsJ8bUmJOCQLUuCqoH+VaneGcXhOmhhTC5d6MwhYyDj MQBvGtE6ktfoSZ+nBw+j+VWSJ38V/5skzytpAZafj2BuDlyOaLXPzWv5WE0ZnUvaCWKh x8TKBUS532jwl/MWPgnC6g751O4sp9x5Gw/zIors7viLAjfZghCvZqCpzgZwgsfdye3h wphw== X-Gm-Message-State: AOJu0YzmV35BDLwiXxV8J6OjSucEQcre/Mfyr1nA+dlBcrQsoZ4Xdtwy K7YAQA/OJdWVxufQt0ok9tHkxoJkMv4= X-Google-Smtp-Source: AGHT+IHvcWvM8T5cWqFZuTTmHiS5n9Y1OWhclam8O+SGPBiBRiq4s9G/bzKeZZYdhR9y+/iG9uV3Lg== X-Received: by 2002:a05:6214:27c8:b0:679:5f50:6a63 with SMTP id ge8-20020a05621427c800b006795f506a63mr3072431qvb.26.1700669885706; Wed, 22 Nov 2023 08:18:05 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id s18-20020ad45012000000b00677f33079casm4929450qvo.40.2023.11.22.08.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:18:05 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v3 2/3] tests: Add new compile-file tests. Date: Wed, 22 Nov 2023 11:17:51 -0500 Message-ID: <20231122161801.32398-2-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122161801.32398-1-maxim.cournoyer@HIDDEN> References: <20231122161801.32398-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Add a test for bug #66046. To run just the compiler tests: ./meta/guile -L test-suite -L . test-suite/tests/compiler.test * test-suite/tests/compiler.test (with-temporary-directory): New syntax. (delete-file-recursively): New procedure. ("compile-file: relative include works") ("compile-file: relative include works with load path canonicalization"): New tests. --- (no changes since v1) test-suite/tests/compiler.test | 82 +++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index a018e0c41..79aee1a0e 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -1,5 +1,5 @@ ;;;; compiler.test --- tests for the compiler -*- scheme -*- -;;;; Copyright (C) 2008-2014, 2018, 2021-2022 Free Software Foundation, Inc. +;;;; Copyright (C) 2008-2014, 2018, 2021-2023 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -18,15 +18,50 @@ (define-module (tests compiler) #:use-module (test-suite lib) #:use-module (test-suite guile-test) + #:use-module (ice-9 ftw) #:use-module (system base compile) #:use-module ((language tree-il) #:select (tree-il-src call-args)) #:use-module ((system vm loader) #:select (load-thunk-from-memory)) - #:use-module ((system vm program) #:select (program-sources source:addr))) + #:use-module ((system vm program) #:select (program-sources source:addr)) + #:use-module (srfi srfi-26)) (define read-and-compile (@@ (system base compile) read-and-compile)) +;;; Based on 'with-directory-excursion', from (guix build utils). +(define-syntax-rule (with-temporary-directory body ...) + "Run BODY with DIR as the process's current directory." + (let ((init (getcwd)) + (dir (mkdtemp "tempdir.XXXXXX"))) + (dynamic-wind + (lambda () + (chdir dir)) + (lambda () + body ...) + (lambda () + (chdir init) + (delete-file-recursively dir))))) + +;;; XXX: Adapted from (guix build utils). +(define* (delete-file-recursively dir) + "Delete DIR recursively, like `rm -rf', without following symlinks." + (file-system-fold (const #t) ;enter + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat)) (with-test-prefix "basic" @@ -434,3 +469,46 @@ (set! proc ((load-thunk-from-memory bytecode))) (procedure? proc))) (pass-if-equal "proc executes" 42 (proc)))) + +(with-test-prefix "compile-file" + ;; Setup test library sources in a temporary directory. + (let ((hello-sexp '(define-library (hello) + (import (scheme base) + (scheme write)) + (export hello) + (include "hello/hello-impl.scm"))) + (hello-impl-sexp '(begin + (include "../external/nothing.scm") + (include "body.scm"))) + (hello-body-sexp '(define (hello) + (display "hello!\n")))) + (with-temporary-directory + (mkdir "module") + (call-with-output-file "module/hello.scm" + (cut write hello-sexp <>)) + (mkdir "module/hello") + (call-with-output-file "module/hello/hello-impl.scm" + (cut write hello-impl-sexp <>)) + (call-with-output-file "module/hello/body.scm" + (cut write hello-body-sexp <>)) + (mkdir "module/external") + (call-with-output-file "module/external/nothing.scm" (const #t)) + (mkdir "build") + (chdir "build") + + (pass-if "relative include works" + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t) + + ;; This used to fail, because compile-file's #:canonicalization + ;; defaults to 'relative, which causes 'scm_relativize_path' to + ;; strip the prefix not in the load path, to avoid baking an + ;; invalid source file reference in the byte compiled output file + ;; (see: https://bugs.gnu.org/66046). This was fixed by having a + ;; '%file-port-stripped-prefixes' fluid to preserve the stripped + ;; prefix, to be used by 'include' to reconstruct the original + ;; complete relative file name. + (pass-if "relative include works with load path canonicalization" + (add-to-load-path (string-append (getcwd) "/../module")) + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t)))) -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:18:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:18:15 2023 Received: from localhost ([127.0.0.1]:59762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5pvb-0007V4-D3 for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:15 -0500 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]:44323) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5pvZ-0007Uj-L8 for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:18:13 -0500 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6707401e1edso25251336d6.1 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669884; x=1701274684; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IPILNr+vFtVFMkkKwxwRy+YYGLcxmUblSlWh4ahfjSk=; b=aITZSnqz4SMjSEKS508y0E9AvhZthfDDG92MsSCIui7wRzdYm5QmP1sXqx5eaYrpzY oRIXIAc0kdBbRiFE+eBIgqbBH25yVT+WV20QbBetdrfVk3+UW3MmoRIWhg83Zda4Wbo5 YdZqKL1TNZXg8qg/BDu+NxnBGtEVirCmVroKforRm9fzVAzpKaUIqfYtkpCVoOb8FE5V eQWG2aazR9295fU8iAnqkFRtasKMkLkU3XGA0wyCjXPFLfIrQ9DQxffu8SYoQ0U8MuV2 h0oFbiE0DWX0yhybsGsZ1plK5bO16FGts0z9uaX6dWUDXchqw9UgLdszlYVrT/raPih8 T17A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669884; x=1701274684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IPILNr+vFtVFMkkKwxwRy+YYGLcxmUblSlWh4ahfjSk=; b=kLXDgC53NAc2pTF9ZX1MR1H0mnDCjymTSMNk3mrmRLUz6/3DjzHdRXWVQdZzNR5i7G eEvw9CFsfvGXaHpqanYSMvoNsDh/mlRfcJsgEQmbFcaGu7MrefEGnGn6k2hZSKkrfxuS pgix8dDTz8g/ErG+x37UfbnZXMTDcYiJ4U7tOLAchpME2n/oBLrxzR7BIEzsk/r9Tt1C xF67xxHT4oM4dgx6sfiyaJTyyTwwQcpHCwYB3JN2Cu7JF6+a/oufo1ubVj5N5UYt8HKI xFp5EjIF45uFAGHbP0m295jwLiZKf2n+D6rt2H5ZhfzFHhqV3fvNdEriLikDzimAnRbZ lKmQ== X-Gm-Message-State: AOJu0YwDWOk8OEAwY9aXQ4kU7dacHnfRg0ou7F0bwMZjkItpsDd+FwXD a0IqdQia702FquuH6s9NZklWr1SxoTM= X-Google-Smtp-Source: AGHT+IHL7Jkv18GPF659W8ktClqbLTFWumVatlCV6ePb9HKA8LdncHgkiWhIiLvEn+LnGBtkeZXdZQ== X-Received: by 2002:a05:6214:5006:b0:66d:994b:8703 with SMTP id jo6-20020a056214500600b0066d994b8703mr3846434qvb.7.1700669884309; Wed, 22 Nov 2023 08:18:04 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id s18-20020ad45012000000b00677f33079casm4929450qvo.40.2023.11.22.08.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:18:04 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v3 1/3] libguile/fports.c: Remove extraneous include. Date: Wed, 22 Nov 2023 11:17:50 -0500 Message-ID: <20231122161801.32398-1-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) * libguile/fports.c: Delete "hashtab.h" include, which is unused. --- (no changes since v1) libguile/fports.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libguile/fports.c b/libguile/fports.c index 9d4ca6ace..8f19216b7 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -52,7 +52,6 @@ #include "fluids.h" #include "gc.h" #include "gsubr.h" -#include "hashtab.h" #include "keywords.h" #include "modules.h" #include "numbers.h" base-commit: d579848cb5d65440af5afd9c8968628665554c22 -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:12:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:12:25 2023 Received: from localhost ([127.0.0.1]:59747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5ppw-0007KF-JV for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:25 -0500 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:53549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5ppu-0007Jf-Ki for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:23 -0500 Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-77d632b35faso59848985a.3 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669533; x=1701274333; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9YJDexYK/ONV7xcRH0TROsZg65xWLtPAx88Jh5fP5UI=; b=aELdmtnqMt6sQyVPgphlKn1HIhfd1V8fSdkGnMxUKwsO2zku8cHUnCvJ0ZzHIyO/tr sU9eI5FoxRqgPM9ySi1X6xT5b0TgrV6nt5IWUiVjwZ5EizhShliIS3mcOvl2De/XpuI8 6kwlUw6joIA4n1d2YZmZeSx+B/JHvKx9O4f8Zg6XBbRSfzX0AoRQ7It5VAeL8/P1XObW 6f60le5SgddaR1PBlhZlsLbBhuK2hAGVPJqQVgmWU/+ex+jg32kv/PLTmCcaEGfDajrv OXogwkJNjUAS2ALopRBOijgmZ9B8VdPQkl05/q88sQlc/MHgYCEXLuzJVF+onBv8AMao F3EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669533; x=1701274333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9YJDexYK/ONV7xcRH0TROsZg65xWLtPAx88Jh5fP5UI=; b=HeYtchDWfo4Y7ZDv+M+aYpTjCsk7GyI6yZuNr7apvMAQ72og1CrieAdPybWtueKoR2 5uZphq3/rpqLqzh1oC6YImqFYlHQQsvU2PzHzjeUNuhcNGAvnce5OkvZ/Gxxo2PX5qK3 QTjictVCsHmzpQ+qxh7SXa4R0PfJwAPpeBnpy6aAeLyYvxBKrUQoiqXvphJD4VDwRs23 Kwiri0WjvuSBT01MV6eialBhigjmteH8twwFodGrjC+hHcmai+m/Dce3JJ6WW0gIsRF7 zsnUeYy4OoB/+3d+rUdPgfulPLWUwDWPOQR6VEiMj73L48QCXJ8ORTe86ryg7wm/SJaw 8WAw== X-Gm-Message-State: AOJu0YxiWYEPQ0Ysw+k7j+1ESW92/iKmlh6qF3qKld2rI7J0mntE6p1K 95m91JYbHl45YoQFr9esQuVKR43zxQY= X-Google-Smtp-Source: AGHT+IG1VrkVINboFJ529cW6RwEb3w0AeqN1vVp0xaQ03pjAmvGMHR6UCWtyecpb3ekFxCQ/srjapg== X-Received: by 2002:ac8:108c:0:b0:423:7d97:7395 with SMTP id a12-20020ac8108c000000b004237d977395mr1787604qtj.16.1700669533183; Wed, 22 Nov 2023 08:12:13 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id u7-20020ac87507000000b00419b9b1b0b0sm4516257qtq.56.2023.11.22.08.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:12:12 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v2 3/3] ice-9: Fix 'include' when used in compilation contexts. Date: Wed, 22 Nov 2023 11:11:44 -0500 Message-ID: <20231122161204.26366-3-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122161204.26366-1-maxim.cournoyer@HIDDEN> References: <20231122161204.26366-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes bug #66046. Introduce a '%file-port-stripped-prefixes' fluid that captures the pre-canonicalized file name used when compiling a file, before it gets modified in fport_canonicalize_filename. That reference that can then used by 'include' when searching for included files. * libguile/fports.c (sys_file_port_stripped_prefixes): New C fluid. (fport_canonicalize_filename): Register dirnames / stripped prefixes pairs in. (%file-port-stripped-prefixes): New corresponding Scheme fluid. * module/ice-9/boot-9.scm (call-with-include-port): New procedure, shadowing that from psyntax, that extends it to use the above fluid to compute a fallback include file directory name to try. * module/ice-9/psyntax.scm (call-with-include-port): Add comment. Strip documentation, as it's now an internal. --- Changes in v2: - Move fluid to where the file name stripping happens, in libguile - Make the fluid value an alist of the last 100 stripped prefixes - Expound test to catch edge case (include in an include) libguile/fports.c | 41 +++++++++++++++++++++-- module/ice-9/boot-9.scm | 61 ++++++++++++++++++++++++++++++++++ module/ice-9/psyntax.scm | 8 ++--- test-suite/tests/compiler.test | 8 ++--- 4 files changed, 106 insertions(+), 12 deletions(-) diff --git a/libguile/fports.c b/libguile/fports.c index 8f19216b7..12048828a 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -1,4 +1,4 @@ -/* Copyright 1995-2004,2006-2015,2017-2020,2022 +/* Copyright 1995-2004,2006-2015,2017-2020,2022-2023 Free Software Foundation, Inc. This file is part of Guile. @@ -43,6 +43,7 @@ #include <sys/select.h> #include <full-write.h> +#include "alist.h" #include "async.h" #include "boolean.h" #include "dynwind.h" @@ -59,6 +60,7 @@ #include "ports-internal.h" #include "posix.h" #include "read.h" +#include "srfi-13.h" #include "strings.h" #include "symbols.h" #include "syscalls.h" @@ -123,6 +125,7 @@ SCM_DEFINE (scm_file_port_p, "file-port?", 1, 0, 0, static SCM sys_file_port_name_canonicalization; +static SCM sys_file_port_stripped_prefixes; static SCM sym_relative; static SCM sym_absolute; @@ -143,7 +146,34 @@ fport_canonicalize_filename (SCM filename) "%load-path")); rel = scm_i_relativize_path (filename, path); - return scm_is_true (rel) ? rel : filename; + if (scm_is_true (rel)) + { + SCM relative_dir = scm_dirname (rel); + SCM stripped_prefixes = scm_fluid_ref + (sys_file_port_stripped_prefixes); + + /* Extend the association list if needed, but keep its size + capped to limit memory usage. */ + if (scm_is_false (scm_assoc_ref(stripped_prefixes, relative_dir))) + { + SCM stripped_prefix = scm_string_drop_right + (filename, scm_string_length (rel)); + + stripped_prefixes = scm_cons (scm_cons (relative_dir, + stripped_prefix), + stripped_prefixes); + + if (scm_to_int (scm_length (stripped_prefixes)) > 100) + stripped_prefixes = scm_list_head (stripped_prefixes, + scm_from_int(100)); + + scm_fluid_set_x (sys_file_port_stripped_prefixes, + stripped_prefixes); + } + + return rel; + } + return filename; } else if (scm_is_eq (mode, sym_absolute)) { @@ -766,4 +796,11 @@ scm_init_fports () sys_file_port_name_canonicalization = scm_make_fluid (); scm_c_define ("%file-port-name-canonicalization", sys_file_port_name_canonicalization); + + /* Used by `include' to locate the true source when relative + canonicalization strips a leading part of the source file. */ + sys_file_port_stripped_prefixes = scm_make_fluid_with_default (SCM_EOL); + + scm_c_define ("%file-port-stripped-prefixes", + sys_file_port_stripped_prefixes); } diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index a5f2eea9b..a79d49ae1 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2030,6 +2030,67 @@ non-locally, that exit determines the continuation." +;;; {Include} +;;; + +;;; This redefined version of call-with-include-port (first defined in +;;; psyntax.scm) also try to locate an included file using the +;;; %file-port-stripped-prefixes fluid. +(define call-with-include-port + (let ((syntax-dirname (lambda (stx) + (define src (syntax-source stx)) + (define filename (and src (assq-ref src 'filename))) + (and (string? filename) + (dirname filename))))) + (lambda* (filename proc #:key (dirname (syntax-dirname filename))) + "Like @code{call-with-input-file}, except relative paths are +searched relative to @var{dirname} instead of the current working +directory. Also, @var{filename} can be a syntax object; in that case, +and if @var{dirname} is not specified, the @code{syntax-source} of +@var{filename} is used to obtain a base directory for relative file +names. As a special case, when the @var{%file-port-stripped-prefixes} +fluid is set, its value is searched for a directory matching the dirname +inferred from FILENAME." + (let* ((filename (syntax->datum filename)) + (candidates + (cond ((absolute-file-name? filename) + (list filename)) + (dirname ;filename is relative + (let* ((rel-names (fluid-ref %file-port-stripped-prefixes)) + (stripped-prefix (and rel-names + (assoc-ref rel-names dirname))) + (fallback (and stripped-prefix + (string-append stripped-prefix + dirname)))) + (map (lambda (d) + (in-vicinity d filename)) + `(,dirname ,@(if fallback + (list fallback) + '()))))) + (else + (error + "attempt to include relative file name \ +but could not determine base dir")))) + (p (let loop ((files candidates)) + (when (null? files) + (error "could not open any of" candidates)) + (catch 'system-error + (lambda _ + (open-input-file (car files))) + (lambda _ + (loop (cdr files)))))) + (enc (file-encoding p))) + + ;; Choose the input encoding deterministically. + (set-port-encoding! p (or enc "UTF-8")) + + (call-with-values (lambda () (proc p)) + (lambda results + (close-port p) + (apply values results))))))) + + + ;;; {Time Structures} ;;; diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 7811f7118..0e0370457 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -3256,6 +3256,8 @@ ;; Scheme code corresponding to the intermediate language forms. ((_ e) (emit (quasi #'e 0))))))) +;; Note: this procedure is later refined in ice-9/boot-9.scm after we +;; have basic exception handling. (define call-with-include-port (let ((syntax-dirname (lambda (stx) (define src (syntax-source stx)) @@ -3263,12 +3265,6 @@ (and (string? filename) (dirname filename))))) (lambda* (filename proc #:key (dirname (syntax-dirname filename))) - "Like @code{call-with-input-file}, except relative paths are -searched relative to the @var{dirname} instead of the current working -directory. Also, @var{filename} can be a syntax object; in that case, -and if @var{dirname} is not specified, the @code{syntax-source} of -@var{filename} is used to obtain a base directory for relative file -names." (let* ((filename (syntax->datum filename)) (p (open-input-file (cond ((absolute-file-name? filename) diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index ff923095a..79aee1a0e 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -501,13 +501,13 @@ #t) ;; This used to fail, because compile-file's #:canonicalization - ;; defaults to 'relative, which caused 'scm_relativize_path' to + ;; defaults to 'relative, which causes 'scm_relativize_path' to ;; strip the prefix not in the load path, to avoid baking an ;; invalid source file reference in the byte compiled output file ;; (see: https://bugs.gnu.org/66046). This was fixed by having a - ;; 'compilation-source-file' fluid that preserves the file name - ;; passed to 'compile-file', used by 'include' instead of the file - ;; name of the port. + ;; '%file-port-stripped-prefixes' fluid to preserve the stripped + ;; prefix, to be used by 'include' to reconstruct the original + ;; complete relative file name. (pass-if "relative include works with load path canonicalization" (add-to-load-path (string-append (getcwd) "/../module")) (compile-file "../module/hello.scm" #:output-file "hello.go") -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:12:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:12:24 2023 Received: from localhost ([127.0.0.1]:59745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5ppw-0007KD-0v for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:24 -0500 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]:58809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5pps-0007Jc-TJ for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:21 -0500 Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-41cd6e1d4fbso40236861cf.1 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669531; x=1701274331; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=58oI9SllunaQP3TOW4qWNDVhjQenNZTXGnLoGKDYgMM=; b=LijUyKP8gOfayNmYa/AQlT7rbMi+v/Hb8A/lL5yXyqRg7qa3beeCu/qinEMfvuQIFf zlZ0q1zaIa/w3AyfjkVXuYjK5RnX7xHRZN74NUDnT9Y/3qEJX1CTEXOetnOD+1ecC8+o 9clDQzknMPV3kbLOo6SdLM4+pQ6kZCWzY1fKHvlb+XGrehI3WyJcx6bbCnYJoGl9yNqj 4VT9wiLJiTlBJlMNFybdAHR4IjJPMqDGgq/P6t7dgmfwOEh7OrRhDyDMQ+IRzDzkLC3t yiNYJ+gDBUUGVyiUPuU5AmkRQapSB4kZuzMTLQYzOwOjtbEnOJAGhYOivwkNMr5GkYTY CrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669531; x=1701274331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=58oI9SllunaQP3TOW4qWNDVhjQenNZTXGnLoGKDYgMM=; b=qMdewQOKaWoZbUyl3KPrSvWMkfTLLFfk/vEbQXilpzzd/yfCHP4qMW3y2VVnUm2RpG Xg/XqP3k9aIxdBvRjxkh5ilA19G/5whrBnE14ImJ2+tGNeKDfVYuGxXWRnoIs6pVClGY LW/pboLeyawFtx0A7AdlAs6KogBJph0wpB6FjqVD6Qny+CfWicdM0hRAbEiKV4tkv7Zd 1yDEJ6LHAI5BddB8iA7K8qQsROHU6kXx29NqEZm7LpAAd0zWljAAvr24DcVwki233m5P iFuN0x3gKQeisuRv+ztCS08DZnxCY6NS9L+h1lZ4UOHYPRrchOt/WfLKZLlQzRdFcNvd oYBA== X-Gm-Message-State: AOJu0Yy8iIBFwL0j9yL9mJo6rkwIg6LynzWrJ37n1rUtDpdZO6y0MVKZ KDyn9bljhJsQS41plrmPYYBtkC3AKO4= X-Google-Smtp-Source: AGHT+IEhrADEgDtsXttxg1f/HGiYYnqCyJwhwmYgfgQ2WmrOLyD0XeeBIQ7lQiGC6T1zec6NyVzrLA== X-Received: by 2002:ac8:5d4b:0:b0:41e:287d:f56a with SMTP id g11-20020ac85d4b000000b0041e287df56amr3829927qtx.47.1700669531537; Wed, 22 Nov 2023 08:12:11 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id u7-20020ac87507000000b00419b9b1b0b0sm4516257qtq.56.2023.11.22.08.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:12:11 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v2 2/3] tests: Add new compile-file tests. Date: Wed, 22 Nov 2023 11:11:43 -0500 Message-ID: <20231122161204.26366-2-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231122161204.26366-1-maxim.cournoyer@HIDDEN> References: <20231122161204.26366-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Add a test for bug #66046. To run just the compiler tests: ./meta/guile -L test-suite -L . test-suite/tests/compiler.test * test-suite/tests/compiler.test (with-temporary-directory): New syntax. (delete-file-recursively): New procedure. ("compile-file: relative include works") ("compile-file: relative include works with load path canonicalization"): New tests. --- (no changes since v1) test-suite/tests/compiler.test | 82 +++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index a018e0c41..ff923095a 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -1,5 +1,5 @@ ;;;; compiler.test --- tests for the compiler -*- scheme -*- -;;;; Copyright (C) 2008-2014, 2018, 2021-2022 Free Software Foundation, Inc. +;;;; Copyright (C) 2008-2014, 2018, 2021-2023 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -18,15 +18,50 @@ (define-module (tests compiler) #:use-module (test-suite lib) #:use-module (test-suite guile-test) + #:use-module (ice-9 ftw) #:use-module (system base compile) #:use-module ((language tree-il) #:select (tree-il-src call-args)) #:use-module ((system vm loader) #:select (load-thunk-from-memory)) - #:use-module ((system vm program) #:select (program-sources source:addr))) + #:use-module ((system vm program) #:select (program-sources source:addr)) + #:use-module (srfi srfi-26)) (define read-and-compile (@@ (system base compile) read-and-compile)) +;;; Based on 'with-directory-excursion', from (guix build utils). +(define-syntax-rule (with-temporary-directory body ...) + "Run BODY with DIR as the process's current directory." + (let ((init (getcwd)) + (dir (mkdtemp "tempdir.XXXXXX"))) + (dynamic-wind + (lambda () + (chdir dir)) + (lambda () + body ...) + (lambda () + (chdir init) + (delete-file-recursively dir))))) + +;;; XXX: Adapted from (guix build utils). +(define* (delete-file-recursively dir) + "Delete DIR recursively, like `rm -rf', without following symlinks." + (file-system-fold (const #t) ;enter + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat)) (with-test-prefix "basic" @@ -434,3 +469,46 @@ (set! proc ((load-thunk-from-memory bytecode))) (procedure? proc))) (pass-if-equal "proc executes" 42 (proc)))) + +(with-test-prefix "compile-file" + ;; Setup test library sources in a temporary directory. + (let ((hello-sexp '(define-library (hello) + (import (scheme base) + (scheme write)) + (export hello) + (include "hello/hello-impl.scm"))) + (hello-impl-sexp '(begin + (include "../external/nothing.scm") + (include "body.scm"))) + (hello-body-sexp '(define (hello) + (display "hello!\n")))) + (with-temporary-directory + (mkdir "module") + (call-with-output-file "module/hello.scm" + (cut write hello-sexp <>)) + (mkdir "module/hello") + (call-with-output-file "module/hello/hello-impl.scm" + (cut write hello-impl-sexp <>)) + (call-with-output-file "module/hello/body.scm" + (cut write hello-body-sexp <>)) + (mkdir "module/external") + (call-with-output-file "module/external/nothing.scm" (const #t)) + (mkdir "build") + (chdir "build") + + (pass-if "relative include works" + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t) + + ;; This used to fail, because compile-file's #:canonicalization + ;; defaults to 'relative, which caused 'scm_relativize_path' to + ;; strip the prefix not in the load path, to avoid baking an + ;; invalid source file reference in the byte compiled output file + ;; (see: https://bugs.gnu.org/66046). This was fixed by having a + ;; 'compilation-source-file' fluid that preserves the file name + ;; passed to 'compile-file', used by 'include' instead of the file + ;; name of the port. + (pass-if "relative include works with load path canonicalization" + (add-to-load-path (string-append (getcwd) "/../module")) + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t)))) -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 22 Nov 2023 16:12:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:12:21 2023 Received: from localhost ([127.0.0.1]:59741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r5pps-0007Jp-Oa for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:20 -0500 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:44224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r5ppr-0007Ja-Ho for 66046 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:12:19 -0500 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-41cd7a3e8f8so42869571cf.0 for <66046 <at> debbugs.gnu.org>; Wed, 22 Nov 2023 08:12:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669530; x=1701274330; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IPILNr+vFtVFMkkKwxwRy+YYGLcxmUblSlWh4ahfjSk=; b=mjr+JGrv6+S2KkVpxrJhQtEnLYkQs8N67bDJzblLWJ0SP4FfCMGzA0lRRLQCflZgsi 5M4J9MF7YtW4U1W+Zb15TUTYPWSH8Ys7ylnPnLkXjk7yO0V5NfmJ1/VjxzlqoyGDa/kX /16hk0O1rXQKnX6iy60pYLiVGqI2RhvroUYOv12VfqQO9jIRE0067L/jRcmMT18O1UM6 Vp5RVvfd9N5FOIue0weYWy3ba7U81RoFGVeijRiRne3Q89FzQ0oVyejwXTmEmd7UT0Zk 7vsi66qQ5Tr/JwAFaCuj56XTNsAmizfFFnpev8iTm+L33RKdi2YLMeatuGOu0zvs1Dnr s6BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669530; x=1701274330; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IPILNr+vFtVFMkkKwxwRy+YYGLcxmUblSlWh4ahfjSk=; b=XOymUpW+iCKlnk1NnsIPZsBiHdvpTkO0hpE8pp7+hxH3tkGhOgV4s8ygC7glEipQ0P jcRrO/n87elEdnxdtceVNOqlD0nkhgnuD3G+dCrHtdNe6ikGUFUjyV+q+nbBQFMvwBDe jOn0QYENsZLiNy6aeS9hKKp/djtsHYRnh+qoNSEw3anFQ8I/hazp4AkzMi78DKgnd6PT qlykVJMDrr8XvGlzp+A1AdYPHpu0iA2ori6B/LsrQRlUXtvlSzAHpY5LHmi+X/WlyTsz hnI6py69je/qGPh6FfL5iAmFBmMPqxCOgRDdZEJQ9yOFLtB02IDqfsQeCOAReu8+WxGf IQFQ== X-Gm-Message-State: AOJu0YyfUwLyRxlPnvcZdB6KDfd/Y09jfMis8LXtijcPudl6a01HDXnx 6lz2tk7Do/Ic1uPyWLD28RyCYDT8mmI= X-Google-Smtp-Source: AGHT+IFZ8dGOJOLQ++3mMWiyuX0F9LIW8i5g3oitOu2G7kdfBlKW56ccJL2E+kJh5SLiAOefwG0/SQ== X-Received: by 2002:a05:622a:1212:b0:417:b45b:84c3 with SMTP id y18-20020a05622a121200b00417b45b84c3mr2825823qtx.65.1700669530001; Wed, 22 Nov 2023 08:12:10 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-102.b2b2c.ca. [205.233.124.102]) by smtp.gmail.com with ESMTPSA id u7-20020ac87507000000b00419b9b1b0b0sm4516257qtq.56.2023.11.22.08.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:12:09 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH v2 1/3] libguile/fports.c: Remove extraneous include. Date: Wed, 22 Nov 2023 11:11:42 -0500 Message-ID: <20231122161204.26366-1-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Amirouche <amirouche@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) * libguile/fports.c: Delete "hashtab.h" include, which is unused. --- (no changes since v1) libguile/fports.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libguile/fports.c b/libguile/fports.c index 9d4ca6ace..8f19216b7 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -52,7 +52,6 @@ #include "fluids.h" #include "gc.h" #include "gsubr.h" -#include "hashtab.h" #include "keywords.h" #include "modules.h" #include "numbers.h" base-commit: d579848cb5d65440af5afd9c8968628665554c22 -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 18 Nov 2023 22:57:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 18 17:57:01 2023 Received: from localhost ([127.0.0.1]:49639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r4UFI-0007Mw-TK for submit <at> debbugs.gnu.org; Sat, 18 Nov 2023 17:57:01 -0500 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]:45078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r4UFF-0007Mi-Oz for 66046 <at> debbugs.gnu.org; Sat, 18 Nov 2023 17:56:59 -0500 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-66d76904928so4830766d6.2 for <66046 <at> debbugs.gnu.org>; Sat, 18 Nov 2023 14:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700348210; x=1700953010; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=yGKNijdFhq+yGIEV9clzCdRHIblarnvO854+inLXRqY=; b=fN5XXKFHKEoq5Ikr+IYqvWSjM4kIgIOTDd6KzRwnqpeRQT/8ApU9ZLl6WOUZUKunzX q3VOjZfLSzeQc60n4HuFT5Tv0kVDL3QdoGomZpDTEH9E47IQCNK3jsYoZLxxzrvaIutg jFioKcPfNxNPd/N1+AObNyWw7i4PbSEb7zWx5L9w/FvhOb1IZvI0tAXnCzaPDJpS6j// vgFNsIweXdBhc4LGcPrVBX0D3hen/WiSChssd3kR50rKP9jk7sjRnyPWGLxNj5bXPMfJ zcmoGGjbrIyq2jsgy09FV+W4n19n2zmAle9FaAdZSxG6GZn9wJRfo2qG+hpcSJ8omW2S lr5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700348210; x=1700953010; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yGKNijdFhq+yGIEV9clzCdRHIblarnvO854+inLXRqY=; b=aKV31H81bPlv+Cr8a6hj/vo3LU77zO+/WQYDe2Y+dZPio7PrT9GzypUQpVJ4RV+G6l KlK4WSm/duC1ITP496v4Kq9ouDtkqmGXFdxSnbgbHGftYXYRKLEGu93RXlZUJZ0Iy11I Hr2Q2CRyI1K35gV3/adtbZn1oIPm7ui+D8d3nV40papWHpF3T+FySXZLeKqt4O75Kbqo DnbhDiCL8f8xf+9Gnh74jvQaflVuLI6+DUCASz6HmVTijlTmw/J7cCrNMNh0QSzJm9i9 593X5Mb81PzD/pSDpLQpl+cfuOEhkLWTka2DvlfgpWOJkPMUcZT0hgj1Z1DXNTcoVDU1 RqQw== X-Gm-Message-State: AOJu0YzFLF71F/vZZHKx715D8wuo54x/TQqB4aO/I1aaXqtwAEVB8/ZG 4p1B6wM2MApPO9xeESB3Gp7qKazxK8w= X-Google-Smtp-Source: AGHT+IGahZfty8an43xZVnGv7eHgjYvYpbswrj7rB6pwdrtbl24t6QvGDOUk1HZfK/yi7B9FYiY0Fw== X-Received: by 2002:a05:6214:e64:b0:66f:b847:71b7 with SMTP id jz4-20020a0562140e6400b0066fb84771b7mr4043291qvb.25.1700348210315; Sat, 18 Nov 2023 14:56:50 -0800 (PST) Received: from hurd (dsl-154-236.b2b2c.ca. [66.158.154.236]) by smtp.gmail.com with ESMTPSA id m13-20020a0cbf0d000000b0066d04196c3dsm1698105qvi.49.2023.11.18.14.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 14:56:49 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Amirouche <amirouche@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <87il64cu8z.fsf@HIDDEN> (Maxim Cournoyer's message of "Tue, 14 Nov 2023 08:57:48 -0500") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> <87il64cu8z.fsf@HIDDEN> Date: Sat, 18 Nov 2023 17:56:48 -0500 Message-ID: <87msvabrgv.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: "66046 <at> debbugs.gnu.org" <66046 <at> debbugs.gnu.org> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, I've just found a cross-compilation buggy interaction with my fix: --8<---------------cut here---------------start------------->8--- $ touch ./module/srfi/srfi-151.scm maxim@hurd ~/src/guile [env]$ touch ./module/srfi/srfi-160/base.sld maxim@hurd ~/src/guile [env]$ m make all-recursive make[1]: Entering directory '/home/maxim/src/guile' Making all in lib make[2]: Entering directory '/home/maxim/src/guile/lib' make all-recursive make[3]: Entering directory '/home/maxim/src/guile/lib' make[4]: Entering directory '/home/maxim/src/guile/lib' make[4]: Nothing to be done for 'all-am'. make[4]: Leaving directory '/home/maxim/src/guile/lib' make[3]: Leaving directory '/home/maxim/src/guile/lib' make[2]: Leaving directory '/home/maxim/src/guile/lib' Making all in meta make[2]: Entering directory '/home/maxim/src/guile/meta' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/maxim/src/guile/meta' Making all in libguile make[2]: Entering directory '/home/maxim/src/guile/libguile' make all-am make[3]: Entering directory '/home/maxim/src/guile/libguile' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/maxim/src/guile/libguile' make[2]: Leaving directory '/home/maxim/src/guile/libguile' Making all in module make[2]: Entering directory '/home/maxim/src/guile/module' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/maxim/src/guile/module' Making all in stage0 make[2]: Entering directory '/home/maxim/src/guile/stage0' BOOTSTRAP(stage0) GUILEC srfi/srfi-151.go BOOTSTRAP(stage0) GUILEC srfi/srfi-160/base.go ;;; note: source file /home/maxim/src/guile/module/srfi/srfi-151.scm ;;; newer than compiled /home/maxim/src/guile/stage0/srfi/srfi-151.go ;;; note: source file /home/maxim/src/guile/module/srfi/srfi-151.scm ;;; newer than compiled /home/maxim/src/guile/cache/guile/ccache/3.0-LE-8-4.6/home/maxim/src/guile/module/srfi/srfi-151.scm.go Backtrace: In ice-9/r6rs-libraries.scm: 113:17 19 (_ #<syntax:base.sld:5:16 (#<syntax:base.sld:5:17 srfi?> ?) In ice-9/boot-9.scm: 3355:17 18 (resolve-interface (srfi srfi-151) #:select _ #:hide _ # ?) In ice-9/threads.scm: 397:8 17 (_ #<procedure 7f94a9df2a00 at ice-9/boot-9.scm:3269:7 ?>) In ice-9/boot-9.scm: 3281:13 16 (_) In ice-9/threads.scm: 397:8 15 (_ #<procedure 7f94a9d7a180 at ice-9/boot-9.scm:3565:5 ?>) In ice-9/boot-9.scm: 3572:20 14 (_) 2864:4 13 (save-module-excursion #<procedure 7f94a6d85b10 at ice-?>) 3592:26 12 (_) In unknown file: 11 (primitive-load-path "srfi/srfi-151" #<procedure 7f94a9?>) In ice-9/eval.scm: 721:20 10 (primitive-eval (define-library (srfi srfi-151) (# #) ?)) wrote `srfi/srfi-151.go' In ice-9/psyntax.scm: 1229:36 9 (expand-top-sequence (#<syntax:srfi-151.scm:23:0 (def?>) ?) 1123:16 8 (lp (#<syntax:srfi-151.scm:23:0 (define-library #<syn?>) ?) 1123:16 7 (lp (#<syntax:srfi-151.scm:23:0 (#<syntax:r6rs-libr?> ?) ?) 1123:16 6 (lp (#<syntax:srfi-151.scm:23:0 (#<syntax:r7rs-librar?>) ?) 1121:20 5 (lp (#<syntax:srfi-151.scm:23:0 (#<syntax:base.scm:30?>) ?) 1342:32 4 (syntax-type (#<syntax:base.scm:301:10 include> #<sy?>) ?) 1562:32 3 (expand-macro #<procedure 7f94a9c0ed98 at ice-9/psynta?> ?) 3278:16 2 (_ #<syntax:srfi-151.scm:54:11 "srfi-151/bitwise-33.sc?> ?) In unknown file: 1 (open-file "../module/srfi/srfi-160/srfi-151/bitwise-3?" ?) In ice-9/boot-9.scm: 1682:22 0 (lp 0) ice-9/boot-9.scm:1682:22: In procedure lp: In procedure open-file: No such file or directory: "../module/srfi/srfi-160/srfi-151/bitwise-33.scm" make[2]: *** [Makefile:2562: srfi/srfi-160/base.go] Error 1 make[2]: Leaving directory '/home/maxim/src/guile/stage0' make[1]: *** [Makefile:2203: all-recursive] Error 1 make[1]: Leaving directory '/home/maxim/src/guile' make: *** [Makefile:2088 : all] Erreur 2 --8<---------------cut here---------------end--------------->8--- I'll try to come up with a test case, then a fix. -- Thanks, Maxim
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 14 Nov 2023 13:58:40 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 14 08:58:40 2023 Received: from localhost ([127.0.0.1]:60533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r2tw7-0005G6-VV for submit <at> debbugs.gnu.org; Tue, 14 Nov 2023 08:58:40 -0500 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]:51318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r2tw6-0005Ft-EQ for 66046 <at> debbugs.gnu.org; Tue, 14 Nov 2023 08:58:39 -0500 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6779fb43e5cso25357316d6.2 for <66046 <at> debbugs.gnu.org>; Tue, 14 Nov 2023 05:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699970270; x=1700575070; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+Oi6F3us8M2tPsMFMJ8E71lXz8R51YKiPI3Rey0Tfdo=; b=W5siV/DwW4W+tnnU7U/pHAPj+WEL/3v9E/HUOhZcMFbG5qXzoKgkzI2i6g21ixb64u xxH2a+1Q8ClCAqPzSlnTRrDjp2lNJvwlZmCUNRiRactsqY6Ao1n+w2BNZgWU1R+pTibR qGsSiL10mvNF4LbyLeBqUt289DKecn2ODcwCFcvXF9Gqd2wpXOMgitwPPKdCGSVS3+SC GlAWc41sKtya4iBX626C6V69r3EuhjL6fjkEYlEhr3yVw7fZF1OzxXv/o2xwZ4Uj8o6K 91V1oaUa0L0CqWX560MzRy9CbR4BvlyzEzrKZ8pP28iZZyda1W20Yp2ZENqRy0owAaGW 0EwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699970270; x=1700575070; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+Oi6F3us8M2tPsMFMJ8E71lXz8R51YKiPI3Rey0Tfdo=; b=jvb3e5NbclL2UEgG1/G2nPH06K2LN6HivkvTyu8eXxMmjajTUsNvS+Ca6NhhKPY5G8 crb3thFYyovkU/ZAiJRCoYPgrXoMe/g5EavFuEqevDoNyMhP9Hqe//bulvDdNXnVjBBJ DECK8ImBcV2/lgtgP9m1yNYs+KTjx6asv683KWOi5RrvesT7RH8NgNEoen3GsycNCN0i V6zlvAPNHJZi2W54cUuyCYtTAei0fqrhE70VMKf4+7phTcREX2gqSX6WUbTgViIEHOsF 0YHVrL2nL78ng41OO7/0WR9YGbeaY1+MS/05vN/l9Ya3L8FGA6/NJfc9w+DQK/2Ph2Bd iG4Q== X-Gm-Message-State: AOJu0YxAwC8pE9VmcvCkgXIg1BXcXtiWHEWI1lAZIgNGqAFvEvDzfizD mAFqSwKc8Gz4Hz+DsfBnmt1SguFXZaE= X-Google-Smtp-Source: AGHT+IHzAl652FbdD9Wmu4z68eDUsk3cA9Widq6jj0Y2nnss7hEPk2EKha2lijtTruu+Vxh2wBCipQ== X-Received: by 2002:a05:6214:5281:b0:66d:6586:f2b4 with SMTP id kj1-20020a056214528100b0066d6586f2b4mr3094351qvb.21.1699970270148; Tue, 14 Nov 2023 05:57:50 -0800 (PST) Received: from hurd (dsl-10-129-23.b2b2c.ca. [72.10.129.23]) by smtp.gmail.com with ESMTPSA id z13-20020a0ce60d000000b0065afbb39b2dsm2929569qvm.47.2023.11.14.05.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:57:49 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Amirouche <amirouche@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> (amirouche@HIDDEN's message of "Sat, 11 Nov 2023 11:58:49 +0000") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> Date: Tue, 14 Nov 2023 08:57:48 -0500 Message-ID: <87il64cu8z.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: "66046 <at> debbugs.gnu.org" <66046 <at> debbugs.gnu.org> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Amirouche <amirouche@HIDDEN> writes: > If I am not mistaken, the patch is not backward compatible. > > The problem with the current patch is that it force the included file > to be next to the including file, there is no fallback mechanism. > The algorithm should be dynamic using an ordered list a priority to > the favorite behavior. > > The most relevant hunk is: > > --- a/module/ice-9/psyntax.scm > +++ b/module/ice-9/psyntax.scm > @@ -3260,15 +3260,20 @@ > (let ((syntax-dirname (lambda (stx) > (define src (syntax-source stx)) > (define filename (and src (assq-ref src 'filename))) > - (and (string? filename) > - (dirname filename))))) > + (define source-file-name > + (fluid-ref compilation-source-file-name)) > + (or (and source-file-name > + (dirname source-file-name)) > + (and (string? filename) > + (dirname filename)))))) > > Here the code says: the included file must be in (syntax-dirname). > It is preferable to have fallbacks, to be backward compatible. It also falls back to the existing behavior, which is of picking up the parent directory of the port's file name (that is, the parent directory of the source file using the 'include' syntax), per the 'or' above. Isn't that sufficient? > `syntax-dirname' must be `syntax-dirnames' to return candidate directories > sorted list with biggest priority coming first where to find included > files. I'm not sure what algorithm you are suggesting here; but it seems it'd be something new in Guile. Since the behavior of 'include' is not standardized, I'd prefer we change it only if there are interesting use cases not yet covered (can you think of a scenario? we could add a test for it). > Also, mind the use of the fluid and how it interact with parallel compilation. Fluids are thread safe, as far as I know, and files are compiled one at a time anyway, so I don't foresee any problem here, as you also noted in #scheme on Libera. -- Thanks, Maxim
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 11 Nov 2023 11:59:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 11 06:59:52 2023 Received: from localhost ([127.0.0.1]:52238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r1meW-0007DS-AC for submit <at> debbugs.gnu.org; Sat, 11 Nov 2023 06:59:52 -0500 Received: from mail-4323.proton.ch ([185.70.43.23]:38637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <amirouche@HIDDEN>) id 1r1meR-0007DC-TL for 66046 <at> debbugs.gnu.org; Sat, 11 Nov 2023 06:59:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hyper.dev; s=protonmail2; t=1699703939; x=1699963139; bh=H6ubGdfD8/rGRmzpY5ETyA12MBkgHbHw4gKBgsejnpI=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Ps0yjLE3ilbxhIpJTf9nkzm92s/V/+XhmxiEysLICOHMVr8h/Rx4qb3DhyNioQ9sb yDpieNBM6YeZCT7OwHtsjrk257Cnwyl4rCDy9jBRrF6obL9g66xD21W5GmWg25m1qP XGEMgiQ2SkGwRHifJbAsapdsYgEQW2fNDt+JBE+Rit06oEpZTFDveyNlyqvHX9L1U6 OzPXT7MWJ9wMwSpwc86HrLLQ0Fg/JGdYyWFxbghhVjt6QfJDkaeg40HGSY1/unDgCf sPuOJ9eeReXzJsrxZ8QvjPTp1ST/UHIfsXD5yb8msHVgVnCvB+G9htwkkj3ZatcV7Z 6Kgm5xgj1Mjxg== Date: Sat, 11 Nov 2023 11:58:49 +0000 To: "66046 <at> debbugs.gnu.org" <66046 <at> debbugs.gnu.org> From: Amirouche <amirouche@HIDDEN> Subject: Re: Relative includes in R7RS define-library seem broken Message-ID: <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> Feedback-ID: 39575501:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) If I am not mistaken, the patch is not backward compatible. The problem with the current patch is that it force the included file=20 to be next to the including file, there is no fallback mechanism.=20 The algorithm should be dynamic using an ordered list a priority to the favorite behavior.=20 The most relevant hunk is: --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -3260,15 +3260,20 @@ (let ((syntax-dirname (lambda (stx) (define src (syntax-source stx)) (define filename (and src (assq-ref src 'filenam= e))) - (and (string? filename) - (dirname filename))))) + (define source-file-name + (fluid-ref compilation-source-file-name)) + (or (and source-file-name + (dirname source-file-name)) + (and (string? filename) + (dirname filename)))))) Here the code says: the included file must be in (syntax-dirname).=20 It is preferable to have fallbacks, to be backward compatible. `syntax-dirname' must be `syntax-dirnames' to return candidate directories= =20 sorted list with biggest priority coming first where to find included=20 files. Also, mind the use of the fluid and how it interact with parallel compilati= on. BR ref: https://github.com/justinethier/cyclone/issues/494#issuecomment-132895= 8946 ref: https://github.com/justinethier/cyclone/commit/ab25e360a9d7b67c2e5eda0= 86001ca0761a3f34f#diff-b9136575f3ccbf09887d1da9fb4b6e136e4e32a839c10cf85569= 6ec1cf6add4bR54-R58
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 10 Nov 2023 03:37:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 09 22:37:27 2023 Received: from localhost ([127.0.0.1]:49262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r1IKk-0007du-MD for submit <at> debbugs.gnu.org; Thu, 09 Nov 2023 22:37:27 -0500 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]:46432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r1IKf-0007dV-1Z for 66046 <at> debbugs.gnu.org; Thu, 09 Nov 2023 22:37:24 -0500 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-672096e0e89so9850206d6.1 for <66046 <at> debbugs.gnu.org>; Thu, 09 Nov 2023 19:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699587395; x=1700192195; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ksId9g+ZHB751VdieHYCNG9b72dLXteLyFJ3PkU90H4=; b=mE2jpv4cYA4YPldSvekCuZTO/+88IbDcu5r5xLTy9fdcbdjchVD1Oi06wVAFTEWNsz Kb9BXciA2PGdy9kqvvcwz71iA+dklka3tr4SMcAJIk1T+8vj7RqrtChoRhqQVoO/5FLl /Nbahm6seJslIsJXEux2TNncNcaYct2sqx0p9wFeue6dMzcH7/tLaAeEdOyIKm+gB1AK xufrKpC/tE5RcZTVTY4gx+n9oYQWvkb+hKX7EeoMIPLW0jzyGdkV4jeygsyI/sFVbo3Y SRCx9QZiT0u4cV3yq93bJTnp3T+d3+EIblRogyPcEQKl47Fo/5rLld3qHSXK/4216YMG aeNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699587395; x=1700192195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ksId9g+ZHB751VdieHYCNG9b72dLXteLyFJ3PkU90H4=; b=fOXG1x0zEUJ8rQDy3MIrr/nujNh4B9hItUzcS620vLOFeVW68tOHrPhSTelzgiGF8z 11wavDd8WWDag3rAisYQB5PFySXgiKaiLKhrqDg0IDjQfA4pi/3OPQNp/SqOkrpxOk// ZAE3PXFitNjgCVVeZ43NIKyWOuRqVy51YzKZqXqD2IVZTnNVGFmce2RddN850EcHPz+8 EANfW8i2QpMU9Tx722ZWzZ4ZtTU7VVlQRdU8DOAKIGoanAFGqYgCZ+Y7lWpVBzP0+5Zz p2jprW/uUYHGs0LA4B7lDGP8tdZMy4zyBG7Zbgnhn6frbj9e3u6juvZS/4ummADRG/BY vAcw== X-Gm-Message-State: AOJu0YxX1Sow1d7KSZSnwrKjtrScdEBv5ED09ZmGmNdh2tunpyOjwpeQ b+RMmGqL9LYR1wWH90M4dK84gQvuV8E= X-Google-Smtp-Source: AGHT+IGBZTWgdzSw5idbGR/9BuLdKLX2eIfJYLKghgB0Gn7UvsEd0bVRjIjBhBybEWrVaYNmhWsQ3A== X-Received: by 2002:ad4:5f8c:0:b0:66d:42d9:fc83 with SMTP id jp12-20020ad45f8c000000b0066d42d9fc83mr7175839qvb.10.1699587395383; Thu, 09 Nov 2023 19:36:35 -0800 (PST) Received: from localhost.localdomain (dsl-10-129-91.b2b2c.ca. [72.10.129.91]) by smtp.gmail.com with ESMTPSA id mn11-20020a0562145ecb00b0065aff6b49afsm2609967qvb.110.2023.11.09.19.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:36:35 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH 1/2] tests: Add new compile-file tests. Date: Thu, 9 Nov 2023 22:36:21 -0500 Message-ID: <20231110033627.26468-1-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <878r7akwce.fsf@HIDDEN> References: <878r7akwce.fsf@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Add a test for bug #66046. To run just the compiler tests: ./meta/guile -L test-suite -L . test-suite/tests/compiler.test * test-suite/tests/compiler.test (with-temporary-directory): New syntax. (delete-file-recursively): New procedure. ("compile-file: relative include works") ("compile-file: relative include works with load path canonicalization"): New tests. --- test-suite/tests/compiler.test | 75 +++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index a018e0c41..2026d5ff3 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -1,5 +1,5 @@ ;;;; compiler.test --- tests for the compiler -*- scheme -*- -;;;; Copyright (C) 2008-2014, 2018, 2021-2022 Free Software Foundation, Inc. +;;;; Copyright (C) 2008-2014, 2018, 2021-2023 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -18,6 +18,7 @@ (define-module (tests compiler) #:use-module (test-suite lib) #:use-module (test-suite guile-test) + #:use-module (ice-9 ftw) #:use-module (system base compile) #:use-module ((language tree-il) #:select (tree-il-src call-args)) @@ -27,6 +28,39 @@ (define read-and-compile (@@ (system base compile) read-and-compile)) +;;; Based on 'with-directory-excursion', from (guix build utils). +(define-syntax-rule (with-temporary-directory body ...) + "Run BODY with DIR as the process's current directory." + (let ((init (getcwd)) + (dir (mkdtemp "tempdir.XXXXXX"))) + (dynamic-wind + (lambda () + (chdir dir)) + (lambda () + body ...) + (lambda () + (chdir init) + (delete-file-recursively dir))))) + +;;; XXX: Adapted from (guix build utils). +(define* (delete-file-recursively dir) + "Delete DIR recursively, like `rm -rf', without following symlinks." + (file-system-fold (const #t) ;enter + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat)) (with-test-prefix "basic" @@ -434,3 +468,42 @@ (set! proc ((load-thunk-from-memory bytecode))) (procedure? proc))) (pass-if-equal "proc executes" 42 (proc)))) + +(with-test-prefix "compile-file" + ;; Setup test library sources in a temporary directory. + (let ((top-sexp '(define-library (hello) + (import (scheme base) + (scheme write)) + (export hello) + (include "hello/hello-impl.scm"))) + (included-sexp '(define (hello) + (display "hello!\n")))) + (with-temporary-directory + (mkdir "module") + (call-with-output-file "module/hello.scm" + (lambda (port) + (write top-sexp port))) + (mkdir "module/hello") + (call-with-output-file "module/hello/hello-impl.scm" + (lambda (port) + (write included-sexp port))) + (mkdir "build") + (chdir "build") + + (pass-if "relative include works" + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t) + + ;; This used to fail, because compile-file's #:canonicalization + ;; defaults to 'relative, which caused 'scm_relativize_path' to + ;; strip the prefix not in the load path, to avoid baking an + ;; invalid source file reference in the byte compiled output file + ;; (see: https://bugs.gnu.org/66046). This was fixed by having a + ;; 'compilation-source-file' fluid that preserves the file name + ;; passed to 'compile-file', used by 'include' instead of the file + ;; name of the port. + (pass-if "relative include works with load path canonicalization" + (begin + (add-to-load-path (string-append (getcwd) "/../module")) + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t))))) base-commit: 75cd95060fb1ea7586f0e4b9081694c6d61f1d3b -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 10 Nov 2023 03:37:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 09 22:37:26 2023 Received: from localhost ([127.0.0.1]:49260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r1IKk-0007ds-80 for submit <at> debbugs.gnu.org; Thu, 09 Nov 2023 22:37:26 -0500 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:50479) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r1IKg-0007dY-8Z for 66046 <at> debbugs.gnu.org; Thu, 09 Nov 2023 22:37:24 -0500 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-779f2718accso106047585a.1 for <66046 <at> debbugs.gnu.org>; Thu, 09 Nov 2023 19:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699587397; x=1700192197; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iE/mKy0/M6yEFXJsBzicKTjFYJ4/+Xd4Y/9wy6kEwVE=; b=SZSE9UH4+GBzLR6rDUwJE3YwtCmK5xvCafqxOCmVgUNuXvwbC9n/CFksyNuvV1qJj1 U3bA/ZdZkurk/l6ljeAKSVy0bpUDBtbzBjGfdBcFURISIkG1hw3XJrsGr11jCE5lX5H0 ZdOEH2D0JGvoIhLR6tQv64n/1pSjgg3A7To8iaC94EPF3XvQFqgLBHYyalhZiZ7oK3XI Cg8xXuhGXRKyb8tuDnUkrFE/Byzu2ZRKxF6NvZt7OpF/DONPl/cjHfnX2RVTgs/AMgmG SVZeMiY43Ypcy/+eIZ5hKfPkL4T5ZeKrStT9oQEP5odAs5TI27i/aKhcvOeqTqeTwuLc DNSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699587397; x=1700192197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iE/mKy0/M6yEFXJsBzicKTjFYJ4/+Xd4Y/9wy6kEwVE=; b=kVpsoVmc+XNoff7ZrrrrmIuKUJ6tYdY9isdXkGnLHntLrLfoEPo2223vQi5esNxpUq qHdpPV+wxnsJedxhRkecKVY8/E3SaTqTI0u8CoPUpndl6MERFUja3qJUDzXiZ5hoyyAO SZrXa1pXbbDVh/DcUr3O2InKx6hSAY9dJNFaQttYo7CEhlw12gUA+mKms1eHUuk4gYck 80qFZNt9ThAWIQTfUYxhuPr+ljZfF2bR8Ver0ype43PdqSlbq1TlVtxne/5+Df9TJlXq dFR7XANSymr3EodKTPEHA3B0+N3md6EEYI8U0LFqA6YfwvYuHa/UPOzR8ruX2wUy4bWe iJiw== X-Gm-Message-State: AOJu0YwI6e1+JXHndz0po6+QlX4F6od6xme2zSX6s/8Sa0bwDj1uDxlM SB2dkFJATskMKjoetnl7AHz0GKmXp4o= X-Google-Smtp-Source: AGHT+IEJZYocBr8SE43FXBmsEfPp+Sy82kBYLOk4EU7MXYjz9T3FeYdQ8Wjzd6uKLs0BXIZRS5LlVg== X-Received: by 2002:a05:6214:40d:b0:66d:2aa3:cd49 with SMTP id z13-20020a056214040d00b0066d2aa3cd49mr6368233qvx.14.1699587396835; Thu, 09 Nov 2023 19:36:36 -0800 (PST) Received: from localhost.localdomain (dsl-10-129-91.b2b2c.ca. [72.10.129.91]) by smtp.gmail.com with ESMTPSA id mn11-20020a0562145ecb00b0065aff6b49afsm2609967qvb.110.2023.11.09.19.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:36:36 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 66046 <at> debbugs.gnu.org Subject: [PATCH 2/2] ice-9: Fix 'include' when used in compilation contexts. Date: Thu, 9 Nov 2023 22:36:22 -0500 Message-ID: <20231110033627.26468-2-maxim.cournoyer@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231110033627.26468-1-maxim.cournoyer@HIDDEN> References: <878r7akwce.fsf@HIDDEN> <20231110033627.26468-1-maxim.cournoyer@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: Timothy Sample <samplet@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fix bug #66046. Introduce a 'compilation-source-file-name' fluid that captures the pre-canonicalized file name used when compiling a file, before it gets modified in fport_canonicalize_filename. That reference that can then used directly by 'include', avoiding problems. * module/ice-9/boot-9.scm (compilation-source-file-name): New fluid. (compile-file): Set it to the value of FILE. (compile-and-load): Likewise. * module/ice-9/psyntax.scm (call-with-include-port): Use it. --- module/ice-9/boot-9.scm | 6 ++++++ module/ice-9/psyntax.scm | 13 +++++++++---- module/system/base/compile.scm | 6 ++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index a5f2eea9b..7f2a02007 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -395,6 +395,12 @@ If returning early, return the return value of F." ;; expanded macros, to dispatch an input against a set of patterns. (define $sc-dispatch #f) +;;; This fluid captures the original compiled source file name, before +;;; it gets potentially stripped by the file ports canonicalization. It +;;; is used with 'include' to locate the true source, which is necessary +;;; when using relative paths during compilation, for example. +(define compilation-source-file-name (make-fluid #f)) + ;; Load it up! (primitive-load-path "ice-9/psyntax-pp") ;; The binding for `macroexpand' has now been overridden, making psyntax the diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 7811f7118..ccdd15fca 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -3260,15 +3260,20 @@ (let ((syntax-dirname (lambda (stx) (define src (syntax-source stx)) (define filename (and src (assq-ref src 'filename))) - (and (string? filename) - (dirname filename))))) + (define source-file-name + (fluid-ref compilation-source-file-name)) + (or (and source-file-name + (dirname source-file-name)) + (and (string? filename) + (dirname filename)))))) (lambda* (filename proc #:key (dirname (syntax-dirname filename))) "Like @code{call-with-input-file}, except relative paths are -searched relative to the @var{dirname} instead of the current working +searched relative to @var{dirname} instead of the current working directory. Also, @var{filename} can be a syntax object; in that case, and if @var{dirname} is not specified, the @code{syntax-source} of @var{filename} is used to obtain a base directory for relative file -names." +names. As a special case, when the @var{compilation-source-file-name} +fluid is set, its value overrides the @var{dirname} argument provided." (let* ((filename (syntax->datum filename)) (p (open-input-file (cond ((absolute-file-name? filename) diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm index a33d012bd..7b2670c21 100644 --- a/module/system/base/compile.scm +++ b/module/system/base/compile.scm @@ -174,7 +174,8 @@ (opts '()) (canonicalization 'relative)) (validate-options opts) - (with-fluids ((%file-port-name-canonicalization canonicalization)) + (with-fluids ((%file-port-name-canonicalization canonicalization) + (compilation-source-file-name file)) (let* ((comp (or output-file (compiled-file-name file) (error "failed to create path for auto-compiled file" file))) @@ -202,7 +203,8 @@ (opts '()) (canonicalization 'relative)) (validate-options opts) - (with-fluids ((%file-port-name-canonicalization canonicalization)) + (with-fluids ((%file-port-name-canonicalization canonicalization) + (compilation-source-file-name file)) (read-and-compile (open-input-file file) #:from from #:to to #:opts opts #:optimization-level optimization-level -- 2.41.0
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 7 Nov 2023 04:43:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 06 23:43:34 2023 Received: from localhost ([127.0.0.1]:41123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r0Dw5-0001B8-NR for submit <at> debbugs.gnu.org; Mon, 06 Nov 2023 23:43:34 -0500 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:45550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r0Dvz-0001AX-5W for 66046 <at> debbugs.gnu.org; Mon, 06 Nov 2023 23:43:28 -0500 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7789577b53fso344558685a.3 for <66046 <at> debbugs.gnu.org>; Mon, 06 Nov 2023 20:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699332163; x=1699936963; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=4SsBSLj5Gk9A6Fu6rKOYXMGveZqYJLyxPxhjQP9qnXA=; b=bUsmh++yijVcOd7+7guM37FjwvlVeHpmbBzouL7CFFqx9niVYmLPeYMpRKrZSnHvvK gNWLsZatBeYjiqHP2aLdbYyV269TJ/BYhB7FxTYkZ9dzdmlsT0hJSSkoUanQUVjZC+oh oSZdONtsxY1laQZLJchvRuqp9QfFfgkXSaeuHpFnfBQcY8ElGvRVMmRtrTypKyObhCCy snaU/PsWPKFy1TZNHOlBxgGZ046kJ3e83fEiGekVLqW+wUHkVqLPbVwnyKsbPGBwu8Y8 Xhow11uvWZxXSj3kTtmhWbE8AStWencSKpXfIYbL0LCeDKEFcHi45lNTBY5lzLjhhzlO p+eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699332163; x=1699936963; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4SsBSLj5Gk9A6Fu6rKOYXMGveZqYJLyxPxhjQP9qnXA=; b=NjJCvscR/NAWQSxnEe1RZzCOqb373AC1vxGUYQI7MDTNMTBkUJ1TZ8q0kiQpeFRSog cZwiB221VMiMHv16+xh0gktFAVKnXtVs9Ac6VT67XWVYMWRpG+1QDccr2ykEul7KVhx6 c45I/RCJA3d2G8Nhuv8oM40kUX3yZ9XsdH0/fqfywhrekuYc3UTzhcFeTlnNORmwqZs1 yicxtGv4UkTyxkyL/zFqufYpnTrJfFUwUaIVbJYEFA/SwZs9t1WyWYpBTrgrEO7uQvlI 3isFSQ3TBNHAeA8docJFEEeJ+fFjWDsjEpFEkm5CnWbggCJWWPhPg+dDXDYWN15daER3 uAkg== X-Gm-Message-State: AOJu0YxBeRNds3uL7mf5MbQZefmrrwUMMyCiZiKfUe6omnzTpmh+JeTe YOTXS6It0Kh4XKvcn4yX0C2NWvWAv1Q= X-Google-Smtp-Source: AGHT+IGi2kn6xKIQ0dnSbEbIxsxfWYEUjpSvmBLNkbzRCQl7nACEO6ljEJhs/GaZ7CUaZbeV0nABGg== X-Received: by 2002:a05:6214:f2c:b0:670:710f:2042 with SMTP id iw12-20020a0562140f2c00b00670710f2042mr38093244qvb.15.1699332163574; Mon, 06 Nov 2023 20:42:43 -0800 (PST) Received: from hurd (dsl-10-130-87.b2b2c.ca. [72.10.130.87]) by smtp.gmail.com with ESMTPSA id f12-20020a0cf7cc000000b0065b0554ae78sm4024702qvo.100.2023.11.06.20.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 20:42:42 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Timothy Sample <samplet@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <87h6lylnvi.fsf@HIDDEN> (Maxim Cournoyer's message of "Mon, 06 Nov 2023 13:48:01 -0500") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> <87cywmzqbj.fsf@HIDDEN> <87h6lylnvi.fsf@HIDDEN> Date: Mon, 06 Nov 2023 23:42:41 -0500 Message-ID: <878r7akwce.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: 66046 <at> debbugs.gnu.org, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hello, Here's a new test that reproduces the issue: --=-=-= Content-Type: text/x-patch Content-Disposition: inline 1 file changed, 65 insertions(+) test-suite/tests/compiler.test | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ modified test-suite/tests/compiler.test @@ -18,6 +18,7 @@ (define-module (tests compiler) #:use-module (test-suite lib) #:use-module (test-suite guile-test) + #:use-module (ice-9 ftw) #:use-module (system base compile) #:use-module ((language tree-il) #:select (tree-il-src call-args)) @@ -27,6 +28,39 @@ (define read-and-compile (@@ (system base compile) read-and-compile)) +;;; Based on 'with-directory-excursion', from (guix build utils). +(define-syntax-rule (with-temporary-directory body ...) + "Run BODY with DIR as the process's current directory." + (let ((init (getcwd)) + (dir (mkdtemp "tempdir.XXXXXX"))) + (dynamic-wind + (lambda () + (chdir dir)) + (lambda () + body ...) + (lambda () + (chdir init) + (delete-file-recursively dir))))) + +;;; XXX: Adapted from (guix build utils). +(define* (delete-file-recursively dir) + "Delete DIR recursively, like `rm -rf', without following symlinks." + (file-system-fold (const #t) ;enter + (lambda (file stat result) ; leaf + (delete-file file)) + (const #t) ; down + (lambda (dir stat result) ; up + (rmdir dir)) + (const #t) ; skip + (lambda (file stat errno result) + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror errno))) + #t + dir + + ;; Don't follow symlinks. + lstat)) (with-test-prefix "basic" @@ -434,3 +468,34 @@ (set! proc ((load-thunk-from-memory bytecode))) (procedure? proc))) (pass-if-equal "proc executes" 42 (proc)))) + +(with-test-prefix "compile-file" + ;; Setup test library sources in a temporary directory. + (let ((top-sexp '(define-library (hello) + (import (scheme base) + (scheme write)) + (export hello) + (include "hello/hello-impl.scm"))) + (included-sexp '(define (hello) + (display "hello!\n")))) + (with-temporary-directory + (mkdir "module") + (call-with-output-file "module/hello.scm" + (lambda (port) + (write top-sexp port))) + (mkdir "module/hello") + (call-with-output-file "module/hello/hello-impl.scm" + (lambda (port) + (write included-sexp port))) + (mkdir "build") + (chdir "build") + + (pass-if "relative include works" + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t) + + (pass-if "relative include works with load path canonicalization" + (begin + (add-to-load-path (string-append (getcwd) "/../module")) + (compile-file "../module/hello.scm" #:output-file "hello.go") + #t))))) --=-=-= Content-Type: text/plain I run it like: --8<---------------cut here---------------start------------->8--- ./meta/guile -L test-suite -L . test-suite/tests/compiler.test --8<---------------cut here---------------end--------------->8--- And I see: --8<---------------cut here---------------start------------->8--- ERROR: compile-file: relative include works with load path canonicalization - arguments: ((system-error "open-file" "~A: ~S" ("Aucun fichier ou dossier de ce type" "./hello/hello-impl.scm") (2))) --8<---------------cut here---------------end--------------->8--- That's the include directive failing because scm_i_relativize_path caused the path to be stripped from "../module/hello.scm" to "hello.scm"; then include, through its call-with-include-port helper, calls (dirname "hello.scm"), which produces ".". Finally, the same helper calls (in-vicinity "." "hello/hello-impl.scm"), which produces the unresolvable "./hello/hello-impl.scm" file name seen in the error above. -- Thanks, Maxim --=-=-=--
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 6 Nov 2023 19:58:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 06 14:58:55 2023 Received: from localhost ([127.0.0.1]:40746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r05kC-0001LE-QG for submit <at> debbugs.gnu.org; Mon, 06 Nov 2023 14:58:55 -0500 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:57629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r05k7-0001Kx-H5 for 66046 <at> debbugs.gnu.org; Mon, 06 Nov 2023 14:58:44 -0500 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-41cda69486eso32668821cf.3 for <66046 <at> debbugs.gnu.org>; Mon, 06 Nov 2023 11:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699300676; x=1699905476; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=o50l63dLr2yvULi6Fmkyr4EhC+brX8k6jGONr9wnW/s=; b=En+imRFSP/LiX+nvCZ1oI7xbX5+NuspSiKzcJzj8Tb/ma/P2lvrCIvcq75xKJy4q/Y IbnDVsRuJAHL4j1BmU0YzbN9S79YDrdvmuluWoxnQGK2GIKobo71iMGoWuj2TJRbipqk OGgbV3o9/wHMdw733Rf7nG72iDfgJJ6Xa5lB0MIIFdwPORNLu81rm3d5aq0GAbS9zwHH jEWtUJUoTi3V6Z5lxrpaYYqKu1KgBRLLnsEWf9IWDQqbvycU7PP5v8cFG05s0xNZDmf6 azQ+wun90DXZwIZoIiFTacUrYScGJj7V+WtNLMNvD/2NR7mAjo18zP+Zkc4Pmib011IF Smlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699300676; x=1699905476; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o50l63dLr2yvULi6Fmkyr4EhC+brX8k6jGONr9wnW/s=; b=Ys85l2xlteEOWWBunC+8OsB076h9gACH72fi37cvW/lpANal7b/st4WsfwI9rN9lI6 kgnrdzvqizHAtpcoIhfHXXfTvc6aASCwtFh0zmyKSEMNPOW/qR6JcUPBuGQICXo41+/x VDCRaUgAgLMXp44XTYnPTn0xmEQaj47atqb6jP+Z307mf21cZfBCy5F8eUyJxV9bSMsE TSnmeeuGa5dsu6qzW6EqGd4fn54vDdIJpVt7N/lbf5+/cCV901Lqeg3WqJ82qXYJ4S6y hNvSZ5rZiZ2/7WLXRXiFfFO3TDFKv7BV5Gy6H836SUvaxaqAXYPuJ63PxwsImA1tUd6F VIJw== X-Gm-Message-State: AOJu0Yz1L23Oqm5oU1WXNCqrIsbplSBQSVoMtWYVA3wIItK6uKfja0pS 9IrCUWnplUykfCeHw0iWL6hTJ9g0ddQ= X-Google-Smtp-Source: AGHT+IENfl0vPxSOBwSiP22/fJDpcvEQwZdnvrmB6XDTlDY5Ki1D7l+Ck0vwGlwJqIUyGupaic2N6A== X-Received: by 2002:ac8:58ce:0:b0:41c:d846:4eb with SMTP id u14-20020ac858ce000000b0041cd84604ebmr39608710qta.49.1699300676345; Mon, 06 Nov 2023 11:57:56 -0800 (PST) Received: from hurd (dsl-10-130-87.b2b2c.ca. [72.10.130.87]) by smtp.gmail.com with ESMTPSA id e15-20020ac8670f000000b0041519614354sm3673605qtp.7.2023.11.06.11.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:57:55 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Timothy Sample <samplet@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <87h6lylnvi.fsf@HIDDEN> (Maxim Cournoyer's message of "Mon, 06 Nov 2023 13:48:01 -0500") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> <87cywmzqbj.fsf@HIDDEN> <87h6lylnvi.fsf@HIDDEN> Date: Mon, 06 Nov 2023 14:57:54 -0500 Message-ID: <87cywmlkn1.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: 66046 <at> debbugs.gnu.org, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, [...] > That's what Guile does (it attempts to locate the directory of the > including source file), but helas, it happens after the file port > corresponding to the including file has been relativized, which appears > ot strip the prefix of its file name that is in the load path. > > e.g.: ../module/srfi/srfi-151.scm --> srfi/srfi-151.scm To illustrate this is indeed the problem, this diff allow include to find the source file: --8<---------------cut here---------------start------------->8--- modified module/system/base/compile.scm @@ -172,7 +172,7 @@ (optimization-level (default-optimization-level)) (warning-level (default-warning-level)) (opts '()) - (canonicalization 'relative)) + (canonicalization 'none)) (validate-options opts) (with-fluids ((%file-port-name-canonicalization canonicalization)) (let* ((comp (or output-file (compiled-file-name file) @@ -200,7 +200,7 @@ (optimization-level (default-optimization-level)) (warning-level (default-warning-level)) (opts '()) - (canonicalization 'relative)) + (canonicalization 'none)) (validate-options opts) (with-fluids ((%file-port-name-canonicalization canonicalization)) (read-and-compile (open-input-file file) --8<---------------cut here---------------end--------------->8--- This appears to be a 13 year old regression introduced with commit 0157a341577223a981d912c93b568792e9dc67e3 ("add %file-port-name-canonicalization option"): --8<---------------cut here---------------start------------->8--- Date: Mon Apr 19 13:14:43 2010 +0200 add %file-port-name-canonicalization option * libguile/fports.c (%file-port-name-canonicalization): New global var. (fport_canonicalize_filename): New helper. If %file-port-name-canonicalization is 'absolute, then run file port names through canonicalize_path; if it's 'relative, then canonicalize the name, but strip off load paths; otherwise leave the port name alone. (scm_open_file): Use fport_canonicalize_filename. (scm_init_fports): Define %file-port-name-canonicalization. --8<---------------cut here---------------end--------------->8--- I'm now curious to know what was the rationale behind this change; I gather it may have only been to avoid registering bogus source paths in the generated .go file, as hinted by the NEWS file. If that's confirmed, then the solution could be to find another way to accomplish the same without touching a file port's associated file name metadata. -- Thanks, Maxim
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 6 Nov 2023 18:48:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 06 13:48:50 2023 Received: from localhost ([127.0.0.1]:40705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r04eY-0007w0-2P for submit <at> debbugs.gnu.org; Mon, 06 Nov 2023 13:48:50 -0500 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]:52234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1r04eV-0007v7-1w for 66046 <at> debbugs.gnu.org; Mon, 06 Nov 2023 13:48:48 -0500 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b566ee5f1dso3115499b6e.0 for <66046 <at> debbugs.gnu.org>; Mon, 06 Nov 2023 10:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699296483; x=1699901283; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6f/rlFK45lRZLZe4N8SrCI+x2aCgVaaFdJ14Ima4+/M=; b=Q44UQNnXyzx8HJFxoci+trxGmVfuJsAUNyQ8rea0izRX73sIyFO3RZ7SQAJTUbK8IH +a4IcD6BydW0pw2gMg0aDbe1CXswTGFScRXk8fvS8TiP9DdIUXj1HeW368nCaGz1mWfR uy/6Ah7U2QJ6xUawsyTgHrKBMvTSI+EyXeWCdqX/W+DiqKhdAFo3yY8FAb0DaDyjaUle JO7NfGepg7+row35aSkRR1NM7L2+YzQQPDnma06KgLEALIFIu15LAOvI1b0Mq7M4atYb o/Qbblg3Nrtb+3tVO/XFQV+TklAVrJm2yTqmDdvWqPEyq8C8GQuxIBBY1Mg+28jMCdwq ZCHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699296483; x=1699901283; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6f/rlFK45lRZLZe4N8SrCI+x2aCgVaaFdJ14Ima4+/M=; b=OrPYXNQaEkyTARqAsnBEume1DNeXKpM7RYjLwArvCF1kDEgBWtM1+xntIaUU10rMRP dKKXTiNlNRCAruVAVXbHPPRYMmQLgXoabCOr2IVJ87bjJg8DGJeNYarp8E0MXjdyWsBq Q9F3HfvCuAZkd6bXZlEzTvJ7sxsT+UwiiCPg7GHFL4DKIuSuoHrubeg1X7D5RHv/dy92 amww/nIuSfkdaKzaZzp/CdxSE1iWHXnlDBGlDLer4cpdHxRPVtAYnx0O4sQcdD4S/PAT +XNrWjW2L/69yDvaUJWx3HWn61FHD6bCv9/yCj+ZaNEPGq9KGWtw7hYkYcf2TYI0KNJK 8zwg== X-Gm-Message-State: AOJu0YxXYCboqPWcP19wn/OGGCbBkeCtSQITlwniKYQSQcZgejywR3AG x2MIIGSoBVhjT0tSixESs+t6m6lkjFQ= X-Google-Smtp-Source: AGHT+IE+esU2w5figwNhSXG600od30y9LQSkfIxPV2UE2cJhcj+OIqRbc/Z+zw9mxgkiSzuA2qBevQ== X-Received: by 2002:a05:6808:4191:b0:3ad:fcd5:3dd6 with SMTP id dj17-20020a056808419100b003adfcd53dd6mr32327037oib.13.1699296483342; Mon, 06 Nov 2023 10:48:03 -0800 (PST) Received: from hurd (dsl-10-130-87.b2b2c.ca. [72.10.130.87]) by smtp.gmail.com with ESMTPSA id l15-20020ad44bcf000000b0065afbb39b2dsm3660559qvw.47.2023.11.06.10.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:48:02 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Timothy Sample <samplet@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <87cywmzqbj.fsf@HIDDEN> (Timothy Sample's message of "Mon, 06 Nov 2023 12:31:28 -0600") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> <87cywmzqbj.fsf@HIDDEN> Date: Mon, 06 Nov 2023 13:48:01 -0500 Message-ID: <87h6lylnvi.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66046 Cc: 66046 <at> debbugs.gnu.org, Daphne Preston-Kendal <dpk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, I also encountered that problem while working on adding new SRFIs to Guile. Timothy Sample <samplet@HIDDEN> writes: > Hi Daphne, > > Daphne Preston-Kendal <dpk@HIDDEN> writes: > >> A standard layout for R7RS libraries is to have an .sld file >> containing the library import and export declarations with a parallel >> .scm file with the same name in the same directory, which the .sld >> file (include ...)s. >> >> [...] >> >> Guile supports looking for .sld files before .scm files if started in >> --r7rs mode. However, in this case, it will not find the .scm file if >> it=E2=80=99s included from the .sld file. > > This is currently causing me problems, too, so I will look into writing > and submitting a patch. > > We are technically following R7RS, which says the lookup strategy is > =E2=80=9Cimplementation-specific=E2=80=9D. However, it goes on to say: = =E2=80=9Cimplementations > are encouraged to search for files in the directory which contains the > including file [...].=E2=80=9D This is perfectly reasonable, and like yo= u say, > part of an established pattern for portable code. That's what Guile does (it attempts to locate the directory of the including source file), but helas, it happens after the file port corresponding to the including file has been relativized, which appears ot strip the prefix of its file name that is in the load path. e.g.: ../module/srfi/srfi-151.scm --> srfi/srfi-151.scm This NEWS entry describes the '%file-port-name-canonicalization' which is used in 'compile-file' and friends: --8<---------------cut here---------------start------------->8--- ** New fluid: `%file-port-name-canonicalization' =20=20=20=20 This fluid parameterizes the file names that are associated with file ports. If %file-port-name-canonicalization is 'absolute, then file names are canonicalized to be absolute paths. If it is 'relative, then the name is canonicalized, but any prefix corresponding to a member of `%load-path' is stripped off. Otherwise the names are passed through unchanged. In addition, the `compile-file' and `compile-and-load' procedures bind %file-port-name-canonicalization to their `#:canonicalization' keyword argument, which defaults to 'relative. In this way, one might compile "../module/ice-9/boot-9.scm", but the path that gets residualized into the .go is "ice-9/boot-9.scm". --8<---------------cut here---------------end--------------->8--- Perhaps there's a better way to avoid baking a bad reference in the .go file without changing fundamental truths about file names, as this is what breaks 'include'. I tried setting the original file name to a parameter in compile-file and compile-file-load, but given 'include' is a syntax, this cannot work. I'll try studying if an alternative to stripping can be used to avoid baking bad file names in .go files. --=20 Thanks, Maxim
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at 66046) by debbugs.gnu.org; 6 Nov 2023 18:32:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 06 13:32:17 2023 Received: from localhost ([127.0.0.1]:40701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r04OX-0007Vb-8z for submit <at> debbugs.gnu.org; Mon, 06 Nov 2023 13:32:17 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38293) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <samplet@HIDDEN>) id 1r04OU-0007VL-I3 for 66046 <at> debbugs.gnu.org; Mon, 06 Nov 2023 13:32:15 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 461DC5C00E9; Mon, 6 Nov 2023 13:31:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 06 Nov 2023 13:31:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ngyro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1699295491; x=1699381891; bh=+2gndDz7jKuD0e7fRwUqu1ddoQFxHB+0rMF Rt45VLZI=; b=g12eGztLpUElW505YGDf/0IEzMDgrsN09yDhoCY/2QN8RcKGFLB wooRCp/p/VOvdZ4x1n4IlXVU/ofBa6z1jRUnYdvpMnVO20fudgaNxakm98GI8kSi dOpO5i+Uro9rSv9mgLw0wsEmfD8RmsOcWu3oTDi8rf5lSBm2XZharRttulAdQ1vw vlzBvKIv9bknNGoGE31pxbvlCo3EjRbR81pzGLAJrjQWiUhv/k80cc/8CUFNW/Ag pk+bITYWh/IuQ3CJP2HY3OUca4GYxqd3m8d4JscqKEwKLpOV0FdxVIYwl00Z3M60 6O9QnhCT8qSPZJ3UzWBw72o99IyRuse6BNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1699295491; x=1699381891; bh=+2gndDz7jKuD0e7fRwUqu1ddoQFxHB+0rMF Rt45VLZI=; b=RWHMQuO+woMoLAwHDLoA4HEx7yNt1NE4ZVlLdKBAYQQmWTiyPor FU8mxQQDjjVBF/OeLjSG4l/WMBa97x/j60JkCoXpY2OwWwS2rkSi1dphteqHOcBD DgFukU311xuUh3bzY2VyF4ljvDRKQF19fbylRzYCQpNzlcGVAzg8fDyPo92xQqGp uvT3cP5QzvTHMMV0J2VNspgwXyuXYohCDZEcYNSj+a85H9WbfrVS5JUaJ0DY4qJZ OQLDMNgAFuyND2DFGMEiipCZgT66AUliiHlOaJiu0+8y8lc8KQwZpJT9JEuH/71p intyxu14rNTONkT6WTg5euxLeXIFLv0XTbQ== X-ME-Sender: <xms:AjFJZVFE2cKto1C0lppFOiwr2ayOU0ttYxbJS_ATCvsS00NcJWgn-A> <xme:AjFJZaX4hKrFX-5zM8td_r19QYi83THoOTC6mjyjBgYXBR07R2RPZHxbuui6xd9hT iy4JjxBBcUky3GAeA> X-ME-Received: <xmr:AjFJZXJ0flfeYYjDcatWbYzIODYmGzgA0UUunztu-U0RfUTNxhxxTt2ami2ufgCdaG3JYS1HBRvg-xgeVNoe2zE> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddugedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefujghffffkfgggtgfgse htqhertddtreejnecuhfhrohhmpefvihhmohhthhihucfurghmphhlvgcuoehsrghmphhl vghtsehnghihrhhordgtohhmqeenucggtffrrghtthgvrhhnpeetfeffffettdelveekgf effeevudehhedtffdvfffhudethfefvdduudejlefhvdenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmphhlvghtsehnghihrhhordgtoh hm X-ME-Proxy: <xmx:AjFJZbFscVcvzBWOFaCN31gPhqqkqLQmFxBNlMs8MU6cmOcHLUPmuw> <xmx:AjFJZbURYhC4of5bFo7e5V3AyB857P5gXlb_6euH7dVi_L1r3PGu6w> <xmx:AjFJZWPEbN8l3I4_0Rs78H8VxZnFX_2AJEIhwVH0A7rpjky5hiWQbQ> <xmx:AzFJZcftZpx6yWB1mtihyTKW4x9Sfr6WbWBESvhaCNWSxjrSrDNnxQ> Feedback-ID: i4721425c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Nov 2023 13:31:30 -0500 (EST) From: Timothy Sample <samplet@HIDDEN> To: Daphne Preston-Kendal <dpk@HIDDEN> Subject: Re: bug#66046: Relative includes in R7RS define-library seem broken In-Reply-To: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> (Daphne Preston-Kendal's message of "Sun, 17 Sep 2023 10:22:20 +0200") References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> Date: Mon, 06 Nov 2023 12:31:28 -0600 Message-ID: <87cywmzqbj.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66046 Cc: 66046 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Hi Daphne, Daphne Preston-Kendal <dpk@HIDDEN> writes: > A standard layout for R7RS libraries is to have an .sld file > containing the library import and export declarations with a parallel > .scm file with the same name in the same directory, which the .sld > file (include ...)s. > > [...] > > Guile supports looking for .sld files before .scm files if started in > --r7rs mode. However, in this case, it will not find the .scm file if > it=E2=80=99s included from the .sld file. This is currently causing me problems, too, so I will look into writing and submitting a patch. We are technically following R7RS, which says the lookup strategy is =E2=80=9Cimplementation-specific=E2=80=9D. However, it goes on to say: =E2= =80=9Cimplementations are encouraged to search for files in the directory which contains the including file [...].=E2=80=9D This is perfectly reasonable, and like you = say, part of an established pattern for portable code. > Changing the path in the include declaration to be absolute fixes the > problem, but then it no longer works on other people=E2=80=99s machines. FWIW, I=E2=80=99ve settled on this (annoying) pattern for now: (cond-expand (guile (import (only (guile) include-from-path)) (begin (include-from-path "relative/from/load/path/foo.scm"))) (else (include "foo.scm"))) I wouldn=E2=80=99t bother with it if I weren=E2=80=99t committed to Guile, = though! -- Tim
bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 Sep 2023 08:22:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 04:22:59 2023 Received: from localhost ([127.0.0.1]:49013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhn3S-0000gb-Tn for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 04:22:59 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <dpk@HIDDEN>) id 1qhn3P-0000gL-CH for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 04:22:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <dpk@HIDDEN>) id 1qhn3B-0006Iv-B7 for bug-guile@HIDDEN; Sun, 17 Sep 2023 04:22:41 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <dpk@HIDDEN>) id 1qhn39-00088W-BA for bug-guile@HIDDEN; Sun, 17 Sep 2023 04:22:41 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id C944E3200935 for <bug-guile@HIDDEN>; Sun, 17 Sep 2023 04:22:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 17 Sep 2023 04:22:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nonceword.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :sender:subject:subject:to:to; s=fm2; t=1694938953; x= 1695025353; bh=Xp/MOoyoW8xOh3Va4uXTTi2c3gx/7P/WNyJctxmXOSo=; b=Y UuPyCpVJ+xnKbXqdUuNPodGEQSEbMf89S9kkAjfnmEpdOYYHLF2hJqjZWdGIY2DJ cBygEaCK3mfGN61YGEFDAyPttsJlXXjQ+k+hP8szhXxK003Jf2f9HX32YnVlRfPq ZwwbPFKAmgCBG+IS84Mx/U298KTbKBYCgDhGB29wGM+ihqyjJ/aMCxYRXkPziexj FH2qwW4jyUBqVqkuySsg5Dod35uYvzU5BnCzPkfR/nYZ57DdiUajEpKm4Ndt5OIw Kz8wv8tSeS7Soa0a8ioMF3Z4PIfUnvNqjabPGzk+o9KdjcipDl3bSg27L4Rs/hbO BZ+wjA4JNo/V9X6ftav6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1694938953; x=1695025353; bh=Xp/MOoyoW8xOh 3Va4uXTTi2c3gx/7P/WNyJctxmXOSo=; b=ld0Zm7b/3dFC9h1MFi7ipFioDA/KI pTs8u5eTVWmEVxdU+XMVO/5Kt/j6K+YlFH4bPsNS7vV+WLQCL4gmoYa4UM6ce5B4 KQwzfKf683en1emtpww7PYSc+ngEK7O254/Jb024LuYO+YaTzr7pwrkyEcSmpW5l ER/QagI91fVzNe5nh7HKNStmYLSjuTwKwzJKsTixfnd66YE7GlxxJrUPiG2HaQHL WKZDMOmC4Q35GB/Mt52YOMhMH9S2HUTktjYWwuSQ0kl1nhBt777I2ZgHsDHggUmZ 7eeTzbAaZO2buKFV08lCZK1LlEWtKuWCHOHp4DzPr5fQTUqs6dzEPtQ6w== X-ME-Sender: <xms:SbcGZfXX7Uo2qciSOaFSGdjF6b3B9XqL45i6iRxE5_WzgiwkfABuxw> <xme:SbcGZXktHWvys8a83G1Tu2QaEmduc7xs9mr90etvBHtZA_vlob7tWge4BOxYO3X_b G4D_OA2gbYmrYoXUQ> X-ME-Received: <xmr:SbcGZbZqM6NBDKuwvvCQn7PyIs4zUDvNL-3mj_i-78PK7j7o3wnUKkA0hs7UoM8YeiODEw1t6EvqQ9nJ1aKvNnT-AWWeGBm1VpGWFe435C4GYmtEx5adEKWsgXzm> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejiedgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhtgfgggfukfffvffosehtqhhmtd hhtdejnecuhfhrohhmpeffrghphhhnvgcurfhrvghsthhonhdqmfgvnhgurghluceoughp khesnhhonhgtvgifohhrugdrohhrgheqnecuggftrfgrthhtvghrnhepieeuffeiuedvfe dtgfdvveefudelgeeiueejudetvdehheduteevjeffleefudffnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughpkhesnhhonhgtvgifohhrug drohhrgh X-ME-Proxy: <xmx:SbcGZaVfbyc5X7nHRLfYJtnJwuPqkekT0hslp9L6ZI5845jTrpkBOQ> <xmx:SbcGZZm7uVisY7vjLJtuL__ExnIQke-7OdJACAjyyESrXF0xCwVRzw> <xmx:SbcGZXfyksWmLOANnPBGx9LOPcheqdHoZjnT21ONUEvachXj-PFCIQ> <xmx:SbcGZXQ2QhcW0sezeLY2OApVLLYYdfnwViq8KcJUn17OmcXhRXAQlg> Feedback-ID: ibc314252:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for <bug-guile@HIDDEN>; Sun, 17 Sep 2023 04:22:32 -0400 (EDT) From: Daphne Preston-Kendal <dpk@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Relative includes in R7RS define-library seem broken Message-Id: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@HIDDEN> Date: Sun, 17 Sep 2023 10:22:20 +0200 To: bug-guile@HIDDEN X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=64.147.123.21; envelope-from=dpk@HIDDEN; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.3 (/) A standard layout for R7RS libraries is to have an .sld file containing the library import and export declarations with a parallel .scm file with the same name in the same directory, which the .sld file (include ...)s. E.g. lib/dpk/mylibrary.sld: (define-library (dpk mylibrary) (import (scheme base)) (export make-frob #;etc) (include "mylibrary.scm")) and then mylibrary.scm is also in the same lib/dpk directory as mylibrary.scm and includes the actual code. Guile supports looking for .sld files before .scm files if started in --r7rs mode. However, in this case, it will not find the .scm file if it=E2=80=99s included from the .sld file. Starting Guile with: guile --r7rs -L './lib' or by setting the GUILE_LOAD_PATH environment variable, (in both cases with absolute paths or relative ones) and attempting to import libraries such as this results in a file not found error for the included .scm file, e.g.: scheme@(guile-user)> (import (chibi shell)) ;;; note: source file /Users/dpk/Projects/r7rs/lib/chibi/shell.sld ;;; newer than compiled = /Users/dpk/.cache/guile/ccache/3.0-LE-8-4.6/Users/dpk/Projects/r7rs/lib/ch= ibi/shell.sld.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /Users/dpk/Projects/r7rs/lib/chibi/shell.sld ;;; WARNING: compilation of /Users/dpk/Projects/r7rs/lib/chibi/shell.sld = failed: ;;; In procedure open-file: No such file or directory: "chibi/shell.scm" scheme@(guile-user)>=20 Curiously, including a file which *actually* doesn=E2=80=99t exist = results in two different, one of which correctly reports the full path of the file it=E2=80=99s purportedly trying to include: scheme@(guile-user)> (import (chibi shell)) ;;; note: source file /Users/dpk/Projects/r7rs/lib/chibi/shell.sld ;;; newer than compiled = /Users/dpk/.cache/guile/ccache/3.0-LE-8-4.6/Users/dpk/Projects/r7rs/lib/ch= ibi/shell.sld.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /Users/dpk/Projects/r7rs/lib/chibi/shell.sld ;;; WARNING: compilation of /Users/dpk/Projects/r7rs/lib/chibi/shell.sld = failed: ;;; In procedure open-file: No such file or directory: = "chibi/wonderpants.scm" While compiling expression: In procedure open-file: No such file or directory: = "/Users/dpk/Projects/r7rs/lib/chibi/wonderpants.scm" scheme@(guile-user)>=20 So this smells like a bug where the part of the R7RS library code looks in the wrong place and fails, but after it=E2=80=99s already = failed, a second part of the code looks again in the correct location and reports another error if the file really didn=E2=80=99t exist. This is a strange hypothesis but it=E2=80=99s the only thing I can think of. Changing the path in the include declaration to be absolute fixes the problem, but then it no longer works on other people=E2=80=99s machines. Guile version: 3.0.9 installed from nix-unstable
Daphne Preston-Kendal <dpk@HIDDEN>
:bug-guile@HIDDEN
.
Full text available.bug-guile@HIDDEN
:bug#66046
; Package guile
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.