Derby
  1. Derby
  2. DERBY-4283

setEmbeddedCP should not exit on error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: 10.5.3.2, 10.6.1.0
    • Component/s: Demos/Scripts
    • Labels:
      None
    • Environment:
      cygwin on windows (bash)
    • Urgency:
      Normal
    • Issue & fix info:
      Known fix, Newcomer, Repro attached, Workaround attached

      Description

      setEmbeddedCP should use 'return' instead of 'exit' if DERBY_HOME was not set.
      Because this script will be sourced from a shell, use of exit will terminate the calling shell.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          118d 18h 56m 1 Bryan Pendleton 17/Oct/09 15:50
          Closed Closed Reopened Reopened
          12d 5h 50m 1 Kathey Marsden 02/Feb/11 23:42
          Reopened Reopened Resolved Resolved
          13d 19h 58m 1 Mike Matrigali 16/Feb/11 19:40
          Resolved Resolved Closed Closed
          1312d 16h 40m 2 Knut Anders Hatlen 17/Jun/13 10:19
          Gavin made changes -
          Workflow jira [ 12466483 ] Default workflow, editable Closed status [ 12800082 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update] Close all resolved issues that haven't been updated for more than one year.

          Show
          Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
          Mike Matrigali made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Mike Matrigali [ mikem ] Bryan Pendleton [ bryanpendleton ]
          Fix Version/s 10.5.3.2 [ 12315436 ]
          Resolution Fixed [ 1 ]
          Hide
          Mike Matrigali added a comment -

          backported to 10.5. resetting original owner and resolving.

          Show
          Mike Matrigali added a comment - backported to 10.5. resetting original owner and resolving.
          Kathey Marsden made changes -
          Assignee Kathey Marsden [ kmarsden ] Mike Matrigali [ mikem ]
          Hide
          Kathey Marsden added a comment -

          Oops too early for this. I see Mike already picked this one up. Assigning back to Mike

          Show
          Kathey Marsden added a comment - Oops too early for this. I see Mike already picked this one up. Assigning back to Mike
          Kathey Marsden made changes -
          Assignee Mike Matrigali [ mikem ] Kathey Marsden [ kmarsden ]
          Hide
          Kathey Marsden added a comment -

          Assign to myself temporarily for backport

          Show
          Kathey Marsden added a comment - Assign to myself temporarily for backport
          Mike Matrigali made changes -
          Assignee Bryan Pendleton [ bryanpendleton ] Mike Matrigali [ mikem ]
          Hide
          Mike Matrigali added a comment -

          temporarily assigning issue to myself while backporting to 10.5.

          Show
          Mike Matrigali added a comment - temporarily assigning issue to myself while backporting to 10.5.
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          Kathey Marsden added a comment -

          Reopen for backport.

          Show
          Kathey Marsden added a comment - Reopen for backport.
          Kathey Marsden made changes -
          Link This issue is required by DERBY-4994 [ DERBY-4994 ]
          Kathey Marsden made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Bryan Pendleton made changes -
          Assignee Bryan Pendleton [ bryanpendleton ]
          Bryan Pendleton made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Resolution Fixed [ 1 ]
          Hide
          Bryan Pendleton added a comment -

          Thank you Susumu Ishizuka for the suggestion, and thanks Dag for the review and testing.

          The change seemed to work as expected in my Red Hat Linux environment as well
          (see below), so I committed it to the subversion trunk as revision 826263.

          -bash-2.05b$ ./bin/setEmbeddedCP
          Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable
          to the location of your Derby installation.
          ./bin/setEmbeddedCP: line 23: return: can only `return' from a function or sourced script
          -bash-2.05b$ echo $?
          0
          -bash-2.05b$ . ./bin/setEmbeddedCP
          Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable
          to the location of your Derby installation.
          -bash-2.05b$ echo $?
          1
          -bash-2.05b$ DERBY_HOME=/home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib . bin/setEmbeddedCP
          -bash-2.05b$ echo $?
          0
          -bash-2.05b$ echo $CLASSPATH
          /home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib/lib/derby.jar:/home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib/lib/derbytools.jar:

          Show
          Bryan Pendleton added a comment - Thank you Susumu Ishizuka for the suggestion, and thanks Dag for the review and testing. The change seemed to work as expected in my Red Hat Linux environment as well (see below), so I committed it to the subversion trunk as revision 826263. -bash-2.05b$ ./bin/setEmbeddedCP Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable to the location of your Derby installation. ./bin/setEmbeddedCP: line 23: return: can only `return' from a function or sourced script -bash-2.05b$ echo $? 0 -bash-2.05b$ . ./bin/setEmbeddedCP Error: DERBY_HOME is not set. Please set the DERBY_HOME environment variable to the location of your Derby installation. -bash-2.05b$ echo $? 1 -bash-2.05b$ DERBY_HOME=/home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib . bin/setEmbeddedCP -bash-2.05b$ echo $? 0 -bash-2.05b$ echo $CLASSPATH /home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib/lib/derby.jar:/home/bpendleton/downloads/derby/db-derby-10.1.1.0-bin/lib/lib/derbytools.jar:
          Hide
          Dag H. Wanvik added a comment -

          +1
          The change is compatible with the doc text in
          http://db.apache.org/derby/docs/10.5/getstart/tgs26250.html:

          setEmbeddedCP
          Use the setEmbeddedCP script to set the classpath when the database engine is used in embedded mode.
          This script adds the derby.jar and derbytools.jar files to the classpath.

          Show
          Dag H. Wanvik added a comment - +1 The change is compatible with the doc text in http://db.apache.org/derby/docs/10.5/getstart/tgs26250.html: setEmbeddedCP Use the setEmbeddedCP script to set the classpath when the database engine is used in embedded mode. This script adds the derby.jar and derbytools.jar files to the classpath.
          Hide
          Bryan Pendleton added a comment -

          Is there any controversy here? Seems like we should just make this change.

          Dag, do you see any reason I shouldn't go ahead and commit this change to the trunk?

          Show
          Bryan Pendleton added a comment - Is there any controversy here? Seems like we should just make this change. Dag, do you see any reason I shouldn't go ahead and commit this change to the trunk?
          Dag H. Wanvik made changes -
          Urgency Normal
          Dag H. Wanvik made changes -
          Issue & fix info [Newcomer, Known fix] [Known fix, Newcomer, Repro attached, Workaround attached]
          Hide
          Dag H. Wanvik added a comment -

          Also setting "repro attached" and "workaround attached".

          Show
          Dag H. Wanvik added a comment - Also setting "repro attached" and "workaround attached".
          Hide
          Dag H. Wanvik added a comment -

          As a work-around, the calling shell could test if "DERBY_HOME" has been set before sourcing the
          setEmbeddedCP.

          Show
          Dag H. Wanvik added a comment - As a work-around, the calling shell could test if "DERBY_HOME" has been set before sourcing the setEmbeddedCP.
          Dag H. Wanvik made changes -
          Field Original Value New Value
          Issue & fix info [Known fix, Newcomer]
          Hide
          Dag H. Wanvik added a comment -

          I tried with "return 1" and it did set the status in the sourcing shell, so the condition could be checked,
          so I think the fix suggestion is good, thanks, Susumu.

          Triaged for 10.5.2, setting urgency to "normal", checking "newcomer", "known fix".

          Show
          Dag H. Wanvik added a comment - I tried with "return 1" and it did set the status in the sourcing shell, so the condition could be checked, so I think the fix suggestion is good, thanks, Susumu. Triaged for 10.5.2, setting urgency to "normal", checking "newcomer", "known fix".
          Hide
          Dag H. Wanvik added a comment -

          I am not sure this is a bug; if DERBY_HOME is not set, the CLASSPATH will not be set up correctly,
          and this will be silently ignored if a "return" is used. It is a precondition for using this script that DERBY_HOME has been set up.

          Cf. http://db.apache.org/derby/docs/dev/getstart/tgssetupenvironment.html and
          http://db.apache.org/derby/docs/dev/getstart/tgs26250.html

          Show
          Dag H. Wanvik added a comment - I am not sure this is a bug; if DERBY_HOME is not set, the CLASSPATH will not be set up correctly, and this will be silently ignored if a "return" is used. It is a precondition for using this script that DERBY_HOME has been set up. Cf. http://db.apache.org/derby/docs/dev/getstart/tgssetupenvironment.html and http://db.apache.org/derby/docs/dev/getstart/tgs26250.html
          Susumu Ishizuka created issue -

            People

            • Assignee:
              Bryan Pendleton
              Reporter:
              Susumu Ishizuka
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development