Skip to content

Commit

Permalink
Fix trailing / when downloading stage2 image
Browse files Browse the repository at this point in the history
In Dracut the URL concatenation from .treeinfo could also point you to
directory above by `..`. However, if the `inst.repo=` argument was
set with trailing `/` it will create URL which is not supported by curl.

Supported:
`os/../BaseOS/`
Unsupported by curl:
`os//../BaseOS/`

Remove the trailing `/` to avoid this issue.

Resolves: RHEL-48821
  • Loading branch information
jkonecny12 committed Jul 16, 2024
1 parent 2a2817e commit 89fd44c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dracut/anaconda-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ anaconda_net_root() {
local repo="$1"
info "anaconda: fetching stage2 from $repo"

# Remove last `/` from repo to enable cunstructs like ...os/../BaseOS/image/install.img
# Otherwise curl will fail to work with `...os//../BaseOS...`
repo=${repo%/}

# Try to get the local path to stage2 from treeinfo.
treeinfo=$(fetch_url "$repo/.treeinfo" 2> /tmp/treeinfo_err) && \
stage2=$(config_get stage2 mainimage < "$treeinfo")
Expand Down

0 comments on commit 89fd44c

Please sign in to comment.