Bug 1776399

Summary: modifyrepo no longer works with modules.yaml as a symbolic link
Product: Red Hat Enterprise Linux 8 Reporter: Paul Dwyer <pdwyer>
Component: createrepo_cAssignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact: Radek Bíba <rbiba>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: amatej, lberton, mblaha
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: createrepo_c-0.15.1-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 15:39:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Dwyer 2019-11-25 15:43:46 UTC
Description of problem:
modifyrepo no longer works with modules.yaml as a symbolic link

Version-Release number of selected component (if applicable):
createrepo_c-0.11.0-3.el8.x86_64

How reproducible:
always

Steps to Reproduce:
1. Create symlink for modules.yaml that points to modules.yaml file in different directory
2. run "modifyrepo ./updateinfo.xml ./repodata"


Actual results:
# modifyrepo ./modules.yaml ./repodata
Cannot open ./modules.yaml: No such file or directory

Expected results:
modifyrepo to open modules.yaml file and not to try and detect compression type on the symlink

Additional info:
This used to work on createrepo_c-0.11.0-1
Looks like this changed with patch to fix bz 1639287

Running the modifyrepo command with verbose option

10:16:17: Version: 0.11.0 (Features: DeltaRPM LegacyWeakdeps )
10:16:17: Preparing task for: ./modules.yaml
10:16:17: Task: [path: ./modules.yaml, type: (null), remove: 0, compress: 1, compress_type: 1 ((null)), unique_md_filenames: 1, checksum_type: 0 (Unknown checksum), new_name: (null)]
10:16:17: cr_modifyrepo: Use derived type "modules" (modules)
10:16:17: cr_detect_compression: Detected mime type: inode/symlink; charset=binary (./modules.yaml)
10:16:17: cr_modifyrepo: Copy & compress operation ./modules.yaml -> ./temprepo/modules.yaml.gz
10:16:17: cr_detect_compression: Detected mime type: inode/symlink; charset=binary (./modules.yaml)
10:16:17: cr_sopen: Cannot detect compression type
10:16:17: cr_compress_file_with_stat: Cannot open source file ./modules.yaml (No such file or directory)
10:16:17: cr_modifyrepo: Copy & compress operation failed
Cannot open ./modules.yaml: No such file or directory

Fails to detect compression type, checking through the code patch for bz 1639287 changes fopen for a cr_open function where compression detection takes place.

Change in misc.c to a cr_open function instead of fopen on the file (which would work correctly with a symlink)

0002-modifyrepo_c-Prevent-doubling-of-compression-testgzgz-RhBug1639287.patch

diff --git a/src/misc.c b/src/misc.c
index 9937480..c5ccd12 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -437,7 +437,7 @@ cr_compress_file_with_stat(const char *src,
...
-    orig = fopen(src, "rb");
+    orig = cr_open(src, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err);

Comment 9 errata-xmlrpc 2020-04-28 15:39:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1620