Bug 585973 - root cache fails to untar with <fail|last>log
root cache fails to untar with <fail|last>log
Status: CLOSED ERRATA
Product: Fedora EPEL
Classification: Fedora
Component: mock (Show other bugs)
el5
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-26 10:53 EDT by Clement VARALDI
Modified: 2013-01-10 00:51 EST (History)
6 users (show)

See Also:
Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-09-23 00:57:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Clement VARALDI 2010-04-26 10:53:36 EDT
Description of problem:
When building a (s)RPM, root cache id built, including files like:
/var/log/faillog
/var/log/lastlog

Those "special files" make tar xf fail when unpacking newly built root_cache file.


Version-Release number of selected component (if applicable):
mock 1.0.2-1.el5
tar 1.15.1-23.0.1.el5
build machine: rhel5.4 x86_64

How reproducible:
mostly (curiously) on monday when people are back to work


Steps to Reproduce:
* remove root_cache file,
* build a RPM with:
mock -r rhel-5-x86_64 --buildsrpm --spec=SPECS/<...>.spec --sources=SOURCES/ --resultdir=SRPMS
(quite long)
* rebuild it (same command line)
(quite long)

error retrieved:
DEBUG util.py:280:  Executing command: ['tar', '--use-compress-program', 'gzip', '-xf', '/var/cache/mock/rhel-5-x86-64/root_cache/cache.tar.gz', '-C', '/var/lib/mock/rhel-5-x86-64-<...>/root/']
DEBUG util.py:256:  tar: ./var/log/faillog: Wrote only 4096 of 10240 bytes
DEBUG util.py:256:  tar: Skipping to next header
DEBUG util.py:256:  tar: ./var/lib/mock/rhel-5-x86-64-<...>/root/var/lib/yum/transaction-all.2010-04-26.16\:10.45: Cannot write: No space left on device
DEBUG util.py:319:  Child returncode was: 2  
Actual results:


Expected results:

DEBUG util.py:280:  Executing command: ['tar', '--use-compress-program', 'gzip', '-xf', '/var/cache/mock/rhel-5-x86-64/root_cache/cache.tar.gz', '-C', '/var/lib/mock/r
hel-5-x86-64/root/']
DEBUG util.py:319:  Child returncode was: 0
DEBUG util.py:57:  ensuring that dir exists: /var/lib/mock/rhel-5-x86-64/root/var/cache/yum


Additional info:

A dirty workaround we added to let people continue to build the RPMs:
in: /usr/lib/python2.4/site-packages/mock/plugins/
[...]
.. ["tar"] + self.compressArgs + ["-cf", self.rootCacheFile,
... "-C", self.rootObj.makeChrootPath(),
... "--exclude", ".*var/log/lastlog",
... "--exclude", ".*var/log/faillog",
... "."],
.. shell=False
Comment 1 Clark Williams 2010-05-24 18:03:33 EDT
are /var/log/lastlog and /var/log/faillog sparse files?

Sounds like we should nuke those files before creating the cache image...
Comment 2 Clement VARALDI 2010-05-25 03:07:33 EDT
Hi,

they are.

The trouble is packages actually "can" use those files, so we can nuke them but when untaring files, we might have to re-create them...
Comment 3 Matt Wringe 2010-05-25 09:32:17 EDT
Please note that mockobjects is a java testing utility and has nothing to do with this issue.

There does not appear to be a mock component selectable for rhel 5 in this bugzilla. Where did you get the mock rpm from?
Comment 4 Clement VARALDI 2010-05-25 09:52:44 EDT
Hi

I don't remember having reported this bug on mockobjects but rather on Fedora/mock.
Could you please change the product/component? (I don't have the permissions to do it)
Thanks


Anyway, here are the information requested:
# rpm -qi mock
Name        : mock                         Relocations: (not relocatable)
Version     : 1.0.2                             Vendor: Fedora Project
Release     : 1.el5                         Build Date: Wed 23 Dec 2009 11:50:56 PM CET
Install Date: Thu 28 Jan 2010 09:21:21 AM CET      Build Host: localhost
Group       : Development/Tools             Source RPM: mock-1.0.2-1.el5.src.rpm
Size        : 0                                License: GPLv2+
Signature   : DSA/SHA1, Thu 28 Jan 2010 09:16:29 AM CET, Key ID 6de4113d19e1a11f
Packager    : Fedora Project
URL         : http://fedoraproject.org/wiki/Projects/Mock
Summary     : Builds packages inside chroots
Description :
Mock takes a srpm and builds it in a chroot

taken on
Comment 5 Matt Wringe 2010-05-25 10:07:10 EDT
reassigning the project back to Fedora epel and setting the correct component.
Comment 6 Clark Williams 2010-09-11 11:25:00 EDT
What about truncating both /var/log/lastlog and /var/log/faillog to empty files before creating the cache?
Comment 7 Clement VARALDI 2010-09-13 02:52:34 EDT
That might sound like a good idea but truncating (at least) the faillog file on the server would erase all information from pam_tally, which is against our security policies...
Comment 8 Clark Williams 2010-09-13 10:26:28 EDT
Sorry, I meant the files in the chroot, not the actual files on the host system.
Comment 9 Clark Williams 2010-09-13 15:13:51 EDT
Looking at adding the patch below. This will truncate both lastlog and faillog files in the chroot directory, before the cache tarball is created. 

Make sense?

diff --git a/py/mock/plugins/root_cache.py b/py/mock/plugins/root_cache.py
index 007627c..6a3ca1a 100644
--- a/py/mock/plugins/root_cache.py
+++ b/py/mock/plugins/root_cache.py
@@ -106,6 +106,11 @@ class RootCache(object):
             for tmp in glob(self.rootObj.makeChrootPath('var/lib/rpm/__db*')):
                 os.unlink(tmp)
 
+            # truncate the sparse files in /var/log
+            for logfile in ('/var/log/lastlog', '/var/log/faillog'):
+                f = open(self.rootObj.makeChrootPath(logfile), "w")
+                f.truncate(0)
+                f.close()
             
             # never rebuild cache unless it was a clean build.
             if self.rootObj.chrootWasCleaned:
Comment 10 Nico Kadel-Garcia 2010-09-13 21:20:53 EDT
I just reported this in bug 633435, which can be marked as a duplicate, and in fact submitted the same patch there as here, to exclude those files from the tarball.

To the idea of zeroing the files: why bother zeroing and invalidating a file that you can simply exclude?
Comment 11 Clement VARALDI 2010-09-14 02:42:54 EDT
about your zeroing files, the fact is (tell me if I'm wrong) we can't truncate "root faillog" (but we can truncate the chroot one).

Reading the diff, it seems that for the sparse files, you *create* new ones inside the chroot env when creating the root cache? If that's the case then it looks fine :)
Comment 12 Clark Williams 2010-09-16 11:58:38 EDT
yes, the intend is to create empty files in the chroot. That way anyone that depends on their existence will work and we're not paying a huge size penalty for a couple of sparse files. 

Queue for next release
Comment 13 Fedora Update System 2010-09-20 10:35:06 EDT
mock-1.1.5-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.5-1.fc14
Comment 14 Fedora Update System 2010-09-20 10:35:25 EDT
mock-1.1.5-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.5-1.fc13
Comment 15 Fedora Update System 2010-09-20 10:42:23 EDT
mock-1.0.12-1.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/mock-1.0.12-1.fc12
Comment 16 Fedora Update System 2010-09-20 10:43:58 EDT
mock-1.0.12-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.12-1.el5
Comment 17 Fedora Update System 2010-09-20 13:53:08 EDT
mock-1.0.12-1.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mock-1.0.12-1.el5
Comment 18 Clement VARALDI 2010-09-21 07:47:04 EDT
Hi,

tested, and it seems to work as expected:

# tar ztvf cache.tar.gz | egrep "/var/log/(fail|last)log"
-rw-r--r-- root/root               0 2010-09-21 12:23:58 ./var/log/lastlog
-rw------- root/root               0 2010-09-21 12:23:58 ./var/log/faillog
Comment 19 Fedora Update System 2010-09-23 00:56:42 EDT
mock-1.1.5-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 20 Fedora Update System 2010-09-30 02:16:47 EDT
mock-1.1.5-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 21 Fedora Update System 2010-10-20 11:44:06 EDT
mock-1.0.13-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.13-1.el5
Comment 22 Fedora Update System 2010-10-20 11:46:30 EDT
mock-1.0.13-1.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/mock-1.0.13-1.fc12
Comment 23 Fedora Update System 2010-12-14 11:14:17 EST
mock-1.0.14-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.14-1.el5
Comment 24 Fedora Update System 2011-01-18 15:04:29 EST
mock-1.0.15-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.15-1.el5
Comment 25 Fedora Update System 2011-02-19 21:26:38 EST
mock-1.1.9-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc13
Comment 26 Fedora Update System 2011-02-19 21:29:45 EST
mock-1.0.16-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.16-1.el5
Comment 27 Fedora Update System 2011-02-19 21:32:37 EST
mock-1.1.9-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.el6
Comment 28 Fedora Update System 2011-02-19 21:35:30 EST
mock-1.1.9-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc14
Comment 29 Fedora Update System 2011-03-03 03:25:19 EST
mock-1.1.9-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 30 Fedora Update System 2011-03-03 03:34:07 EST
mock-1.1.9-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 31 Fedora Update System 2011-05-13 16:34:22 EDT
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15
Comment 32 Fedora Update System 2011-05-13 16:38:59 EDT
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14
Comment 33 Fedora Update System 2011-05-13 16:43:14 EDT
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5
Comment 34 Fedora Update System 2011-05-13 16:47:34 EDT
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13
Comment 35 Fedora Update System 2011-05-13 16:51:49 EDT
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6
Comment 36 Fedora Update System 2011-05-19 00:35:46 EDT
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 37 Fedora Update System 2011-05-24 22:43:06 EDT
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 38 Fedora Update System 2011-05-24 23:17:26 EDT
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 39 Fedora Update System 2011-06-02 15:07:17 EDT
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 40 Fedora Update System 2011-06-02 15:17:09 EDT
mock-1.1.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.