dim: Fix substring match
When checking if a url matches one of the urls from the drm_tip_repos array, commit faa12d34 ("dim_setup: Use "repo" for remote default name") used a substring match. However, it's possible that a url is a substring of another, leading to the wrong repo being returned. Depending on the order of iteration in the drm_tip_repo array, ssh://git.freedesktop.org/git/drm/drm would match as a substring of ssh://git.freedesktop.org/git/drm/drm-intel, thus returning drm-intel rather than drm as repo. It doesn't always fail because Bash doesn't guarantee the order of associative arrays. Running with Bash 5.2.15 it works, because it compares drm's url before drm-intel's. However it was reported that with 5.0.17 it doesn't follow the same order, and thus causing this issue. On a dim setup execution, it errors out like this: dim: No git remote for any of the URLs ssh://git.freedesktop.org/git/drm/drm git://anongit.freedesktop.org/drm/drm https://anongit.freedesktop.org/git/drm/drm https://anongit.freedesktop.org/git/drm/drm.git found in /path/to/src Enter a name to auto-add this remote, leave blank to abort: drm-intel error: remote drm-intel already exists. Also, dim should probably start using `set -e`, because the error above is ignored and in the end it shows: dim setup successfully completed! Leaving a half-baked setup. Reported-by:John Harrison <john.c.harrison@intel.com> Fixes: faa12d34 ("dim_setup: Use "repo" for remote default name") Signed-off-by:
Lucas De Marchi <lucas.demarchi@intel.com>
parent
2d919ac6
No related branches found
No related tags found
Showing
Loading
Please register or sign in to comment