Bug 1001553

Summary: error reading from file in case if rpm has only one file within
Product: [Fedora] Fedora Reporter: Artem <p01ar>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: caolanm, ffesti, jzeleny, mstahl, novyjindrich, packaging-team-maint, pknirsch, pmatilai
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.11.1-3.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-11 02:05:55 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:
Attachments:
Description Flags
rpm for reproducing the issue none

Description Artem 2013-08-27 09:30:27 UTC
Description of problem:
In case if I try to install the rpm which is consists from only one file to the specific directory with doubled slashes in the path, then I'll get the error.
But if I remove the duplicate slash from the prefix path or choose the package with two or more files then no any errors will apear.
 
Version-Release number of selected component (if applicable):
RPM version 4.11.0.1

How reproducible: always

Steps to Reproduce:
1. Create the rpm with one file within.
2. Run the rpm install with following command:

[root@nntclxxx rpm]# rpm -i --nodeps --prefix="/opt/aaa//bbb" "intel-mkl-pgi-devel-080-11.1-0.x86_64.rpm"

Actual results: Following error appeared: 
"error: error reading from file intel-mkl-pgi-devel-080-11.1-0.x86_64.rpm"

Expected results: The rpm installed w/o any errors.

Additional info: This bug cannot be reproduced on other OS'es.

Comment 1 Artem 2013-08-27 09:40:26 UTC
The problem can be reproduced not only with prefix with double slash, for example it can be reproooodduced with following command:

rpm -i --nodeps --prefix="/opt/aaa" "intel-mkl-pgi-devel-080-11.1-0.x86_64.rpm"

But the following command installs rpm w/o errors:

rpm -i --nodeps --prefix="/opt/aaa/bbb" "intel-mkl-pgi-devel-080-11.1-0.x86_64.rpm"

Comment 2 Panu Matilainen 2013-08-27 09:47:45 UTC
Can you provide a pointer to the reproducer package?

Comment 3 Artem 2013-08-27 10:34:55 UTC
Created attachment 790884 [details]
rpm for reproducing the issue

The RPM for reproducing the issue was attached.

Comment 4 Panu Matilainen 2013-08-27 11:36:27 UTC
Okay, easily reproduced with that, thanks. The problem starts with this commit (between rpm 4.9.x and 4.10.x):

commit 502d07cf24fda57fdf0998a220b1a1176dadd985
Author: Panu Matilainen <pmatilai>
Date:   Sat Jan 28 17:53:11 2012 +0200

    Test for filename triplet sanity in rpmfiNew()
    
    - Basename and dirindex counts must be equal, dirnames count must be
      larger than zero and no larger than number of basenames. Check
      that directory indexes are within range.
    - There are mountains of further checks to be added here (and elsewhere)
      but we gotta start somewhere... and filename triplets are one of the more
      critical elements we got.

In other words, its tripping up on this new sanity check when relocating, which suggests a bug in the relocation code. By the look of things, the relocation bug is old as ages but as its mostly harmless in that it just leaves an "orphan"  (ie unused) directory name in the header nobody has noticed it prior to the sanity check.

Comment 6 Michael Stahl 2013-09-02 10:44:00 UTC
ran into this problem too, i've even tracked it down to the indexSane function some weeks ago but then totally forgot about the problem :(

this is why one can't install LibreOffice upstream RPM releases 
on Fedora 19 with the user-install script, which uses rpm --relocate;
the (first) failure is on the libreoffice4.0-base RPM which contains
a single file.

with the commit from comment #5 it works again, thanks!

Comment 7 Fedora Update System 2013-09-09 12:42:30 UTC
rpm-4.11.1-7.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/rpm-4.11.1-7.fc20

Comment 8 Fedora Update System 2013-09-09 12:44:33 UTC
rpm-4.11.1-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/rpm-4.11.1-2.fc19

Comment 9 Fedora Update System 2013-09-09 23:58:48 UTC
Package rpm-4.11.1-3.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rpm-4.11.1-3.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-16239/rpm-4.11.1-3.fc19
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-09-11 02:05:55 UTC
rpm-4.11.1-3.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2013-09-23 00:16:15 UTC
rpm-4.11.1-7.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.