Bug 585973 - root cache fails to untar with <fail|last>log
Summary: root cache fails to untar with <fail|last>log
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: mock
Version: el5
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-26 14:53 UTC by Clement VARALDI
Modified: 2013-01-10 05:51 UTC (History)
6 users (show)

Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-09-23 04:57:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Clement VARALDI 2010-04-26 14:53:36 UTC
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 22:03:33 UTC
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 07:07:33 UTC
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 13:32:17 UTC
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 13:52:44 UTC
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 14:07:10 UTC
reassigning the project back to Fedora epel and setting the correct component.

Comment 6 Clark Williams 2010-09-11 15:25:00 UTC
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 06:52:34 UTC
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 14:26:28 UTC
Sorry, I meant the files in the chroot, not the actual files on the host system.

Comment 9 Clark Williams 2010-09-13 19:13:51 UTC
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-14 01:20:53 UTC
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 06:42:54 UTC
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 15:58:38 UTC
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 14:35:06 UTC
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 14:35:25 UTC
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 14:42:23 UTC
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 14:43:58 UTC
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 17:53:08 UTC
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 11:47:04 UTC
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 04:56:42 UTC
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 06:16:47 UTC
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 15:44:06 UTC
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 15:46:30 UTC
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 16:14:17 UTC
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 20:04:29 UTC
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-20 02:26:38 UTC
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-20 02:29:45 UTC
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-20 02:32:37 UTC
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-20 02:35:30 UTC
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 08:25:19 UTC
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 08:34:07 UTC
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 20:34:22 UTC
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 20:38:59 UTC
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 20:43:14 UTC
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 20:47:34 UTC
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 20:51:49 UTC
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 04:35:46 UTC
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-25 02:43:06 UTC
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-25 03:17:26 UTC
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 19:07:17 UTC
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 19:17:09 UTC
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.