Standalone executable starpack unable to open wrapped file.

37 views
Skip to first unread message

Asif

unread,
May 4, 2004, 10:22:40 PM5/4/04
to
Hi,

I have a simple example that wraps a data file into the standalone
executable starpack and prints out the contents of the data file at
runtime.
Platform: Windows XP.

I am using the latest:

- tclkit-win32-sh.upx.exe
- sdx.kit

from www.equi4.com

Here is my directory hierarchy:

./foo.vfs/lib/app-foo/foo.tcl
./foo.vfs/lib/app-foo/pkgIndex.tcl
./foo.vfs/lib/data.txt
./foo.vfs/main.tcl
./sdx.kit
./tclkit-win32-sh.upx.exe
./tclkit.exe

"tclkit.exe" is a copy of "tclkit-win32-sh.upx.exe".

Following are the respective file contents:

###############
# ./foo.vfs/main.tcl
###############
package require starkit
starkit::startup
package require app-foo


###############
# ./foo.vfs/lib/app-foo/pkgIndex.tcl
###############
package ifneeded app-foo 1.0 [list source [file join $dir foo.tcl]]


###############
# ./foo.vfs/lib/app-foo/foo.tcl
###############
package provide app-foo 1.0
proc foo {x} {
puts "foo: $x"
}
foo 555
vfs::mk4::Mount [file nativename "$starkit::topdir"] this.kit
set f [open this.kit/lib/data.txt "r"]
set x [read $f]
close $f
puts -nonewline "data.txt: $x"
vfs::unmount this.kit
exit 0


###############
# ./foo.vfs/lib/data.txt
###############
xxxx


That's it!
All the final script does (or is supposed to do) is print out:
foo: 555
data.txt: xxxx

Now I compile my starkit:

tclkit.exe sdx.kit wrap foo.kit

I run it:

$ tclkit.exe foo.kit
foo: 555
data.txt: xxxx

Perfect so far!

Now I build a standalone Starpack:

$ tclkit.exe sdx.kit wrap foo.exe -runtime tclkit-win32-sh.upx.exe
5 updates applied

Now I execute foo.exe:

$ foo.exe
foo: 555
file open failed
while executing
"mk::file open mk4vfs1 {C:/Documents and
Settings/ahaswarey/tmp/pkg/foo.exe}"
("eval" body line 1)
invoked from within
"eval [list mk::file open $db $file] $args"
(procedure "::mk4vfs::_mount" line 9)
invoked from within
"::mk4vfs::_mount {C:/Documents and
Settings/ahaswarey/tmp/pkg/foo.exe}"
("eval" body line 1)
invoked from within
"eval [list ::mk4vfs::_mount $mkfile] $args"
(procedure "vfs::mk4::Mount" line 9)
invoked from within
"vfs::mk4::Mount [file nativename "$starkit::topdir"] this.kit"
(file "c:/Documents and
Settings/ahaswarey/tmp/pkg/foo.exe/lib/app-foo/foo.tcl" line 9)
invoked from within
"source {c:/Documents and
Settings/ahaswarey/tmp/pkg/foo.exe/lib/app-foo/foo.tcl}"
("package ifneeded" script)
invoked from within
"package require app-foo"
(file "c:/Documents and
Settings/ahaswarey/tmp/pkg/foo.exe/main.tcl" line 3)

===================

What am I doing wrong?

Thanks for any help on this!

-Asif

Michael Schlenker

unread,
May 5, 2004, 9:55:10 AM5/5/04
to
This looks wrong, as does the next line.

> set f [open this.kit/lib/data.txt "r"]
Why not use:
set f [open [file join $::starkit::topdir lib data.txt]]

> set x [read $f]
> close $f
> puts -nonewline "data.txt: $x"

> vfs::unmount this.kit
no need to unmount
> exit 0

You have already mounted the starkit, when it runs, and you issue
package require starkit. No need to remount unless you do tricky things
with writing back to your starkit.

If this is not your real scenario and data.txt is really a metakit
database you want to open, you hit a limitiation in the mk4vfs driver
that does not allow nested starkits/metakit vfs files.

Michael

Reply all
Reply to author
Forward
0 new messages