You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "John H. Embretsen (JIRA)" <ji...@apache.org> on 2007/11/23 11:34:43 UTC

[jira] Issue Comment Edited: (DERBY-2897) setEmbeddedCP.bat script fails (mangles DERBY_HOME variable) when the path in DERBY_HOME contains a dot

    [ https://issues.apache.org/jira/browse/DERBY-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544967 ] 

johnemb edited comment on DERBY-2897 at 11/23/07 2:33 AM:
--------------------------------------------------------------------

After some investigation, I have come to the conclusion that this issue is most likely invalid, for the following reasons:

 - The "mangling" is not caused by the dot itself, but it is caused by having one or more "non-8.3 compliant" directory names in DERBY_HOME. "8.3" is a common name for the old MS-DOS type of file names with a maximum of 8 character file name plus a 3 character extension (e.g. "PROGRAMS.TXT"). The directory name "10.3RC1" has 4 characters in the extension, so it is treated as a "Long File Name" (LFN), not an 8.3 file name. The "s" in the for loop in the script causes the directory name to be converted from LFN to 8.3 (see below).

 - The script does not actually fail, because the "mangled" versions of DERBY_HOME and CLASSPATH are valid file system paths in Windows. E.g. running "java org.apache.derby.tools.sysinfo" after running the script should still work.


DERBY_HOME is modified in the script by the following line:

@FOR %%X in ("%DERBY_HOME%") DO SET DERBY_HOME=%%~sX

Where X is a variable reflecting the value of %DERBY_HOME%, and
    ~  expands X removing any surrounding quotes (")
    s  means that the "expanded path contains short names only"

(type FOR /? at a Windows command prompt for details)

Having said that, I don't really understand why the "s" (for converting to 8.3 names) is used, or why the for loop is used at all. All we have to do is to use the value of DERBY_HOME for setting the CLASSPATH variable... 

One possible explanation is that this would perhaps make the script work with paths with spaces in them as well, but I have not been able to find the actual reasoning behind this (it has been like this since the scripts were donated to Apache). I'm still a bit confused when it comes to handling spaces in paths in batch files and environment variables on Windows, so I don't have a better suggestion at the moment.


      was (Author: johnemb):
    After some investigation, I have come to the conclusion that this issue is most likely invalid, for the following reasons:

 - The "mangling" is not caused by the dot itself, but it is caused by having one or more "non-8.3 compliant" directory name in DERBY_HOME. "8.3" is a common name for the old MS-DOS type of file names with a maximum of 8 character file name plus a 3 character extension (e.g. "PROGRAMS.TXT"). The directory name "10.3RC1" has 4 characters in the extension, so it is treated as a "Long File Name" (LFN), not an 8.3 file name. The "s" in the for loop in the script causes the directory name to be converted from LFN to 8.3 (see below).

 - The script does not actually fail, the because the "mangled" versions of DERBY_HOME and CLASSPATH are valid file system paths in Windows. E.g. running "java org.apache.derby.tools.sysinfo" after running the script should still work.


DERBY_HOME is modified in the script by the following line:

@FOR %%X in ("%DERBY_HOME%") DO SET DERBY_HOME=%%~sX

Where X is a variable reflecting the value of %DERBY_HOME%, and
    ~  expands X removing any surrounding quotes (")
    s  means that the "expanded path contains short names only"

(type FOR /? at a Windows command prompt for details)

Having said that, I don't really understand why the "s" (for converting to 8.3 names) is used, or why the for loop is used at all. All we have to do is to use the value of DERBY_HOME for setting the CLASSPATH variable... 

One possible explanation is that this would perhaps make the script work with paths with spaces in them as well, but I have not been able to find the actual reasoning behind this (it has been like this since the scripts were donated to Apache). I'm still a bit confused when it comes to handling spaces in paths in batch files and environment variables on Windows, so I don't have a better suggestion at the moment.

  
> setEmbeddedCP.bat script fails (mangles DERBY_HOME variable) when the path in DERBY_HOME contains a dot
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2897
>                 URL: https://issues.apache.org/jira/browse/DERBY-2897
>             Project: Derby
>          Issue Type: Bug
>          Components: Demos/Scripts
>    Affects Versions: 10.3.1.4
>         Environment: Windows 2000
>            Reporter: Stan Bradbury
>            Priority: Minor
>
> Following command sequence shows the problem when DERBY_HOME has a dot in a folder name (e.g. 10.3RC1) - note the string  "4DBA~1" in the middle of 10.3RC1.
>  -> bin\setEmbeddedCP.bat
> DERBY_HOME or DERBY_INSTALL not set. Set one of these variables
> to the location of your Derby installation.
>  -> set DERBY_HOME=C:\CldScpInstalls\Test\10.3RC1
>  -> bin\setEmbeddedCP.bat
>  -> SET DERBY_HOME=C:\CLDSCP~1\Test\104DBA~1.3RC1
>  -> set CLASSPATH=C:\CLDSCP~1\Test\104DBA~1.3RC1\lib\derby.jar;C:\CLDSCP~1\Test\104DBA~1.3RC1\lib\derbytools.jar;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.