On 1 May 2012 19:50, Roland Mainz <[email protected]> wrote:
> On Mon, Apr 30, 2012 at 11:20 PM, ольга крыжановская
> <[email protected]> wrote:
>> On Wed, Apr 25, 2012 at 12:26 PM, Dan Shelton
>> <[email protected]> wrote:
>>> Hello, I have problems with Suse and compiled shell scripts. If I try
>>> to execute a shell script compiled with shcomp on Solaris Express it
>>> works like a charm but on Suse the system refuses to execute the
>>> binary:
>>> lorddan@test:~> cat x.sh
>>> print "hello world"
>>> print --version
>>> lorddan@test:~> shcomp x.sh x
>>> lorddan@test:~>
>>> -bash: ./x: cannot execute binary file
>>>
>>> Does anyone have a tip why this fails?
>
>> Dan, have a look at
>> https://wiki.archlinux.org/index.php/Binfmt_misc_for_Java IMO the same
>> could be used to recognise compiled shell code and use /usr/bin/ksh as
>> interpreter.
>> We only have to figure out how to use binfmt.
>
> On Linux you can do this:
> -- snip --
> echo ':shbinexec:M::\x0b\x13\x08:\xff\xff\xff:/usr/bin/ksh93:O' >
> /proc/sys/fs/binfmt_misc/register
> -- snip --
> After this point all compiled shell scripts (even those with only the
> exec bit but not the read bit set) can be executed directly.
>
> For example:
> -- snip --
> # as user "root":
> # echo ':shbinexec:M::\x0b\x13\x08:\xff\xff\xff:/usr/bin/ksh93:O' >
> /proc/sys/fs/binfmt_misc/register
> # as plain user:
> $ printf 'printf "argv=%%d\\n" $#\nprintf "argv=%%q\\n" "$@"\n' |
> shcomp /dev/stdin args.shbin
> $ args.shbin "hello world" "foo bar"
> argv=2
> argv='hello world'
> argv='foo bar'
> -- snip --
>
> AFAIK the only "missing step" is to teach systemd to do this at system
> startup...
>
> ----

Roland, thank you for helping. Next step for me to find out is to
figure how to do enable support for compiled scripts in with Ubuntu
and Debian permanently.

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to