Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CF path clarification #49

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions CheckerPrinter/src/checkerprinter/InMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,22 @@ protected boolean initCheckerArgs(JsonObject optionsObject) {
this.exceptionMsg = "Error: Cannot find indicated checker.";
return false;
}
/*
"-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"-processorpath", "$CHECKERFRAMEWORK/checker/dist/checker.jar",
"-cp", "$CHECKERFRAMEWORK/checker/dist/checker-qual.jar",
*/
this.checkerOptionsList =
Arrays.asList(
"-Xbootclasspath/p:" + this.CHECKER_FRAMEWORK + "/checker/dist/jdk8.jar",

"-processor",
checker);
if (optionsObject.getBoolean("has_cfg")) {
Expand Down Expand Up @@ -150,10 +163,10 @@ protected boolean initCheckerArgs(JsonObject optionsObject) {

List<Diagnostic<? extends JavaFileObject>> diagnosticList = errorCollector.getDiagnostics();

assert this.checkerOptionsList.size() > 1 : "at least should have -Xbootclasspath/p: flag";
assert this.checkerOptionsList.size() > 1 : "at least should have -Xbootclasspath/a: flag";

this.checkerPrinter.setExecCmd(
this.checkerOptionsList.subList(1, this.checkerOptionsList.size()));
this.checkerOptionsList.subList(0, this.checkerOptionsList.size()));

if (bytecode != null && diagnosticList.size() == 0) {
this.checkerPrinter.printSuccess();
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ https://github.com/eisop/webserver/blob/master/README-eisop.txt
```
./shell-scripts/deploy-checkerweb.sh -l ../jsr308/checker-framework
```
If there are issues with instantiating processors: [additional configuration info](https://github.com/padenaa/webserver/blob/cf_path/shell-scripts/README.md)

3. Customize the vhost configuration file: *wsgi-scripts/checkerweb-wsgi.conf*

Expand Down
4 changes: 2 additions & 2 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _e():
from urllib.parse import urlencode, quote as urlquote, unquote as urlunquote
urlunquote = functools.partial(urlunquote, encoding='latin1')
from http.cookies import SimpleCookie
from collections import MutableMapping as DictMixin
from collections.abc import MutableMapping as DictMixin
import pickle
from io import BytesIO
from configparser import ConfigParser, Error as ConfigParserError
Expand Down Expand Up @@ -178,7 +178,7 @@ def next(it):

bytes = str
else: # 2.6, 2.7
from collections import MutableMapping as DictMixin
from collections.abc import MutableMapping as DictMixin
unicode = unicode
json_loads = json_lds
eval(compile('def _raise(*a): raise a[0], a[1], a[2]', '<py3fix>', 'exec'))
Expand Down
8 changes: 5 additions & 3 deletions bottle_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
app = Bottle()
default_app.push(app)

import StringIO # NB: don't use cStringIO since it doesn't support unicode!!!
from io import StringIO # NB: don't use cStringIO since it doesn't support unicode!!!
import json
# import pg_logger
import urllib
import urllib2
##import urllib2

appPath = dirname(abspath(__file__))

Expand All @@ -63,13 +63,15 @@ def get_exec():
java_backend = subprocess.Popen(['./shell-scripts/run-checker.sh', request.query.frontend_data.encode('utf8'),
cfPath, str(isRise4Fun)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = java_backend.communicate()

print("Java backend output: %d %s %s" % (java_backend.returncode,stdout, stderr)) ## added for debugging
if java_backend.returncode != 0:
print ("Error: CheckerPrinter failed %d %s %s" % (java_backend.returncode,stdout, stderr))
result = json.dumps({'backend_status':'exception', 'exception_msg':'500 Server Internal Error.'})
else:
result = stdout
response.add_header("Content-Type", "application/json")
return result
return result

if __name__ == "__main__":
run(host='127.0.0.1', port=8081, reloader=True)
Expand Down
24 changes: 24 additions & 0 deletions shell-scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Detailed instructions on configuring the checkerframework with deploy-checkerweb.sh

if using deploy-checkerweb.sh with no flags runs into issues with finding the processors, ensure the following is completed

1. Install maven
```
apt install maven
```
2. In the local clone of the checkerframework, run;
```
./gradlew
```
3. If issues persist, run deply-checkerweb.sh with this flag;
```
./shell-scripts/deploy-checkerweb.sh -l <path to checker-framework>
```
e.g.
```
./shell-scripts/deploy-checkerweb.sh -l ../jsr308/checker-framework
```
4. As a last resort, manually set the correct path to the CF variable in the run-checkerweb.sh file
```
CF=/home/[your_user]/var/www/webserver/[local_copy_folder]/checker-framework
```
6 changes: 5 additions & 1 deletion shell-scripts/run-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ fi

# CF=$(cd ../enabled-checker-framework && pwd)
CF=$2

# if CF=$2 doesnt work, manually set CF to your local copy's path to the checker framework as shown
# CF=/home/[your_user]/var/www/webserver/[local_copy_folder]/checker-framework

IS_RISE4FUN=$3

cat <<ENDEND | $JAVA_HOME/bin/java -Xmx2500M -Xbootclasspath/p:$CF/checker/dist/javac.jar -ea -ea:com.sun.tools... -cp $CF/checker/dist/checker.jar:../CheckerPrinter/bin:../CheckerPrinter/javax.json-1.0.jar:$JAVA_HOME/lib/tools.jar checkerprinter.InMemory $CF $IS_RISE4FUN
cat <<ENDEND | $JAVA_HOME/bin/java -Xmx2500M -Xbootclasspath/a:$CF/checker/dist/javac.jar -ea -ea:com.sun.tools... -cp $CF/checker/dist/checker.jar:../CheckerPrinter/bin:../CheckerPrinter/javax.json-1.0.jar:$JAVA_HOME/lib/tools.jar checkerprinter.InMemory $CF $IS_RISE4FUN
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 5 similar findings have been found in this PR


SC2086: Double quote to prevent globbing and word splitting.


🔎 Expand here to view all instances of this finding
File Path Line Number
shell-scripts/run-checker.sh 29
shell-scripts/run-checker.sh 29
shell-scripts/run-checker.sh 29
shell-scripts/run-checker.sh 29
shell-scripts/run-checker.sh 29

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

$1
ENDEND