Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1216

Use absolute paths in "/tools/fix_perms.sh" script

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.0
    • Fix Version/s: 5.2.1-B2
    • Component/s: Data Management
    • Labels:
      None
    • Change Log Group:
      Fixed
    • Change Log Message:
      The "/tools/fix_perms.sh" script wasn't working, when executed using relative path.
    • Story Points:
      1
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      The way shell scripts under tools/ folder are using relative paths results in absolutely undesired behavior, when they are executed by other scripts.

      In following working example current directory will be "/path/to/in-portal/tools", which is correct.

      cd /path/to/in-portal/tools
      ./fix_perms.sh

      In following working example current directory will be "/path/to/in-portal", which is not correct.

      cd /path/to/in-portal
      ./tools/fix_perms.sh

      After digging a bit on the Internet I've found a solution, that finds absolute path to folder, where executed script is actually located:

      SCRIPT_FOLDER=`cd $(dirname $0); pwd`

      Also these scripts missing #!/bin/sh at the top of the script.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
                Reviewer:
                Dmitry Andrejev [Intechnic]
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: