Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

problem with par as other user

by Anonymous Monk
on Jun 24, 2006 at 02:50 UTC ( #557347=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,

I packaged a script into an executable using PAR. When I run it from a terminal it runs fine. I check /tmp and find there's a folder /tmp/par-rvosa with the cached contents of the archive. However, the executable is supposed to be invoked by a different process. When I try that, an empty par-SYSTEM folder appears in /tmp, and the executable just sits there doing nothing.

I assume this is a permissions issue - so how would I go about fixing this without changing my environment or /tmp permissions?


Replies are listed 'Best First'.
Re: problem with par as other user
by vkon (Curate) on Jun 24, 2006 at 10:59 UTC
    because of this /tmp par behaviour, I switched off from it
    Just think what a security hole it is!

    I even developed my own solution which unpacks in-memory on the fly, but other alternatives (including commercial ones) will suit better for you.

    just don't be stuck with a solution that is simple and wrong!

      You are welcome to chime in on and help fix it. We are all just a bunch of hard-working volunteers. Personally, I put a couple of hours a week forward to fix bugs in PAR and clean up the RT bug queue.

      On an aside: The module can do much more than just creating self-extracting binaries. Doing all which PAR does in-memory is probably not possible to realize.

        thanks, I'll subscribe this list.

        However unzipping to /tmp seems to me too simplistic.

        BTW Tcl/Tk's way of packaging (starkit and similar stuff) looks better


        forgot to ask: what are those "much more than just creating self-extracting binaries", BTW? In two words...
      Would you care to elaborate on the "security hole" aspect? Provided that you have a *nix system configured with this sort of thing in mind (e.g. permissions 1777 (rwxrwxrwt) for /tmp), /tmp can be set to permit any user to create and write to their own files there without allowing them to modify or delete anyone else's.
        first, you're not always on *nix.
        I mean middle-weighted Joe user not always on *nix, especially when it is not developer but namely user. (PAR isn't *nix-only, isn't it?)

        But even on *nix, root user can still modify poor Joe's scripts.
        This probability is low, but it equals zero with in-memory unpacks.

        Windows users are 99,99% work under administrative privilegies, so replacing /tmp files will be easy for them.

        Yet, /tmp space could be full.
        Don't tell me that entire system will be badly functioning in this case.
        Par will not be working in this case, but other programs will...

        Other security risk - is that PAR reuses same /tmp between runs,and this, IMO, could also be busted.

        Addition: - another one, when PAR remains its files in /tmp after finishing the program, this means the more program I'll run the larger /tmp will be, and I dislike this.

      PS. I am replying to Ace128 who asked quite essential question, so it do not fit in CB.
      But this could be useful in general, I hope.

      explanation on how redistributable perl is done with only in-memory unpacks

      First of all, previous (lost, but easily recoverable) archive previously located at was perl-5.6.1 + perl/Tk
      Currently I placed newer at which is based on perl-5.8.? and Tk GUI with Tcl/Tk, which is better than perl/Tk. (looks similar but more powerful)

      How that works.

      start.exe is a tiny C program (explain later) which uses perl58.dll and searches for file './modules/' and feeds it to perl interpreter. This bootstraps in such a way that required modules are unzipped and loaded so 'modules/' becomes available to @INC.

      Unlike PAR, is not unzipped entirely, only used what is used. Also, just not using filesystem at all could be beneficial in some cases.

      How can I make file set even smaller

      If I'll go further this easy way, (which probably was the way of all commercial packers), then:

      • incorporate files "modules/", "modules/" into mentioned small C program, as C string, and eval it later.
      • "" could be placed inside ""
      • Use famous technique on appending "" to executable, which is perfectly possible.
      • All required extensions could be built into perl58.dll, now this possible, see This requires compilation of perl, (but I'll better place required DLLs near around)
      So this ends in 2 files: 1 EXE + 1 DLL, including Tcl/Tk.

      start.exe, a tiny C program

      Its trivial. It loads perl58.dll, calls RunPerl. Dead simple.

      The only trick used (and its not my invention of course) it checks its name to have an idea on what script to run.
      So I compiled the stub once, and then I just copy with different name to make engine to start "" script.
      Same as busybox.

      Very same could be ported to Linux, of course, I just didn't this...


        Well, since this may be of more interest to more, I ask it here. What do I have to do minimum to get this start.c to compile properly? I've downloaded the source from Activestate and setup Dev-C++ to find the headers and libs. Now, when I compile I get this: I was hoping I wouldn't have to install M$ Visual Studio X. It seems that I have to do "configure" (to create the config.h file that is missing), but how to do this in windows? Would be damn cool if I could compile this start.c, since this little project seems really cool to me :) And besides, I need to add a pause in there to make it pause, and not close the terminal window when some tk script Im runing doesnt work. :) I get some error, but the window closes and I cant see the error. (Probably some module missing in this package that I use). Oh, and maybe somehow to get rid of the terminal window aswell when the tk script actually works!

        But, I suppose the Perl interpreter is boundled into this start.c, and thus I need to be able to compile the whole Perl source aswell?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://557347]
Approved by ikegami
Front-paged by Courage
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2018-04-20 16:58 GMT
Find Nodes?
    Voting Booth?