SUSE / rmt

RPM repository mirroring tool and registration proxy for SUSE Customer Center.
Other
37 stars 46 forks source link

Offline import repos fail with files that included the special symbol(s) #1043

Closed st-man closed 8 months ago

st-man commented 8 months ago

We're use the rmt-server docker for servers registrations (SLES15-SP5) When we use the PachckageHub repository (rmt-cli enable product 2562) on the main RMT (connected the Internet and update channles) the mirror of the repos works fine (eg. rmt-cli miror repos 6113) Then we import (settings, data & repos) to the external device and attach it to the offline (air-gap) server with docker rmt-server:latest container rmt-cli import repos [/path/to/the/external/device] works fine with all enabled products and repositories, except 6113 (SUSE-PackageHub-15-SP5-Backports-Pool for sle-15-x86_64). After discover the error we find that: W, [... #5993] WARN -- : Error while mirroring packages: bad URI(is not URI?): "rpm/x86_64_GA/app-builder-3.4.2^20220309g4e2aa6a1-bp155.1.15.x86_64.rpm"

File name _app-builder-3.4.2^20220309g4e2aa6a1-bp155.1.15.x8664.rpm contain the special symbol "^" (%5E) and URI.join (@remote_path = URI.join(base_url, relative_path) return the error, because rfc3986_parser.rb don't works with "^" in relative_path

base_url = "file:///path/to/the/external/device/public/repo/SUSE/Backports/SLE-15-SP5_x86_64/standard/" relative_path = "rpm/x86_64_GA/app-builder-3.4.2^20220309g4e2aa6a1-bp155.1.15.x86_64.rpm"

We resolved the issue and wrote the patch:

The current ruby-3.2 (from docker) rfc3986_parser.rb patch in attach rfc3986_parser.patch.gz

The upstream https://github.com/ruby/ruby/blob/master/lib/uri/rfc3986_parser.rb patch:

But, may be we need to use the patch for file_reference.rb?

st-man commented 8 months ago

UPDATES: Found the diff between the file_reference.rb on docker rmt (2.13) and sle rmt (2.14)