Forum OpenACS Development: unzip in AOLserver / TCL ?

Collapse
Posted by Malte Sussdorff on
Is there a way to unzip files directly in AOLserver / TCL? I tried with the Trf "zip -mode decompress" command, but I failed so far on every installation due to library issues, and I don't have time to dig into this any further.

Any help / ideas are highly appreciated as the current way of unzipping causes "out of memory" errors from time to time (due to exec, I would presume).

Collapse
Posted by Dave Bauer on
Seems like a job for a background thread.

Unzipping doesn't have to happen in real time, that's actually a bad idea anyway.

Makes more sense to do it after the connection finishes.

Some sort of queue would make sense, that way many unzips don't kill your server.

Collapse
Posted by Gustaf Neumann on
No, the background delivery thread is not a good idea, since this is here for fast streaming. It can handle easily 1000 streaming file deliveries, but as soon you have one blocking operations, all these block immediately.

Malte, have you tried:
http://www.equi4.com/critlib/
http://mkextensions.sourceforge.net/mkZiplib10.htm

If performance is not critical, one can unzip in tcl as well:
http://wiki.tcl.tk/6175

Collapse
Posted by Malte Sussdorff on
Thanks a lot for these links, they are indeed helpful, I will try to go with mkZipLib. The main goal was to get it into photo-album so the unzipping of multiple photos does not happen in the exec. But now I could go even further and directly process the file with TCLmagick once it is extracted, which is great. If I am successful I will let you know.
Collapse
Posted by Malte Sussdorff on
Hi Gustaf,

Okay, I have to admit that I failed to compile mkZipLib due to my lack of knowledge of C compilers.

Here is the command I used to compile mkZiplib10:

gcc -DUSE_TCL_STUBS=1 -I/usr/local/aolserver45/include -I/usr/local/src/aolserver45/tcl8.4.17/generic -I/usr/local/src/aolserver45/tcl8.4.17/unix -L/usr/local/src/aolserver45/tcl8.4.17/unix -ltclstub8.4 -ltcl8.4 -lz -o mkZiplib10.so mkZiplib10.c zip.c unzip.c

It fails with /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../lib/crt1.o: In function `_start':../sysdeps/i386/elf/start.S:115: undefined reference to `main'

If I don't use TCL_STUBS it compiles, but I have no idea how I can load the resulting .so file. Although it is off topic, I hope you can give me a hand.

Collapse
Posted by Malte Sussdorff on
I worked a lot on this, sadly with no success. The only thing I managed is to get vfs::zip working, showing me the files correctly in the zipfile along with the correct file size. But when I do "file copy" out of the virtual file system, the file is not decompressed on the way, instead the compressed version is copied out of the zipfile container.

I think it all boils down to zlib not working correctly with TrF, but I am giving up at this point and pray for exec to have improved in TCL 8.5

Collapse
Posted by Jose Agustin Lopez Bueno on
Hi!

Are you find any solution for this?
When my server is wasting many memory, the execs
fail (unzip, ...).

Is it Tcl 8.5 a solution?

Regards,
Agustin

Collapse
Posted by natlee campbell on
AOLserver is the web server used by AOL. It is a multithreaded, Tcl-enabled web server suitable for large scale, dynamic web sites. Its open-source can compile and run on a variety of Unix flavors, including Linux, FreeBSD, OpenBSD, Solaris, IRIX, HP/UX, DEC Tru64, UnixWare, Apple OS/X "Darwin".