Re: Package Require getting "wrong version"



Donald G Porter wrote:
Ok, once you get into that state, [package require] is behaving according
to spec. You've asked for any version of http. It knows about version 1.0,
so it will deliver version 1.0 without bothering to go look for any others.

The mystery is how you get into that state, having discovered the availability
of version 1.0 while somehow missing the availability of version 2.5.3.

This isn't really a mystery after all. Tcl 8.5 installs http 2.5.3 as
a Tcl Module. Unlike pkgIndex.tcl packages, the search for Tcl Modules
is not an exhaustive one.

For a long time, some folks have believed that

% package require no-such-package

would coax Tcl into finding all packages on the system, so then a
[package names] would return all installed packages. That's never
been strictly true. That property is not a feature of [package require].
It is only a feature of the pkgIndex.tcl system for installing packages.

But for years and years, the pkgIndex.tcl system has been the only game
in town. With Tcl 8.5, the new Tcl Module players took the field. A
search for a Tcl Module install of a package (like WS::Utils) is *not*
guaranteed to find all Tcl Module installs of all other packages, like
http-2.5.3.tm. If the search then continues to the pkgIndex.tcl packages,
though, you are guaranteed to find all the other pkgIndex.tcl packages,
like http 1.0 in http1.0/http.tcl.

None of these details really matter, so long as your program asks for
the requirements it needs. But if you tell [package require] that any
version of http is acceptable, then your program better really be
prepared to take any version.

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



Relevant Pages

  • Re: Improving startup time
    ... It does not attempt to find all packages. ... in Tcl Module form on the filesystem search path for Tcl Modules. ...
    (comp.lang.tcl)
  • Re: wajig < > apt-get
    ... auto-download Do an update followed by a download of all updated packages ... commands List all the JIG commands and one line descriptions for each ... integrity Check the integrity of installed packages ...
    (Debian-User)
  • Re: Obsessed with a clean system
    ... I used to use these tools, but now just use aptitude. ... curses interface and mark all installed packages as automatically ... > indulge my obsession for having a clean system. ... all automatically installed packages to see what I have requested to be ...
    (Debian-User)
  • Re: portupgrade does not use 5-stable
    ... Because of the way ports/pkgsrc works, the only reliable way to update ... Yes, it takes forever to update one's installed packages, especially on ... "In the social equation, the value of a single life is nil; ...
    (comp.unix.bsd.freebsd.misc)
  • Re: [opensuse] Protected Kernel Replaced by 10.2 Update
    ... more than a little learning. ... Actually what is says is upgrade. ... To me that means something more than updating only installed packages - permitting new and previously uninstalled dependant packages to be included with the upgrade ...
    (SuSE)