892 posts
Location
Where you'd least expect it.
Posted 09 March 2013 - 02:10 PM
Hi! Whenever I sandbox with my custom program, using [filename] [dir] with a slash at the end, whenever I say a program in there, it just says "File not found". "No such program" still appears with saying a non-existing program and all, it's just you cannot run programs.
Code:
6kYxAqi5Usage: sandbox dir/
892 posts
Location
Where you'd least expect it.
Posted 09 March 2013 - 02:42 PM
Do you think the problem is shell.run?
19 posts
Location
Eating a cake from the inside out.
Posted 09 March 2013 - 03:00 PM
If you are using CraftOS 1.3 or lower then having args in shell.run() is like this: shell.run("someprogram somearg") but in higher versions of computercraft it is: shell.run("someprogram", "somearg")
I dont know if this helps
892 posts
Location
Where you'd least expect it.
Posted 09 March 2013 - 03:46 PM
CraftOS 1.5
19 posts
Location
Eating a cake from the inside out.
Posted 09 March 2013 - 03:47 PM
Ok.. I can't help you here. Im sorry.
892 posts
Location
Where you'd least expect it.
Posted 09 March 2013 - 03:49 PM
Ok.. I can't help you here. Im sorry.
'
Oh, it's ok. Someone else can help if they want!
(I always feel helpless looking at people's ask a pro questions when they have more posts/programs then me. XP)
231 posts
Posted 09 March 2013 - 05:22 PM
I think the problem is that the sandbox dir is getting added multiple times. For example os.run calls loadfile, which itself calls fs.open, and since all 3 of those are sandboxed, it gets added 3 times.
I'd suggest sandboxing only the functions that directly access files without calling any other lua functions to do it (which is just the functions in the fs API)
(Also, this is unrelated, but I thought I'd point out that for functions with a variable number of arguments, instead of assigning them to a table, then unpacking it, you can directly pass the … to another function.)
892 posts
Location
Where you'd least expect it.
Posted 09 March 2013 - 05:57 PM
It works! Thanks!
19 posts
Location
Eating a cake from the inside out.
Posted 09 March 2013 - 09:34 PM
I found this in your code:
--print(sandboxed)
--Check if loaded...
if fs.setReadOnly then error("Already loaded!!!",2) end
privTable["aliases"]=shell.aliases()
1st there is NO fs.setReadOnly and if there was it should be fs.setReadOnly() < Brackets
7508 posts
Location
Australia
Posted 09 March 2013 - 09:48 PM
1st there is NO fs.setReadOnly and if there was it should be fs.setReadOnly() < Brackets
Line 107
function fs.setReadOnly(file, bool)
The purpose of
if fs.setReadOnly then error("Already loaded!!!",2) end
Is to see if
his API has already been loaded.
Also no, you don't need brackets. He is checking if the function exists, if you don't use brackets its the actual function pointer, not the function itself, try this on a CC1.4 computer and see what happens
print(term.isColor)
now try this on CC1.3 and note the difference
print(term.isColor)
19 posts
Location
Eating a cake from the inside out.
Posted 09 March 2013 - 10:32 PM
Ok… Im sorry… As in now says in my signature:
Dont expect me to read through your hundreds of lines of code.
Well it isnt hundreds but I still dont like to read a ton of code.
2088 posts
Location
South Africa
Posted 09 March 2013 - 10:36 PM
Ok… Im sorry… As in now says in my signature:
Dont expect me to read through your hundreds of lines of code.
Well it isnt hundreds but I still dont like to read a ton of code.
You don't have to read the code. Use the search function, :huh:/>
7508 posts
Location
Australia
Posted 09 March 2013 - 10:38 PM
Ok… Im sorry… As in now says in my signature:
Dont expect me to read through your hundreds of lines of code.
Well it isnt hundreds but I still dont like to read a ton of code.
While I agree with that prospect, as I too don't like reading through 100's of lines of code, before making suggestions that you did I do like to scan (or use the 'find' feature) to see if the function exists in their script before saying that its the cause of their problem.
EDIT: Also if you aren't willing to read the code then maybe you shouldn't be helping, sometimes it can take quite a lot of reading to see the problem.
Edited on 09 March 2013 - 09:39 PM
19 posts
Location
Eating a cake from the inside out.
Posted 09 March 2013 - 11:00 PM
I am willing to help. Im just not willing to read through heaps of code. I know the little tips and trick to find the code quick.
7508 posts
Location
Australia
Posted 09 March 2013 - 11:04 PM
I know the little tips and trick to find the code quick.
Clearly didn't… but moral of the story, make sure what you're saying is a problem, actually
is a problem?
892 posts
Location
Where you'd least expect it.
Posted 10 March 2013 - 04:59 AM
Is there a way to secure setfenv to not modify my functions? Because when I set it to error about insufficient permissions all the time when used, it breaks the whole thing.