[ale] compiled scripts

gamyers at atlml1.atlprom.att.com gamyers at atlml1.atlprom.att.com
Fri Aug 30 08:13:45 EDT 1996


Actually, you may still have the same problem you had before if you
compile a set of execs of shell commands.  When you compile, strings
are visible in the binary and generally you would pass strings to the
calls to exec().  Using either od or strings you can display string values.
The best bet as alluded in another post is cc.  I have heard of tools that
can 'compile' awk scripts, but none that compile shells.  I would assume
that if you wanted to you could create this beast with something like:

main() {

	exec("line 1 of your script \
	line 2	\
	...	\
	...	\
	line N);
return(0)
}

But this would be truly ugly and would demonstrate the previous concern of
strings in a binary.

------------- Begin Forwarded Message -------------

> I don't know of any such utility, except for gcc :)
That looks like the right answer.  Actually, two right answers:
  1) gcc works like that -- it runs its own associated parsers,
     code-generators, assemblers, linkers, ... from a compiled top-level
     process, and
  2) the usual way to make a process' mechanics [somewhat more]
     inaccessible, is to compile it.

I once read a warning against writing 'non-atomic'scripts which run setuid,
noting that input which caused a script-invoked utility to abort might
leave the user at root privileges.  (I may be misunderstanding this.)

I expect one alternative is to write your package as a simple series
of 'exec's for shell commands and for special-purpose compiled functions,
then compile it.  Would this approach serve your purposes?

cf the reason for making a binary is to distriburte a script that looks like a
cf binary and no one could edit.  In perl you could write whole programs.  How
cf could you sell them if anyone could edit them?

Similarly, if you wrote in Java and distributed compiled Java byte code,
would that meet your needs?

It isn't clear what types of scripts you are considering, particularly
whether they would mainly consist of sequences of useful shell commands,
or would mainly command an associated family of special-purpose functions
(a'la gcc).

John M. Mills, Senior Research Engineer   --   john.m.mills at gtri.gatech.edu
   Georgia Tech Research Institute, Georgia Tech, Atlanta, GA 30332-0853
        Phone contacts: 770.528.3258 (voice), 770.528.7083 (FAX)
        EMACS: 'Eight Megabytes And Constantly Swapping' -- anon






More information about the Ale mailing list