File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -263,8 +263,12 @@ public abstract static class CwdNode extends PythonBuiltinNode {
263
263
@ TruffleBoundary
264
264
@ Specialization
265
265
String cwd () {
266
- // TODO(fa) that should actually be retrieved from native code
267
- return System .getProperty ("user.dir" );
266
+ if (getContext ().isExecutableAccessAllowed ()) {
267
+ // TODO(fa) that should actually be retrieved from native code
268
+ return System .getProperty ("user.dir" );
269
+ } else {
270
+ return "" ;
271
+ }
268
272
}
269
273
270
274
}
@@ -275,14 +279,16 @@ public abstract static class ChdirNode extends PythonBuiltinNode {
275
279
@ TruffleBoundary
276
280
@ Specialization
277
281
PNone chdir (String spath ) {
278
- // TODO(fa) that should actually be set via native code
279
- try {
280
- if (Files .exists (Paths .get (spath ))) {
281
- System .setProperty ("user.dir" , spath );
282
- return PNone .NONE ;
282
+ if (getContext ().isExecutableAccessAllowed ()) {
283
+ // TODO(fa) that should actually be set via native code
284
+ try {
285
+ if (Files .exists (Paths .get (spath ))) {
286
+ System .setProperty ("user.dir" , spath );
287
+ return PNone .NONE ;
288
+ }
289
+ } catch (InvalidPathException e ) {
290
+ // fall through
283
291
}
284
- } catch (InvalidPathException e ) {
285
- // fall through
286
292
}
287
293
throw raise (PythonErrorType .FileNotFoundError , "No such file or directory: '%s'" , spath );
288
294
}
You can’t perform that action at this time.
0 commit comments