gobolinux / Scripts

The GoboLinux scripts collection
41 stars 9 forks source link

Refactor Runner.c #5

Closed AitorATuin closed 8 years ago

AitorATuin commented 8 years ago

Add CHECK macro Remove the fallback goto Add -f (--fallback) option, you need to specify this flag explicitly to run the command if the sandbox is not available. Add -c (--check) option, check mode. Tells if the sandbox is available

AitorATuin commented 8 years ago

Please can you verify it? Basically some refactor (the fallback goto was not a good idea imho) and added -c and -f options.

-f, by default if the sandbox cant be created in the system Runner does not run the command, using -f we force it to run the command.

❯ ./bin/Runner ls                                                                        
Error:main: Sandbox is not available, use -f for fallback mode at Runner.c:709
❯ ./bin/Runner -f ls
bin  Data  doc  Functions  lib  Makefile  Programs  Resources  share  src
❯ ./bin/Runner -fv ls      
This program needs its suid bit to be set.
Running on Linux 3.14.2-Gobo. At least Linux 4.0 is needed.
bin  Data  doc  Functions  lib  Makefile  Programs  Resources  share  src

-c, checks if the sandbox is available in this system.

❯ ./bin/Runner -c && echo "SI" || echo "NO" 
NO
AitorATuin commented 8 years ago

Of course we need to make the changes in Compile after this :)

hishamhm commented 8 years ago

Thanks!!

I've been discussing some issues with Runner and symlinks in /System/Index... @lucasvr and I have been brainstorming some solutions and as a result we ended up doing some extensive tweaking to the code, which hasn't yet been merged. We've been working on this on Monday and Tuesday, so things are really new (and not yet working)... but expect merge conflicts once a working solution is committed! Once the fix is in I think we'll be in a better position to review this one!

AitorATuin commented 8 years ago

No problem, I will rebase the code later.

AitorATuin commented 8 years ago

Rebased, can you review it now, thanks :)

lucasvr commented 8 years ago

Thanks, Aitor! The patch looks good and has just been merged.

AitorATuin commented 8 years ago

Compile support for this PR. https://github.com/gobolinux/Compile/pull/5