riverstore / hustoj

Automatically exported from code.google.com/p/hustoj
1 stars 0 forks source link

Python support #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I hope to support python language at http://judge.lavida.us

How can I make a sandbox(maybe routine in judge_client.cc) for python?

Original issue reported on code.google.com by method4libe on 6 Feb 2011 at 12:38

GoogleCodeExporter commented 8 years ago
from judge_client.cc to web/status.php and others 
a lot of files need to be modify
i may do that later, but if you are in a hurry, try first update to the latest 
SVN version for Ruby and Bash support ,after that you can try to do that by 
refering to the ruby support code.

Original comment by newsc...@gmail.com on 8 Feb 2011 at 3:36

GoogleCodeExporter commented 8 years ago
Python should works now

if you'd like to know the procedure 
check wiki [AddProgrammingLanguage]

Original comment by newsc...@gmail.com on 8 Feb 2011 at 6:47

GoogleCodeExporter commented 8 years ago
How can i add mono c# to this system ?
I read wiki section but i couldn't understand the settings of the 
judge_client.cc Please describe it a bit more.

Original comment by hamidrezaabdi on 8 Feb 2011 at 9:55

GoogleCodeExporter commented 8 years ago
1 you need a a+b program written in c#
2 you need to figure out which files is needed to run this program
3 using strace to collect all sys_calls needed by the program
4 edit judge_client.cc on all point listed in AddProgrammingLanguage

using root account to debug/step trace judge_client in codeblocks may help you 
on understanding the routine of judge_client.

if you have any questions , post it here with the code line number, i'll try to 
explain it or add comments to the code in svn.

Original comment by newsc...@gmail.com on 8 Feb 2011 at 2:35

GoogleCodeExporter commented 8 years ago
click on rXXX and then click diff will show the code added/modified exactly.

Original comment by newsc...@gmail.com on 8 Feb 2011 at 2:37

GoogleCodeExporter commented 8 years ago
the python language results wrong answer instead of compile error.
how can i solve this problem.

Original comment by hamidrezaabdi on 14 Feb 2011 at 12:00

GoogleCodeExporter commented 8 years ago
i wonder if python is a compilable language ?

Original comment by newsc...@gmail.com on 15 Feb 2011 at 4:19

GoogleCodeExporter commented 8 years ago
hamidrezaabdi may want to detect syntax error in a submission file

You can check syntax of a python code following command line:
python -c "import py_compile,sys; sys.stderr=sys.stdout; 
py_compile.compile(r'Main.py')"

Original comment by method4libe on 15 Feb 2011 at 4:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
try r777

Original comment by newsc...@gmail.com on 15 Feb 2011 at 6:16

GoogleCodeExporter commented 8 years ago
Does it works well? It doesn't works well in my server.

Here's debug message of the judge_client(r777):

root@lavidaus:/home/judge/run0# judge_client 57316 0 /home/judge 0
sim=0
Main=Main.pytime: 3 mem: 640
status=0
mkdir: cannot create directory `/home/judge/run0//lib': File exists
mkdir: cannot create directory `/home/judge/run0//bin': File exists
cp: omitting directory `/lib/dbus-1.0'
cp: omitting directory `/lib/firmware'
cp: omitting directory `/lib/hdparm'
cp: omitting directory `/lib/init'
cp: omitting directory `/lib/lsb'
cp: omitting directory `/lib/modules'
cp: omitting directory `/lib/plymouth'
cp: omitting directory `/lib/security'
cp: omitting directory `/lib/terminfo'
cp: omitting directory `/lib/udev'
cp: omitting directory `/lib/ufw'
cp: omitting directory `/lib/xtables'
ln: creating symbolic link `/home/judge/run0//bin/sh': File exists
mkdir: cannot create directory `/home/judge/run0//usr': File exists
mkdir: cannot create directory `/home/judge/run0//usr/lib': File exists
init_call_counter:6
pid=21567 judging /home/judge/data/1000/test.in
[ERROR] A Not allowed system call: runid:57316 callid:14

WTERMSIG=9
Killed
mv: target `/home/judge/run0/log/' is not a directory
result=10

Original comment by method4libe on 17 Feb 2011 at 12:55

GoogleCodeExporter commented 8 years ago
what code in the solution was written?
what distribution and python version are you running?
you might need to add coe in okcalls.h for 64-bits system, because i don't have 
a 64 bits system to debug with, ruby bash python do not support 64-bits yet.

Original comment by newsc...@gmail.com on 17 Feb 2011 at 2:40

GoogleCodeExporter commented 8 years ago
using strace to collect all sys_calls needed by the program
and add them into okcalls.h for 64bits
like:   callid:14
add to okcalls.h :
#ifdef __i386
....
#else
.....
int LANG_YV[256]={14,0};
int LANG_YC[256]={-1,0};
#endif

Original comment by newsc...@gmail.com on 17 Feb 2011 at 6:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
just follow AddProgrammingLanguage 
do the first two steps

ON A 64-bits system

Original comment by newsc...@gmail.com on 17 Feb 2011 at 2:17

GoogleCodeExporter commented 8 years ago
I just applied the your method but It doesn't works.

I tried to find reason for the problem but I couldn't found resolution method.

anyway I just found size of user.out and error.out in runX directory were 0 
after judging process finished.

Original comment by method4libe on 1 Mar 2011 at 6:52

GoogleCodeExporter commented 8 years ago
would you like to post your 64-bits version of okcalls.h here?
especially the section:
#else
...
int LANG_YV[256]={...,0};
int LANG_YC[256]={...,0};
#endif

and run debug again
judge_client 57316 0 /home/judge 0
post the output too

Original comment by newsc...@gmail.com on 2 Mar 2011 at 12:13

GoogleCodeExporter commented 8 years ago

Original comment by newsc...@gmail.com on 16 Jul 2011 at 3:06