GNU bug report logs - #39162
[PATCH] Fix file lookup of modules with a dot in their name.

Previous Next

Package: guile;

Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>

Date: Fri, 17 Jan 2020 15:29:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Jan Nieuwenhuizen <janneke <at> gnu.org>
Cc: 39162 <at> 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
Hi!

Jan Nieuwenhuizen <janneke <at> 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’.




This bug report was last modified 5 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.