Bug 1686812

Summary: Tempfile ignores umask for files created in createrepo cache.
Product: Red Hat Enterprise Linux 8 Reporter: Karel Srot <ksrot>
Component: createrepo_cAssignee: amatej
Status: CLOSED ERRATA QA Contact: Luca Berton <lberton>
Severity: low Docs Contact:
Priority: low    
Version: 8.2CC: amatej, lberton, myllynen
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: createrepo_c-0.15.10-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 833350 Environment:
Last Closed: 2020-11-04 03:09:16 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 Karel Srot 2019-03-08 11:35:52 UTC
createrepo_c is having this issue too.

createrepo_c-0.11.0-1.el8.x86_64


:: [ 06:29:08 ] :: [  BEGIN   ] :: Generating repo metadata :: actually running 'bash -c 'umask 0002 && createrepo -c /tmp/tmp.rkA83nwXAE/cache repo''
Directory walk started
Directory walk done - 1 packages
Temporary output repo path: repo/.repodata/
Preparing sqlite DBs
Pool started (with 5 workers)
Pool finished
:: [ 06:29:08 ] :: [   PASS   ] :: Generating repo metadata (Expected 0, got 0)
-rw-------. 1 root root 64 Mar  8 06:29 cache/bz833350dummy-pkg-1.0-1.noarch.rpm-37e327073aedc5ea16e9133344b944c73b43c5ff5dc3f6c5ecfb90b76c381e6a-0-1552044548
:: [ 06:29:08 ] :: [  BEGIN   ] :: Checking that cache file has 664 permissions :: actually running 'stat -c '%a' cache/bz833350dummy-pkg* | grep -q '664''
:: [ 06:29:08 ] :: [   FAIL   ] :: Checking that cache file has 664 permissions (Expected 0, got 1)


+++ This bug was initially created as a clone of Bug #833350 +++

Description of problem:
createrepo ignores umask for cachedir causing issues when more than one user are updating repositories:

localhost:~> umask 0002
localhost:~> mkdir -p foo/cache foo/repo
localhost:~> cp test.rpm foo/repo/
localhost:~> createrepo -q -c $HOME/foo/cache foo/repo
localhost:~> ls -al $HOME/foo/cache
total 12K
drwxrwxr-x. 2 testuser testuser 4.0K 2012-06-19 12:29 .
drwxrwxr-x. 4 testuser testuser 4.0K 2012-06-19 12:28 ..
-rw-------. 1 testuser testuser   64 2012-06-19 12:29 test.rpm-a015e8240f41d24ae54e37e3ceb4321dea35be5d51aef1e366ea42f1d537ee34d-1386895-1340099211
localhost:~> ls -al $HOME/foo/repo/repodata/primary.xml.gz 
-rw-rw-r--. 1 testuser testuser 961 2012-06-19 12:29 /home/mmyllyne/foo/repo/repodata/primary.xml.gz
localhost:~> 

Version-Release number of selected component (if applicable):
createrepo-0.9.8-5.el6.noarch

Comment 2 amatej 2019-10-10 13:08:33 UTC
I have created a PR that should fix this and unify behavior with original createrepo.

https://github.com/rpm-software-management/createrepo_c/pull/179

I have also created a CI test however only locally so far, because our CI isn't ready for createrepo_c tests yet. I will post the link to the test once our CI is prepared.

Comment 3 amatej 2020-01-06 14:28:53 UTC
Here is the link to a PR with CI tests https://github.com/rpm-software-management/ci-dnf-stack/pull/752

Comment 12 errata-xmlrpc 2020-11-04 03:09:16 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 (createrepo_c bug fix and enhancement update), 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/RHEA-2020:4700