unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: 39162@debbugs.gnu.org
Subject: bug#39162: [PATCH] Fix file lookup of modules with a dot in their name.
Date: Sat, 21 Mar 2020 22:46:20 +0100	[thread overview]
Message-ID: <878sjtxtxv.fsf@gnu.org> (raw)
In-Reply-To: <875zhartv8.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 17 Jan 2020 16:21:47 +0100")

Hi!

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> Much to my surprise, Guile (v2.2 and 3.0 alike) fail to load a module
> that has a dot in its base name.  Directory names with dots
> (e.g. ice.10/boot-10.scm => (ice.10 boot-10)) are fine.

[...]

> -  /* If FILENAME has an extension, don't try to add EXTENSIONS to it.  */
> -  {
> -    char *endp;
> -
> -    for (endp = filename_chars + filename_len - 1;
> -	 endp >= filename_chars;
> -	 endp--)
> -      {
> -	if (*endp == '.')
> -	  {
> -            if (!string_has_an_ext (filename, extensions))
> -              {
> -                /* This filename has an extension, but not one of the right
> -                   ones... */
> -                goto end;
> -              }
> -	    /* This filename already has an extension, so cancel the
> -               list of extensions.  */
> -	    extensions = SCM_EOL;
> -	    break;
> -	  }
> -	else if (is_file_name_separator (SCM_MAKE_CHAR (*endp)))
> -	  /* This filename has no extension, so keep the current list
> -             of extensions.  */
> -	  break;
> -      }
> -  }

This code mostly dates back to 1999 (commit
563841768b8659dad87296be4ae9ce589cbe99d4).  It has to do with the fact
that you can omit the extension when loading a file, in which case one
of those in ‘%load-extensions’ is picked up:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (primitive-load-path "ice-9/q")
scheme@(ice-9 q)>
--8<---------------cut here---------------end--------------->8---

The usefulness of this mechanism is debatable :-), but I don’t think we
can change it during a stable release.

I wonder if there are other ways we could support file names with dots.

However, note that symbols containing dots are non-standard (R5RS does
not allow it.)

Thoughts?

Ludo’.





      reply	other threads:[~2020-03-21 21:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 15:21 bug#39162: [PATCH] Fix file lookup of modules with a dot in their name Jan Nieuwenhuizen
2020-03-21 21:46 ` Ludovic Courtès [this message]

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=878sjtxtxv.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=39162@debbugs.gnu.org \
    --cc=janneke@gnu.org \
    /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).