From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.bugs Subject: bug#66046: Relative includes in R7RS define-library seem broken Date: Mon, 06 Nov 2023 14:57:54 -0500 Message-ID: <87cywmlkn1.fsf@gmail.com> References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@nonceword.org> <87cywmzqbj.fsf@ngyro.com> <87h6lylnvi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8443"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66046@debbugs.gnu.org, Daphne Preston-Kendal To: Timothy Sample Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Nov 06 21:05:14 2023 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r05qT-0001tq-9V for guile-bugs@m.gmane-mx.org; Mon, 06 Nov 2023 21:05:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r05jv-0001Jx-9O; Mon, 06 Nov 2023 14:58:27 -0500 Original-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 ) id 1r05jt-00017u-NQ for bug-guile@gnu.org; Mon, 06 Nov 2023 14:58:25 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r05jt-0007Hp-Et for bug-guile@gnu.org; Mon, 06 Nov 2023 14:58:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r05kU-0001Lp-7v for bug-guile@gnu.org; Mon, 06 Nov 2023 14:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 06 Nov 2023 19:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66046 X-GNU-PR-Package: guile Original-Received: via spool by 66046-submit@debbugs.gnu.org id=B66046.16993007355178 (code B ref 66046); Mon, 06 Nov 2023 19:59:02 +0000 Original-Received: (at 66046) by debbugs.gnu.org; 6 Nov 2023 19:58:55 +0000 Original-Received: from localhost ([127.0.0.1]:40746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r05kC-0001LE-QG for submit@debbugs.gnu.org; Mon, 06 Nov 2023 14:58:55 -0500 Original-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 ) id 1r05k7-0001Kx-H5 for 66046@debbugs.gnu.org; Mon, 06 Nov 2023 14:58:44 -0500 Original-Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-41cda69486eso32668821cf.3 for <66046@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) Original-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) In-Reply-To: <87h6lylnvi.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 06 Nov 2023 13:48:01 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10689 Archived-At: 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