Salve ragazzi, per la mia tesi sto facendo un lavoro in php sotto linux, ed ho la necessita di laciare alcuni make per un applicazione.
Dunque dopo che creo la cartela con l'applicazione lancio il suo make. duque la cartella ha come proprietario www-data (cioè apache) e gli assegno tutti i permessi cioè 777. il make file va a lanciare dei comandi in java in un altra cartella alla quale ho dato ricorsivamente lo stesso tutti i pesmessi (777) ed ho cambiato ricorsivamente proprietaio e gruppo in www-data. Ora la cosa che mi fa impazzire è che se faccio laciare il make da www-data la sua esecuzione termina a metà. mentre se lo lacio come utente normale da terminale, va tutto ok. Con queste premesse sono quesi certo che si un problema di permessi o privilegi per eseguire quel make. ma non riesco e trovare una soluzione. Sapreste darmi qualke dritta?
dunque ragazzi ecco la situazione se eseguo da terminale il make và tutto ok ed ecco l'output:
ric@PortatileLinux:~/tesi/TesiCochi/esercizi/somma2$ make && pwd
# building the makefile...
java -classpath /home/ric/tesi/TestSystem/TestSystem/TestBuilder/Bin/org/jdom.jar:/home/ric/tesi/TestSystem/TestSystem/TestBuilder/Bin:/home/ric/tesi/TestSystem/TestSystem/Translator/antlr-2.7.3/antlr.jar:/home/ric/tesi/TestSystem/TestSystem/Translator/C_Lexer/cgram/grammars:/home/ric/tesi/TestSystem/TestSystem/Translator/Bin:/usr/share/java/xalan2.jar:/usr/share/java/xml-apis.jar:/usr/share/java/xercesImpl.jar TestBuilder ./Esercizi ./run /home/ric/tesi/TestSystem/TestSystem ./Tests/OK /home/ric/tesi/TestSystem/TestSystem/TestBuilder
# running the makefile...
make -f ./run
make[1]: Entering directory `/home/ric/tesi/TesiCochi/esercizi/somma2'
mkdir -p ./Esercizi/ric/Prep
gcc -E -I /home/ric/tesi/TestSystem/TestSystem/TestSystem/c_include Esercizi/ric/es.c > Esercizi/ric/Prep/es.c
Esercizi/ric/es.c:3:2: warning: no newline at end of file
mkdir -p ./Esercizi/ric/Traced
java -classpath /home/ric/tesi/TestSystem/TestSystem/Translator/antlr-2.7.3/antlr.jar:/home/ric/tesi/TestSystem/TestSystem/Translator/C_Lexer/cgram/grammars:/home/ric/tesi/TestSystem/TestSystem/Translator/Bin tracer -trace -t ./Tests/redirections.txt ./Esercizi/ric/Prep/es.c
cp ./Esercizi/ric/Prep/*.traced.c ./Esercizi/ric/Traced
gcc -I /home/ric/tesi/TestSystem/TestSystem/TestSystem/c_include -fexceptions -c -w Esercizi/ric/Traced/es.traced.c -o Esercizi/ric/Traced/es.traced.o || true
g++ -z muldefs /home/ric/tesi/TestSystem/TestSystem/TestSystem.lib -l cppunit -l dl -L LIBDIR ./Esercizi/ric/Traced/es.traced.o ./Tests/Tests.o ./Tests/Redirections.o ./Tests/HelperFunctions.o ./Tests/OK/Traced/funz_OK.traced.o ./Tests/dummy.o -o ./Results/ric.exe || true
/usr/bin/ld: Warning: size of symbol `somma' changed from 74 in ./Esercizi/ric/Traced/es.traced.o to 259 in ./Tests/dummy.o
(ulimit -f 1024 ; ./Results/ric.exe ric ./Results/ric.xml > ./Tests/out.txt) || true
output:./Results/ric.xml
...OK..... somma2Generico
...OK..... somma2java -classpath /home/ric/tesi/TestSystem/TestSystem/XMLResumer/Bin:/home/ric/tesi/TestSystem/TestSystem/XMLResumer/Bin/org/jdom.jar:/home/ric/tesi/TestSystem/TestSystem/XMLResumer/Bin/org/xalan.jar:/home/ric/tesi/TestSystem/TestSystem/Bin/org/serializer.jar:/home/ric/tesi/TestSystem/TestSystem/Bin/org/sxercesImpl.jar:/home/ric/tesi/TestSystem/TestSystem/Bin/org/xml-apis.jar XMLResumer ./Results ./Results/Html ./project.xml
Building riccardo_resume.xml...
Building Student_resume.xml...
Building ric_resume.xml...
Building index.html from index.xml...
Building riccardo_resume.html from riccardo_resume.xml...
Building Student_resume.html from Student_resume.xml...
Building ric_resume.html from ric_resume.xml...make[1]: Leaving directory `/home/ric/tesi/TesiCochi/esercizi/somma2'
/home/ric/tesi/TesiCochi/esercizi/somma2
ric@PortatileLinux:~/tesi/TesiCochi/esercizi/somma2$
tutto và a buon fine. vediamo ora l'esecuzione con il php: ecco il codice:
$pathcorr=realpath("../esercizi/".$esercizio);
$comando3="chmod -R 777 ".$pathcorr;
$comando="cd ".$pathcorr." && make && pwd";
echo shell_exec("$comando3");
echo shell_exec("$comando");
ecco l'output a schermo:
# building the makefile... java -classpath /home/ric/tesi/TestSystem/TestSystem/TestBuilder/Bin/org/jdom.jar:/home/ric/tesi/TestSystem/TestSystem/TestBuilder/Bin:/home/ric/tesi/TestSystem/TestSystem/Translator/antlr-2.7.3/antlr.jar:/home/ric/tesi/TestSystem/TestSystem/Translator/C_Lexer/cgram/grammars:/home/ric/tesi/TestSystem/TestSystem/Translator/Bin:/usr/share/java/xalan2.jar:/usr/share/java/xml-apis.jar:/usr/share/java/xercesImpl.jar TestBuilder ./Esercizi ./run /home/ric/tesi/TestSystem/TestSystem ./Tests/OK /home/ric/tesi/TestSystem/TestSystem/TestBuilder
è evidente che l'esecuzione del make si bloccchi e non vada a buon fine tantè che il pwd non viene eseguito! Non riesco a capire a cosa sia dovuto, forse www-data non può eseguire gcc anke se riesco a chiamare tranquillamente un gcc -v...
grazie a tutti.