Issue Details (XML | Word | Printable)

Key: DERBY-620
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: John H. Embretsen
Reporter: John H. Embretsen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

BUILDING.txt section 3.2(1): Instructions for finding user home directory are not reliable

Created: 13/Oct/05 06:50 AM   Updated: 22/Oct/05 05:00 AM
Return to search
Component/s: Documentation
Affects Version/s: 10.1.2.1, 10.2.1.6
Fix Version/s: 10.1.2.1, 10.2.1.6

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY-620.diff 2005-10-17 06:23 PM John H. Embretsen 2 kB
Environment: Windows/Unix/Linux, JDKs 1.3-1.5

Resolution Date: 22/Oct/05 04:16 AM


 Description  « Hide
BUILDING.txt, section 3.2 states:

------------------------------------------------------------------------------------

3.2 Create property file

You will need to create a property file to specify
your environment and some of your options. Do the following
to specify your environment and options:

(1) Find out user home directory on your system. You can find
    user home directory by doing echo on variable %HOME%
    on windows and $home or $HOME on unix.

------------------------------------------------------------------------------------

In some cases, %HOME% (on WIndows) or $HOME ($home) (on Unix) does not correspond to the directory where ant looks for "ant.properties".

I recently tried to build Derby on Windows XP, and accidentally put ant.properties in the wrong directory, causing ant to say that java.lang could not be found. On Windows XP and 2000 (and most likely all older Windows platforms as well) "out-of-the-box", there is no environment variable called %HOME%. Creating this environment variable manually does not make any difference.

On Unix systems, the $HOME environment variable does not necessarily always correspond to ant's (i.e. Java's) interpretation of "user.home". For example, if a user changes this variable manually from "/home/username" to "/home/username/myHome", $HOME refers to the latter, but ant will continue to look for ant.properties in the "/home/username" directory.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
John H. Embretsen added a comment - 13/Oct/05 07:16 AM
Ant looks for the "ant.properties" file in the directory specified by Java's "user.home" system property. Since this does not necessarily corespond with %HOME% or $HOME, BUILDING.txt should be corrected.

On Windows 2000 and XP, the "user.home" directory in most cases corresponds to the environment variable %USERPROFILE%, which is a concatenation of the variables %HOMEDRIVE% and %HOMEPATH%, e.g. "C:\Documents and Settings\User".
See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx.

On Unix/Linux systems, the "user.home" directory in most cases correspond to the $HOME environment variable (e.g. "/home/username"), but this is not always true, as described above.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4787931 is a bug report that describes some issues and workarounds related to the way a variety of JVMs determines "user.home". On Windows, Java actually tries to determine the user home directory by looking in the registry for the location of the user's desktop folder, and uses that folder's parent folder as "user.home". On Unix/Linux systems, Java determines the user's home directory by looking at the user's entry in the password file, e.g. /etc/passwd.

I suggest changing BUILDING.txt, section 3.2 (1) to something like this:

----------------------------------------------------------------------------------------

(1) Determine the directory on your system that corresponds to
    the "user.home" system property of the jvm referred to by
    JAVA_HOME. This directory will be referred to as the
    ${user.home} directory in the rest of this document.
    In order to correctly determine the value of ${user.home},
    do either of the following:

a) Run ant diagnostics and look for "user.home" in the
           list of System properties:

ant -diagnostics

b) Write and run a small java program that prints the
           value of the "user.home" system property, e.g. by
           including the following line in the program:

           System.out.println(System.getProperty("user.home"));
           
    On most Unix systems, ${user.home} is equivalent to the
    value of the environment variable $HOME or $home.
    On newer Windows systems, ${user.home} is often equivalent
    to the environment variable %USERPROFILE%.

----------------------------------------------------------------------------------------

Does anyone have any comments to this suggestion?

John H. Embretsen added a comment - 17/Oct/05 06:23 PM
I've attached a patch for this issue. The wording in the patch is roughly the same as presented in my previous comment. The patch is ready for review and (if accepted) commit.

John H. Embretsen added a comment - 18/Oct/05 10:56 PM
Kathey Marsden wrote on derby-dev earlier today:
> - Are there any other fixes that should be included in the 10.1.2 ?

In my opinion, this fix may be included in the 10.1.2 release as well as the trunk, if a committer has time to review and commit it in time.

Andrew McIntyre added a comment - 22/Oct/05 04:16 AM
Committed to trunk with revision 327242 and 10.1 with revision 327248.