Derby
  1. Derby
  2. DERBY-4500

CLASSPATH scripts should not exit on error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.3.0
    • Fix Version/s: 10.5.3.2, 10.6.1.0
    • Component/s: Demos/Scripts
    • Labels:
      None
    • Environment:
      Unix platforms.
    • Urgency:
      Low
    • Issue & fix info:
      Known fix

      Description

      This applies to the following
      setEmbeddedCP
      setNetworkServerCP
      setNetworkClientCP

      Bug DERBY-4283 references this issue, but only with regard to the setEmbeddedCP script. That bug also indicates the issue was resolved in 10.5.2, but I am looking at 10.5.3 and I still see the exit command in the script.

      The proper way to use these CLASSPATH scripts is to source them rather than run them.
      . $DERBY_HOME/bin/setNetworkServerCP

      Doing so will run the script in the current shell. If the scripts issue an exit upon encountering an error, then the users shell will exit as well.

      This is the relevant section of 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 #<<<<This will exit the users shell if the script is sourced
      fi

      The scripts should generate a message if DERBY_HOME is not set, but should not issue an exit command.

      1. patch.diff
        1.0 kB
        Bryan Pendleton

        Issue Links

          Activity

          John Storta Jr. created issue -
          Hide
          John Storta Jr. added a comment -

          The simple fix for this would be to change the exit command to a return command. This will return the script to the user's shell with the indicated return code, but will not exit the shell itself.

          Here is the relevant code.
          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."
          return 1 #This will return a code of '1' to the users shell without exiting the shell
          fi

          Show
          John Storta Jr. added a comment - The simple fix for this would be to change the exit command to a return command. This will return the script to the user's shell with the indicated return code, but will not exit the shell itself. Here is the relevant code. 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." return 1 #This will return a code of '1' to the users shell without exiting the shell fi
          John Storta Jr. made changes -
          Field Original Value New Value
          Issue & fix info [Known fix]
          Bryan Pendleton made changes -
          Assignee Bryan Pendleton [ bryanpendleton ]
          Hide
          Bryan Pendleton added a comment -

          Attached 'patch.diff' extends the change made by DERBY-4283
          to setNetworkClientCP and setNetworkServerCP

          Show
          Bryan Pendleton added a comment - Attached 'patch.diff' extends the change made by DERBY-4283 to setNetworkClientCP and setNetworkServerCP
          Bryan Pendleton made changes -
          Attachment patch.diff [ 12429351 ]
          Hide
          Bryan Pendleton added a comment -

          Thanks for tracking this down, John. I've made the corresponding changes
          and committed them to the Derby trunk as subversion revision 895666.

          Show
          Bryan Pendleton added a comment - Thanks for tracking this down, John. I've made the corresponding changes and committed them to the Derby trunk as subversion revision 895666.
          Bryan Pendleton made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Link This issue is required by DERBY-4994 [ DERBY-4994 ]
          Hide
          Kathey Marsden added a comment -

          Reopen for backport

          Show
          Kathey Marsden added a comment - Reopen for backport
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Mike Matrigali added a comment -

          temp assigning to myself for 10.5 backport.

          Show
          Mike Matrigali added a comment - temp assigning to myself for 10.5 backport.
          Mike Matrigali made changes -
          Assignee Bryan Pendleton [ bryanpendleton ] Mike Matrigali [ mikem ]
          Hide
          Mike Matrigali added a comment -

          backported to 10.5. resolving issue and resetting original owner.

          Show
          Mike Matrigali added a comment - backported to 10.5. resolving issue and resetting original owner.
          Mike Matrigali made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Fix Version/s 10.5.3.2 [ 12315436 ]
          Resolution Fixed [ 1 ]
          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.
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12485820 ] Default workflow, editable Closed status [ 12802686 ]

            People

            • Assignee:
              Mike Matrigali
              Reporter:
              John Storta Jr.
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development