-
Bug
-
Resolution: Duplicate
-
P4
-
8u33
-
arm
-
linux
FULL PRODUCT VERSION :
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux myhost 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux
A DESCRIPTION OF THE PROBLEM :
$ENV.PWD normally contains the current working directory. However, when the script is invoked with sudo, $ENV.PWD is undefined.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) create a file "pwd.js" with the following content:
print($ENV.PWD);
2) invoke it as usual:
jjs -scripting pwd.js
3) invoke it with sudo:
sudo jjs -scripting pwd.js
4) for comparison, print the working directory with bash:
sudo bash -c 'echo $PWD'
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The following output
/home/pi
/home/pi
/home/pi
ACTUAL -
The following output:
/home/pi
undefined
/home/pi
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux myhost 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux
A DESCRIPTION OF THE PROBLEM :
$ENV.PWD normally contains the current working directory. However, when the script is invoked with sudo, $ENV.PWD is undefined.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) create a file "pwd.js" with the following content:
print($ENV.PWD);
2) invoke it as usual:
jjs -scripting pwd.js
3) invoke it with sudo:
sudo jjs -scripting pwd.js
4) for comparison, print the working directory with bash:
sudo bash -c 'echo $PWD'
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The following output
/home/pi
/home/pi
/home/pi
ACTUAL -
The following output:
/home/pi
undefined
/home/pi
REPRODUCIBILITY :
This bug can be reproduced always.