From ad64e3e93b3f5f749d3e3949458ef9d19710b2ee Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 17 Jan 2020 16:03:13 +0100 Subject: [PATCH] Fix file lookup of modules with a dot in their name. This fixes lookup of file foo.bar.go, loading (define-module (foo.bar)) ... * libguile/load.c (load_thunk_from_path): Remove code that decides foo.bar is not a valid module file base name. --- libguile/load.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/libguile/load.c b/libguile/load.c index e95c36db1..23409ebd5 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -649,7 +649,6 @@ load_thunk_from_path (SCM filename, SCM source_file_name, struct stringbuf buf; struct stat stat_buf; char *filename_chars; - size_t filename_len; SCM path, extensions; SCM result = SCM_BOOL_F; char initial_buffer[256]; @@ -667,7 +666,6 @@ load_thunk_from_path (SCM filename, SCM source_file_name, scm_dynwind_begin (0); filename_chars = scm_to_locale_string (filename); - filename_len = strlen (filename_chars); scm_dynwind_free (filename_chars); /* If FILENAME is absolute and is still valid, return it unchanged. */ @@ -680,38 +678,7 @@ load_thunk_from_path (SCM filename, SCM source_file_name, goto end; } - /* 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 simplifies the loop below a bit. - */ - if (scm_is_null (extensions)) - extensions = scm_listofnullstr; + extensions = scm_append (scm_list_2 (extensions, scm_listofnullstr)); buf.buf_len = sizeof initial_buffer; buf.buf = initial_buffer; -- 2.24.1