Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Namespace conflict with tcllib ftp package

4 views
Skip to first unread message

BlueFox

unread,
Nov 9, 2009, 8:09:34 PM11/9/09
to
I have this version of tcllib installed
/usr/local/ActiveTcl/lib/tcllib1.7/ftp

and am using Tcl 8.4.11

I have defined a variable in the global namespace, ::DEBUG, to turn on/
off debug messages. This worked fine until installing the ftp
package. In the ftp package we have this code,

package require Tcl 8.2
package require log ; # tcllib/log, general logging facility.

namespace eval ::ftp {
namespace export DisplayMsg Open Close Cd Pwd Type List NList \
FileSize ModTime Delete Rename Put Append Get Reget \
Newer Quote MkDir RmDir

set serial 0
set VERBOSE 0
set DEBUG 0
}

The DEBUG in the ftp package is turning my DEBUG off.

I thought my ::DEBUG is in a differant namespace than ftp::DEBUG, but
apparently they are. in the same namespace.

How are these namespaces the same, and is there a workaround with ftp
other than removing DEBUG?

miguel sofer

unread,
Nov 9, 2009, 9:18:59 PM11/9/09
to
This is a bug in tcllib's ftp package; please report it in the bug tracker.

In the meantime, replace 'set' with 'variable' in those three lines.

The reason why you see the failure is [expletive deleted]. See RFE
959147
https://sourceforge.net/tracker/?func=detail&aid=959147&group_id=10894&atid=360894

Andreas Kupries

unread,
Nov 9, 2009, 10:18:33 PM11/9/09
to
BlueFox <bbea...@desanasystems.com> writes:

> I have this version of tcllib installed
> /usr/local/ActiveTcl/lib/tcllib1.7/ftp
>
> and am using Tcl 8.4.11
>
> I have defined a variable in the global namespace, ::DEBUG, to turn on/
> off debug messages. This worked fine until installing the ftp
> package. In the ftp package we have this code,
>
> package require Tcl 8.2
> package require log ; # tcllib/log, general logging facility.
>
> namespace eval ::ftp {
> namespace export DisplayMsg Open Close Cd Pwd Type List NList \
> FileSize ModTime Delete Rename Put Append Get Reget \
> Newer Quote MkDir RmDir
>
> set serial 0
> set VERBOSE 0
> set DEBUG 0
> }

You are running into what we call a 'creative writing' bug.
ftp version 2.4.9 in Tcllib 1.11 does not have that bug.


> The DEBUG in the ftp package is turning my DEBUG off.
>
> I thought my ::DEBUG is in a differant namespace than ftp::DEBUG, but
> apparently they are. in the same namespace.

Yes, in the global one. The 'set VERBOSE 0' command looks in the local
namespace for the variable declaration, finds none, then looks in the
global namespace, finds your variable, and thus writes there. Hence
the term 'creative writing bug'.

> How are these namespaces the same,

See above.

> and is there a workaround with ftp
> other than removing DEBUG?

If you cannot update to a newer version of ftp with the bug fixed you
can run
namespace eval ::ftp {
variable DEBUG
variable VERBOSE
variable serial
}

before the 'package require ftp' and the problem should be gone. You
are basically declaring the variables in the ftp namespace and then
the 'set' commands in the ftp package find them in the correct places

--
So long,
Andreas Kupries <akup...@shaw.ca>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
-------------------------------------------------------------------------------

Gerald W. Lester

unread,
Nov 10, 2009, 11:11:22 AM11/10/09
to

Report this as a bug.

Immediate work around, change:
set DEBUG 0
to:
variable DEBUG 0
or:
set ::ftp::DEBUG 0

Alternatively, you can package require the FTP *before* you assign a value
to ::DEBUG.

The issue is that when inside of the namespace eval at "global level" set
will look for the variable in the namespace, if it does not find it there it
will look in the global namespace, if it is not found in either then it
creates it in the namespace being evalled (see the Name Resolution section
of the namespace man/help page for full details).

IMHO, it is always best to put all of your package requires at the very
beginning of your program before doing anything else.


--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+

Don Porter

unread,
Nov 10, 2009, 11:23:07 AM11/10/09
to

BlueFox wrote:
>> I have this version of tcllib installed
>> /usr/local/ActiveTcl/lib/tcllib1.7/ftp
>>
>> and am using Tcl 8.4.11
...

>> The DEBUG in the ftp package is turning my DEBUG off.

Gerald W. Lester wrote:
> Report this as a bug.

Bug 2038279 was already reported and fixed. Update to
the package ftp 2.4.9 (part of tcllib 1.11) to get a
corrected package. These releases are over a year old.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Gerald W. Lester

unread,
Nov 10, 2009, 11:51:35 AM11/10/09
to
Don Porter wrote:
>
> BlueFox wrote:
>>> I have this version of tcllib installed
>>> /usr/local/ActiveTcl/lib/tcllib1.7/ftp
>>>
>>> and am using Tcl 8.4.11
> ...
>>> The DEBUG in the ftp package is turning my DEBUG off.
>
> Gerald W. Lester wrote:
>> Report this as a bug.
>
> Bug 2038279 was already reported and fixed. Update to
> the package ftp 2.4.9 (part of tcllib 1.11) to get a
> corrected package. These releases are over a year old.

Don,


Thanks for checking!!!

It sure sounded familiar. I posted the ways he could get going ASAP. I was
going to look at the head after work to make the fix (if needed).

BlueFox

unread,
Nov 10, 2009, 3:56:26 PM11/10/09
to
On Nov 10, 8:23 am, Don Porter <d...@nist.gov> wrote:
> BlueFox wrote:
> >> I have this version of tcllib installed
> >> /usr/local/ActiveTcl/lib/tcllib1.7/ftp
>
> >> and am using Tcl 8.4.11
> ...
> >> The DEBUG in the ftp package is turning my DEBUG off.
> Gerald W. Lester wrote:
> > Report this as a bug.
>
> Bug 2038279 was already reported and fixed.  Update to
> the package ftp 2.4.9 (part of tcllib 1.11) to get a
> corrected package.  These releases are over a year old.
>
> --
> | Don Porter          Mathematical and Computational Sciences Division |
> | donald.por...@nist.gov             Information Technology Laboratory |
> |http://math.nist.gov/~DPorter/                                 NIST |
> |______________________________________________________________________|

Thanks. Glad to see it is not my bug, or that I was going crazy. :)

0 new messages