From: ludo@gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo@pobox.com>
Cc: 19540-done@debbugs.gnu.org, Matt Wette <mwette@alumni.caltech.edu>
Subject: bug#19540: repeated ./././ in compiled modules
Date: Thu, 23 Jun 2016 15:06:27 +0200 [thread overview]
Message-ID: <87k2hgoy0c.fsf@gnu.org> (raw)
In-Reply-To: <871t3oqp2e.fsf@pobox.com> (Andy Wingo's message of "Thu, 23 Jun 2016 10:36:41 +0200")
Andy Wingo <wingo@pobox.com> skribis:
> commit 9a951678713557b548415d32eae6d63d039bf652
> Author: Andy Wingo <wingo@pobox.com>
> Date: Thu Jun 23 10:03:10 2016 +0200
>
> Fix relative file name canonicalization on paths with "."
>
> * libguile/filesys.c (scm_i_relativize_path): Canonicalize the file
> names elements that we will be using as prefixes. Fixes the case
> where a load path contains a relative file name: #19540.
> * test-suite/tests/ports.test ("%file-port-name-canonicalization"): Add
> tests that elements of the load path are canonicalized.
>
> diff --git a/libguile/filesys.c b/libguile/filesys.c
> index 7674498..25501ef 100644
> --- a/libguile/filesys.c
> +++ b/libguile/filesys.c
> @@ -1614,22 +1614,40 @@ SCM_DEFINE (scm_canonicalize_path, "canonicalize-path", 1, 0, 0,
> SCM
> scm_i_relativize_path (SCM path, SCM in_path)
[...]
> for (; scm_is_pair (in_path); in_path = scm_cdr (in_path))
> {
> SCM dir = scm_car (in_path);
> - size_t len = scm_c_string_length (dir);
> + size_t len;
> +
> + /* Try to canonicalize DIR, since we have canonicalized PATH. */
> + {
> + char *str, *canon;
> +
> + str = scm_to_locale_string (dir);
> + canon = canonicalize_file_name (str);
> + free (str);
> +
> + if (canon)
> + dir = scm_from_locale_string (canon);
> + free (canon);
> + }
> +
> + len = scm_c_string_length (dir);
>
> /* When DIR is empty, it means "current working directory". We
> could set DIR to (getcwd) in that case, but then the
‘canonicalize_file_name’ is costly: roughly one syscall per file name
component.
IIUC, ‘canonicalize_file_name’ is now called once for each ‘%load-path’
entry and file name that we canonicalize. Is this correct?
Ludo’.
next prev parent reply other threads:[~2016-06-23 13:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 4:13 bug#19540: minor: module path picking up ./././ Matt Wette
2015-01-10 22:45 ` bug#19540: repeated ./././ in compiled modules Matt Wette
2015-01-19 20:28 ` Ludovic Courtès
2015-01-19 22:19 ` Matt Wette
2015-01-20 21:12 ` Ludovic Courtès
2016-06-23 8:36 ` Andy Wingo
2016-06-23 13:06 ` Ludovic Courtès [this message]
2016-06-23 16:03 ` Andy Wingo
2016-06-24 8:28 ` Ludovic Courtès
2016-06-24 8:49 ` Andy Wingo
2016-06-24 9:41 ` Ludovic Courtès
2015-01-18 16:09 ` bug#19540: also generates problem for debugger tracebacks Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2hgoy0c.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=19540-done@debbugs.gnu.org \
--cc=mwette@alumni.caltech.edu \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).