JDK-8042641 : jcontrol script should use pwd with -P flag
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 7u45,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2013-12-04
  • Updated: 2014-07-29
  • Resolved: 2014-05-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b22Fixed
Description
FULL PRODUCT VERSION :
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux puppypc23185 3.9.11 #1 SMP Sat Jul 27 19:40:54 GMT-8 2013 i686 i686 i386 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
Installed using Linux RPM

A DESCRIPTION OF THE PROBLEM :
The jcontrol/ControlPanel shell script should use the pwd -P flag to better handle symbolic links.  The dereference() comment says " Note: This function is not capable of detecting that one or more directories in the path is also a link and unravelling that."; pwd -P can handle detect and expand multiple symlinked directories.

% diff jcontrol.orig jcontrol
62c62
<     parent="`cd \`dirname \"${path}\"\`; pwd`"
---
>     parent="`cd \`dirname \"${path}\"\`; pwd -P`"
113c113
<     result="`cd \`dirname \"$*\"\`; pwd`"
---
>     result="`cd \`dirname \"$*\"\`; pwd -P`"
117c117
<         result="`cd \`dirname \"$*\"\`/../jre/bin; pwd`"
---
>         result="`cd \`dirname \"$*\"\`/../jre/bin; pwd -P`"

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Download Java for Linux RPM (http://java.com/en/download/manual.jsp )
2. Install (http://java.com/en/download/help/linux_install.xml#rpm )
3. Add convenience symbolic links:
% cd /usr/java
% ln -s jre1.7.0_45 latest
% cd /usr/bin
% ln -s ../java/latest/bin/* .
4. Run jcontrol
% jcontrol

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The Java ControlPanel launches.
ACTUAL -
The error message "ControlPanel: Error: Invalid link or copy:  " is printed and the script exits.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
ControlPanel: Error: Invalid link or copy:

REPRODUCIBILITY :
This bug can be reproduced occasionally.

---------- BEGIN SOURCE ----------
The jcontrol script is its own source code.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
cd /usr/java/latest/bin
cp jcontrol jcontrol.orig
sed -e "s/pwd/pwd -P/" jcontrol.orig > jcontrol