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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2007/11/15 21:12:43 UTC

[jira] Created: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

The bin scripts should be able to run when DERBY_HOME is not set
----------------------------------------------------------------

                 Key: DERBY-3207
                 URL: https://issues.apache.org/jira/browse/DERBY-3207
             Project: Derby
          Issue Type: Improvement
          Components: Demos/Scripts
    Affects Versions: 10.4.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.

When I removed this part of bin/ij

-------

if [ -z "$DERBY_HOME" ] ; then
  echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
  echo "to the location of your Derby installation."
  exit 1
fi

. $DERBY_HOME/bin/derby_common.sh

-------

and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Resolved: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen resolved DERBY-3207.
---------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.6.0.0
    Issue & fix info:   (was: [Patch Available])

Committed revision 924209.

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: d3207.diff, d3207.stat
>
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Commented: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845313#action_12845313 ] 

Knut Anders Hatlen commented on DERBY-3207:
-------------------------------------------

I tested the patch by building the snapshot and release targets and verified that the scripts worked without DERBY_HOME in the following scenarios:

1) when the script was executed by specifying the full path (absolute or relative) on the command line

2) when invoking a symbolic link that pointed to one of the scripts

3) when having the bin directory in PATH and invoking the script without specifying full path

Examples of the above scenarios copied from my terminal window:

$ unset DERBY_HOME                                    
$ ./db-derby-snapshot-10.6.0.0-923109M/bin/ij         
ij version 10.6
ij> exit;
$ ln -s db-derby-snapshot-10.6.0.0-923109M/bin/ij .       
$ ./ij 
ij version 10.6
ij> exit;
$ export PATH=`pwd`/db-derby-snapshot-10.6.0.0-923109M/bin:$PATH
$ ij
ij version 10.6
ij> exit;

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3207.diff, d3207.stat
>
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Commented: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542870 ] 

Knut Anders Hatlen commented on DERBY-3207:
-------------------------------------------

The simple solution is to inline derby_common.sh in all the scripts. To avoid the cost of maintaining duplicated code, I think it's best if we only have templates for the scripts in the repository, and let ant do the inlining for us in the build process.

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Updated: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-3207:
--------------------------------------

    Issue & fix info: [Patch Available]

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3207.diff, d3207.stat
>
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Updated: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-3207:
--------------------------------------

    Attachment: d3207.diff
                d3207.stat

Here's a patch that addresses this issue. Before the patch can be applied, the original scripts must be moved from the bin directory to a new directory called bin/templates. Use the following commands to do that:

mkdir bin/templates
svn add bin/templates

svn mv bin/dblook bin/templates/
svn mv bin/ij bin/templates/
svn mv bin/sysinfo bin/templates/
svn mv bin/NetworkServerControl bin/templates/
svn mv bin/startNetworkServer bin/templates/
svn mv bin/stopNetworkServer bin/templates/
svn mv bin/derby_common.sh bin/templates/

Then the patch can be applied. The patch will make the following changes:

*** build.xml:

- add a target that prepends the contents of derby_common.sh to each of the scripts in bin/templates/ and puts the resulting concatenated scripts directly under bin/

- exclude the bin/template directory from the archives produced by "ant snapshot"

*** tools/release/build.xml:

- exclude the bin/template directory from the bin archives created by "ant release"

*** bin/templates/{ij,dblook,sysinfo,startNetworkServer,stopNetworkServer,NetworkServerControl}:

- removed the following section from all the files, since the content of derby_common.sh will now be included directly in the scripts:

-if [ -z "$DERBY_HOME" ] ; then
-  echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
-  echo "to the location of your Derby installation."
-  exit 1
-fi
-
-. $DERBY_HOME/bin/derby_common.sh

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3207.diff, d3207.stat
>
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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


[jira] Assigned: (DERBY-3207) The bin scripts should be able to run when DERBY_HOME is not set

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-3207:
-----------------------------------------

    Assignee: Knut Anders Hatlen

This should be an easy thing to fix, so I'll try to get it into 10.6. The Windows BAT files already works without DERBY_HOME set, so we only need to make this change for the Unix shell scripts.

> The bin scripts should be able to run when DERBY_HOME is not set
> ----------------------------------------------------------------
>
>                 Key: DERBY-3207
>                 URL: https://issues.apache.org/jira/browse/DERBY-3207
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts
>    Affects Versions: 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>
> The scripts under bin should be able to run without requiring the users to set DERBY_HOME explicitly. The script derby_common.sh, which is sourced by all the scripts under bin, contains code to detect DERBY_HOME based on the value of $0, but since the scripts need to know DERBY_HOME in order to source derby_common.sh, they still fail when DERBY_HOME is not set.
> When I removed this part of bin/ij
> -------
> if [ -z "$DERBY_HOME" ] ; then
>   echo "Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable"
>   echo "to the location of your Derby installation."
>   exit 1
> fi
> . $DERBY_HOME/bin/derby_common.sh
> -------
> and in-lined the code in derby_common.sh in its place, I was able to run ij successfully by typing the command './bin/ij' without setting DERBY_HOME first.

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