Commits on Source 1

  • Stan Hu's avatar
    Fix shell executor not working with variables that use file variables · b5e9c6d0
    Stan Hu authored
    When using the shell executor, file variables that reference other
    file variables (e.g., MY_FILE_VAR: $FILE_TEST) were incorrectly
    getting a $PWD/ prefix, resulting in paths like:
    
    $PWD/$FILE_TEST
    
    This caused "No such file or directory" errors because the shell would
    not expand the nested variable reference correctly.
    
    The root cause was that the shell executor was using relative paths for
    BuildDir (e.g., "builds/...") instead of absolute paths. This caused the
    following chain of issues:
    
    1. TmpProjectDir() returns a relative path
    2. When creating file variables, TmpFile() -> Absolute() prepends
       $PWD/ to relative paths
    3. File variables get paths like $PWD/builds/.../FILE_TEST
    4. When MY_FILE_VAR: $FILE_TEST is processed, the literal string
       $FILE_TEST doesn't match the temp file check
    5. It also goes through Absolute() and becomes $PWD/$FILE_TEST
    
    The fix ensures DefaultBuildsDir and DefaultCacheDir are converted
    to absolute paths during the Prepare() phase by joining them with
    the current working directory if they are relative.
    
    This makes the shell executor behavior consistent with the Docker
    executor, which already uses absolute paths.
    
    This was a regression introduced by
    !5912.
    
    Relates to #39124
    
    Changelog: fixed
    b5e9c6d0
Loading
Loading