Skip to content
Snippets Groups Projects
  1. Nov 09, 2016
  2. Nov 07, 2016
  3. Nov 04, 2016
  4. Nov 03, 2016
  5. Nov 02, 2016
  6. Nov 01, 2016
  7. Oct 31, 2016
  8. Oct 28, 2016
    • Mark Olesen's avatar
      BUG: etc/bashrc incorrect behaviour if sourced locally (issue #280) · b8448671
      Mark Olesen authored
      - It is incorrect to prefix the assignment with an 'export' since this
        automatically marks the overall command as successful and circumvents
        the fallback.
      
        There is no simple way to have proper behaviour when sourced with a
        local directory path, but at least it now uses the fallback.
      
        It is still easy to wreak the mechanism with valid but confusing input.
        For example,
      
           ". /path/to/openfoam/etc/././bashrc"
      
        The only real certainty is that "${BASH_SOURCE%/*}"
        should point to the 'etc/' directory. In which case,
      
            cd ${BASH_SOURCE%/*}    # <- now in the etc/ directory
            pwd=$(pwd -P)           # <- fully-qualified path to etc/
            pwd=${pwd%/*/*}         # <- up two parent levels
      
        - This works with ". ./bashrc", but fails with ". bashrc"
          (probably not so common).
        - Con: The construct requires an additional sub-shell.
      b8448671