Bug 308171 - rpm does check for available space when a filesystem has 0 blocks free
rpm does check for available space when a filesystem has 0 blocks free
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
5
All Linux
low Severity low
: ---
: ---
Assigned To: Panu Matilainen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-26 18:54 EDT by Patrick Bergamin
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version: 4.4.2.2-2.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-24 03:14:09 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 Patrick Bergamin 2007-09-26 18:54:17 EDT
Description of problem:

When installing a rpm that requires space on a filesystem with 0 blocks free,
rpm will not detect that there is insufficient space on the filesystem.

Version-Release number of selected component (if applicable):

The problem was discovered with version rpm-4.4.2-15.2.  I looked at a newer
version of the source (rpm-4.4.2-46).  The newer version still appears to have
the same problem.

How reproducible:

100%

Steps to Reproduce:
1. copy an rpm to test machine
2. fill up filesystem that the rpm needs (ex. cat /dev/zero >> /usr/local/foo)
   ensure there are 0 blocks free (df /usr/local)
3. attempt to install the rpm
   rpm -i <rpm-file>
  
Actual results:

% rpm -i foo.i386.rpm 
error: unpacking of archive failed on file /usr/local/foo.txt;46fc1caa: cpio:
write failed - No space left on device

Expected results:

[root@secfi tmp]# rpm -i foo.i386.rpm 
        installing package foo needs XXXMB on the /usr/local filesystem


Additional info:

The problem appears to be with the function rpmtsCheckDSIProblems()
in lib/rpmts.c.

Here is a suggested diff:

--- a/rpm-4.4.2/lib/rpmts.c     2007-09-26 16:11:00.000000000 -0600
+++ b/rpm-4.4.2/lib/rpmts.c     2007-09-26 16:12:14.000000000 -0600
@@ -1354,14 +1354,14 @@
     ps = rpmtsProblems(ts);
     for (i = 0; i < ts->filesystemCount; i++, dsi++) {
 
-       if (dsi->bavail > 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
+       if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
            rpmpsAppend(ps, RPMPROB_DISKSPACE,
                        rpmteNEVR(te), rpmteKey(te),
                        ts->filesystems[i], NULL, NULL,
           (adj_fs_blocks(dsi->bneeded) - dsi->bavail) * dsi->bsize);
        }
 
-       if (dsi->iavail > 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
+       if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
            rpmpsAppend(ps, RPMPROB_DISKNODES,
                        rpmteNEVR(te), rpmteKey(te),
                        ts->filesystems[i], NULL, NULL,
Comment 1 Panu Matilainen 2007-09-27 03:43:14 EDT
Heh, that bug must've been there since forever.

Fixed upstream and will find it's way to F7 and 8 in not too faraway future,
WONTFIX for FC5 which is EOL. 

Nice catch and thanks for the patch!
Comment 2 Fedora Update System 2007-10-12 16:02:38 EDT
rpm-4.4.2.2-2.fc7 has been pushed to the Fedora 7 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 rpm'
Comment 3 Fedora Update System 2007-10-24 03:13:58 EDT
rpm-4.4.2.2-2.fc7 has been pushed to the Fedora 7 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.