Bug 308171 - rpm does check for available space when a filesystem has 0 blocks free
Summary: rpm does check for available space when a filesystem has 0 blocks free
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 5
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-26 22:54 UTC by Patrick Bergamin
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version: 4.4.2.2-2.fc7
Clone Of:
Environment:
Last Closed: 2007-10-24 07:14:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Patrick Bergamin 2007-09-26 22:54:17 UTC
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 07:43:14 UTC
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 20:02:38 UTC
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 07:13:58 UTC
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.