* [PATCH] Fix for `make-autoload-interface'
@ 2006-02-27 9:48 Ludovic Courtès
2006-03-03 23:32 ` Kevin Ryde
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2006-02-27 9:48 UTC (permalink / raw)
Hi,
Below is a patch that fixes a bug encountered in the following case,
along with a new test case. Here is the problem:
$ guile
guile> (define-module (chbouib)
:autoload (srfi srfi-39) (make-parameter)
:use-module (srfi srfi-39))
ERROR: In procedure set-car!:
ERROR: Wrong type argument in position 1 (expecting pair): #f
ABORT: (wrong-type-arg)
The `set-car!' here is the one used in the binder procedure produced by
`make-autoload-interface'. This problem occurs because when resolving
duplicated between the autoload interface and the used interface (which
both export `make-parameter'), `make-parameter' is accessed from the
autoload interface more than once: the first time, `set-car!' works fine
(removing the autoload interface from the module's "uses"), but it fails
the second time.
The fix below is simple but I think it's the right way to solve this.
Thanks,
Ludovic.
2006-02-27 Ludovic Courtès <ludovic.courtes@laas.fr>
* ice-9/boot-9.scm (make-autoload-interface): Don't call
`set-car!' if the autoload interface has already been removed
from MODULE's uses. This bug showed up when using a given
module both with `autoload' and `use-module'.
* test-suite/tests/module-autoload.test: New.
* test-suite/Makefile.am (SCM_TESTS): Added `module-autoload.test'.
--- orig/ice-9/boot-9.scm
+++ mod/ice-9/boot-9.scm
@@ -2136,8 +2136,11 @@
(let ((i (module-public-interface (resolve-module name))))
(if (not i)
(error "missing interface for module" name))
- ;; Replace autoload-interface with interface
- (set-car! (memq a (module-uses module)) i)
+ (let ((autoload (memq a (module-uses module))))
+ ;; Replace autoload-interface with actual interface if
+ ;; that has not happened yet.
+ (if (pair? autoload)
+ (set-car! autoload i)))
(module-local-variable i sym))))))
(module-constructor (make-hash-table 0) '() b #f #f name 'autoload #f #f
'() (make-weak-value-hash-table 31) 0)))
--- orig/test-suite/Makefile.am
+++ mod/test-suite/Makefile.am
@@ -46,6 +46,7 @@
tests/interp.test \
tests/list.test \
tests/load.test \
+ tests/module-autoload.test \
tests/multilingual.nottest \
tests/numbers.test \
tests/optargs.test \
test-suite/tests/module-autoload.test
;;;; module-autoload.test --- test guile's module autoloading -*- scheme -*-
;;;; Copyright (C) 2006 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 2.1 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(use-modules (test-suite lib))
(with-test-prefix "autoload"
(pass-if "autoloaded"
(catch #t
(lambda ()
;; Simple autoloading.
(eval '(begin
(define-module (test-autoload-one)
:autoload (srfi srfi-19) (time-utc))
(not (not time-utc)))
(current-module)))
(lambda (key . args)
#f)))
(pass-if "autoloaded+used"
(catch #t
(lambda ()
;; This special case used to fail because the binder used in
;; `make-autoload-interface' would try to remove the autoload
;; interface from the module's "uses" without making sure it is
;; still part of these "uses".
(eval '(begin
(define-module (test-autoload-one)
:autoload (srfi srfi-19) (time-utc)
:use-module (srfi srfi-19))
(not (not time-utc)))
(current-module)))
(lambda (key . args)
#f))))
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix for `make-autoload-interface'
2006-02-27 9:48 [PATCH] Fix for `make-autoload-interface' Ludovic Courtès
@ 2006-03-03 23:32 ` Kevin Ryde
2006-03-07 9:27 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2006-03-03 23:32 UTC (permalink / raw)
ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> The fix below is simple but I think it's the right way to solve this.
Sound fair. Thanks, I checked it in. I took the liberty of changing
the test file to modules.test, and I made it use the "ice-9 q" module,
to avoid the warning from srfi-19 replacing `current-time'.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix for `make-autoload-interface'
2006-03-03 23:32 ` Kevin Ryde
@ 2006-03-07 9:27 ` Ludovic Courtès
2006-03-08 0:41 ` Kevin Ryde
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2006-03-07 9:27 UTC (permalink / raw)
Hi,
Kevin Ryde <user42@zip.com.au> writes:
> Sound fair. Thanks, I checked it in. I took the liberty of changing
> the test file to modules.test, and I made it use the "ice-9 q" module,
> to avoid the warning from srfi-19 replacing `current-time'.
Not sure I understand what you mean. Anyway, I'm tracking `HEAD' and it
seems that you committed it to the other branch. Can you please commit
it there?
Looks like you (committers) will have to agree on which branch(es) to
use. ;-)
Thanks in advance,
Ludovic.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix for `make-autoload-interface'
2006-03-07 9:27 ` Ludovic Courtès
@ 2006-03-08 0:41 ` Kevin Ryde
2006-03-08 1:49 ` Rob Browning
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2006-03-08 0:41 UTC (permalink / raw)
ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> Anyway, I'm tracking `HEAD' and it
> seems that you committed it to the other branch.
Yes, bug fixes should go on the branch.
> Can you please commit it there?
I want to do a merge.
Marius: what's the theory on all the copyright years? 2006 is in the
branch but not the head.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix for `make-autoload-interface'
2006-03-08 0:41 ` Kevin Ryde
@ 2006-03-08 1:49 ` Rob Browning
0 siblings, 0 replies; 5+ messages in thread
From: Rob Browning @ 2006-03-08 1:49 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> I want to do a merge.
>
> Marius: what's the theory on all the copyright years? 2006 is in the
> branch but not the head.
On a somewhat related note, I asked maintainers@gnu.org if the
copyright notices have to be a single line, and I was told that they
don't. i.e. this is fine:
;;;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003,
;;;; 2004, 2005 Free Software Foundation, Inc.
--
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-03-08 1:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-27 9:48 [PATCH] Fix for `make-autoload-interface' Ludovic Courtès
2006-03-03 23:32 ` Kevin Ryde
2006-03-07 9:27 ` Ludovic Courtès
2006-03-08 0:41 ` Kevin Ryde
2006-03-08 1:49 ` Rob Browning
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).