Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Several Bash scripts in Ratis use this common idiom to discover the current source path and then build relative paths from it:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
This mostly works well, but it isn't compatible with interactive shells using the CDPATH environment variable to provide a custom search path for resolving the directory referenced by cd. (See bash man page discussion of "CDPATH" and how the resolved directory is "written to the standard output.")
The standard solution is to redirect stdout of cd to /dev/null:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
Some Ratis scripts already do this, but not all.
Attachments
Issue Links
- links to