GNU bug report logs - #17418
#:select gives access to private variables

Previous Next

Package: guile;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Tue, 6 May 2014 08:49:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17418 in the body.
You can then email your comments to 17418 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 06 May 2014 08:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Tue, 06 May 2014 08:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guile <at> gnu.org
Subject: #:select gives access to private variables
Date: Tue, 06 May 2014 10:48:17 +0200
Consider this module:

--8<---------------cut here---------------start------------->8---
(define-module (t))

(define private #t)
--8<---------------cut here---------------end--------------->8---

And now:

--8<---------------cut here---------------start------------->8---
[ludo <at> pluto:~/src/guix]$ guile -L .
GNU Guile 2.0.11.20-4338f
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (t))
;;; note: source file ./t.scm
;;;       newer than compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./t.scm
;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
scheme@(guile-user)> private
;;; <unknown-location>: warning: possibly unbound variable `private'
ERROR: In procedure #<procedure 1e532a0 ()>:
ERROR: In procedure module-lookup: Unbound variable: private

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> 
--8<---------------cut here---------------end--------------->8---

This is as expected.
But adding #:select (private) gives access to ‘private’:

--8<---------------cut here---------------end--------------->8---
[ludo <at> pluto:~/src/guix]$ guile -L .
GNU Guile 2.0.11.20-4338f
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules ((t) #:select (private)))
scheme@(guile-user)> private
$1 = #t
--8<---------------cut here---------------end--------------->8---

Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Mon, 02 Jun 2014 01:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 17418 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 17418 <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Sun, 01 Jun 2014 21:06:49 -0400
ludo <at> gnu.org (Ludovic Courtès) writes:

> Consider this module:
>
> (define-module (t))
>
> (define private #t)
>
> And now:
>
> [ludo <at> pluto:~/src/guix]$ guile -L .
> GNU Guile 2.0.11.20-4338f
> Copyright (C) 1995-2014 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (use-modules (t))
> ;;; note: source file ./t.scm
> ;;;       newer than compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;;       or pass the --no-auto-compile argument to disable.
> ;;; compiling ./t.scm
> ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guix/t.scm.go
> scheme@(guile-user)> private
> ;;; <unknown-location>: warning: possibly unbound variable `private'
> ERROR: In procedure #<procedure 1e532a0 ()>:
> ERROR: In procedure module-lookup: Unbound variable: private
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]> 
>
> This is as expected.
> But adding #:select (private) gives access to ‘private’:
>
> [ludo <at> pluto:~/src/guix]$ guile -L .
> GNU Guile 2.0.11.20-4338f
> Copyright (C) 1995-2014 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (use-modules ((t) #:select (private)))
> scheme@(guile-user)> private
> $1 = #t

I agree that this is arguably a bug, but there exists code that depends
on this behavior.  One example is system/repl/coop-server.scm, which
needs access to some private bindings from system/repl/server.scm and
system/repl/repl.scm.  I confess that I even suggested it, because the
alternatives were unpleasant.

Perhaps we should consider making #:select issue a warning when it
imports private bindings, and also adding a mechanism to import private
bindings without a warning.

What do you think?

    Mark




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Mon, 02 Jun 2014 08:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 17418 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw <at> netris.org>
Cc: 17418 <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Mon, 02 Jun 2014 10:08:28 +0200
Hi, Mark!

Mark H Weaver <mhw <at> netris.org> skribis:

> Perhaps we should consider making #:select issue a warning when it
> imports private bindings,

Yes, sounds like a good idea.

> and also adding a mechanism to import private bindings without a
> warning.

I’m unsure about this.  Normally we don’t want to allow that, because
that defeats the purpose of modules.  OTOH, in practice we occasionally
need this ability; I typically use @@ for that, but it’s not as nice as
a real import.

Any idea what other schemes do?

Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 03 Jun 2014 23:10:01 GMT) Full text and rfc822 format available.

Message #14 received at 17418 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 17418 <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 03 Jun 2014 19:08:54 -0400
ludo <at> gnu.org (Ludovic Courtès) writes:

> Mark H Weaver <mhw <at> netris.org> skribis:
>
>> Perhaps we should consider making #:select issue a warning when it
>> imports private bindings,
>
> Yes, sounds like a good idea.

Sounds good.  Specifically, I guess we should deprecate this way of
using #:select.

If you do this, can you adjust system/repl/coop-server.scm to avoid it?
It imports the following private bindings:

  start-repl* run-server* add-open-socket! close-socket!

>> and also adding a mechanism to import private bindings without a
>> warning.
>
> I’m unsure about this.  Normally we don’t want to allow that, because
> that defeats the purpose of modules.

Fair enough.  Having mulled it over, I tend to agree that we should not
try to make this more convenient.

> OTOH, in practice we occasionally need this ability; I typically use
> @@ for that, but it’s not as nice as a real import.

I think asking people to use @@ is reasonable here.

    Thanks,
      Mark




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 03 Jun 2014 23:13:02 GMT) Full text and rfc822 format available.

Message #17 received at 17418 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 17418 <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 03 Jun 2014 19:11:55 -0400
Mark H Weaver <mhw <at> netris.org> writes:
> Sounds good.  Specifically, I guess we should deprecate this way of
> using #:select.
>
> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
> It imports the following private bindings:
>
>   start-repl* run-server* add-open-socket! close-socket!

Also: prompting-meta-read

     Mark




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Tue, 21 Jun 2016 14:04:02 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Tue, 21 Jun 2016 14:04:02 GMT) Full text and rfc822 format available.

Message #22 received at 17418-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 17418-done <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 21 Jun 2016 16:03:24 +0200
On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw <at> netris.org> writes:

> Mark H Weaver <mhw <at> netris.org> writes:
>> Sounds good.  Specifically, I guess we should deprecate this way of
>> using #:select.
>>
>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>> It imports the following private bindings:
>>
>>   start-repl* run-server* add-open-socket! close-socket!
>
> Also: prompting-meta-read

Fixed in master.

Andy




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 21 Jun 2016 14:53:01 GMT) Full text and rfc822 format available.

Message #25 received at 17418-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo <at> pobox.com>
Cc: Mark H Weaver <mhw <at> netris.org>, 17418-done <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 21 Jun 2016 16:52:25 +0200
Andy Wingo <wingo <at> pobox.com> skribis:

> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw <at> netris.org> writes:
>
>> Mark H Weaver <mhw <at> netris.org> writes:
>>> Sounds good.  Specifically, I guess we should deprecate this way of
>>> using #:select.
>>>
>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>> It imports the following private bindings:
>>>
>>>   start-repl* run-server* add-open-socket! close-socket!
>>
>> Also: prompting-meta-read
>
> Fixed in master.

I would not close the bug if it remains in 2.0.x.  Thoughts?

Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 21 Jun 2016 15:18:02 GMT) Full text and rfc822 format available.

Message #28 received at 17418-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Mark H Weaver <mhw <at> netris.org>, 17418-done <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 21 Jun 2016 17:17:20 +0200
On Tue 21 Jun 2016 16:52, ludo <at> gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo <at> pobox.com> skribis:
>
>> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw <at> netris.org> writes:
>>
>>> Mark H Weaver <mhw <at> netris.org> writes:
>>>> Sounds good.  Specifically, I guess we should deprecate this way of
>>>> using #:select.
>>>>
>>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>>> It imports the following private bindings:
>>>>
>>>>   start-repl* run-server* add-open-socket! close-socket!
>>>
>>> Also: prompting-meta-read
>>
>> Fixed in master.
>
> I would not close the bug if it remains in 2.0.x.  Thoughts?

I think we can't break 2.0 in this regard; it's technically
incompatible.  We could print a better deprecation warning but in this
case I think I did the right thing.  WDYT?

A




Information forwarded to bug-guile <at> gnu.org:
bug#17418; Package guile. (Tue, 21 Jun 2016 16:07:02 GMT) Full text and rfc822 format available.

Message #31 received at 17418-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo <at> pobox.com>
Cc: Mark H Weaver <mhw <at> netris.org>, 17418-done <at> debbugs.gnu.org
Subject: Re: bug#17418: #:select gives access to private variables
Date: Tue, 21 Jun 2016 18:06:12 +0200
Andy Wingo <wingo <at> pobox.com> skribis:

> On Tue 21 Jun 2016 16:52, ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Andy Wingo <wingo <at> pobox.com> skribis:
>>
>>> On Wed 04 Jun 2014 01:11, Mark H Weaver <mhw <at> netris.org> writes:
>>>
>>>> Mark H Weaver <mhw <at> netris.org> writes:
>>>>> Sounds good.  Specifically, I guess we should deprecate this way of
>>>>> using #:select.
>>>>>
>>>>> If you do this, can you adjust system/repl/coop-server.scm to avoid it?
>>>>> It imports the following private bindings:
>>>>>
>>>>>   start-repl* run-server* add-open-socket! close-socket!
>>>>
>>>> Also: prompting-meta-read
>>>
>>> Fixed in master.
>>
>> I would not close the bug if it remains in 2.0.x.  Thoughts?
>
> I think we can't break 2.0 in this regard; it's technically
> incompatible.  We could print a better deprecation warning but in this
> case I think I did the right thing.  WDYT?

Yeah, you’re probably right; it would suddenly lead to unbound
variables, whether or not people realized they were relying on
“unspecified” behavior.

I withdraw my remark!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Jul 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 275 days ago.

Previous Next


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