alien crashes when trying to convert an RPM containing %ghost files

Bug #507326 reported by Ben Webb
34
This bug affects 4 people
Affects Status Importance Assigned to Milestone
alien (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: alien

When trying to convert any RPM that contains one or more files marked (in the RPM specfile) with %ghost, alien fails with a message similar to
chown: cannot access 'foo/bar': No such file or directory
failed chowning bar to 0:0: Illegal seek at /usr/share/perl5/Alien/Package/Rpm.pm line 265, <GETPERMS> line 1.

where 'foo' is the name of the RPM package and 'bar' the pathname of the first file marked with %ghost. (I would expect instead that alien would complete with no errors, and generate a .deb file corresponding to the input .rpm.)

This occurs in:
Ubuntu release: 9.10 (32-bit, although I expect the problem to occur on all archs)
Package version: alien 8.78

To demonstrate, build a test RPM using the attached spec file, ghost.spec. (rpmbuild -ba ghost.spec; generates ghost-1.0-1.noarch.rpm). This RPM contains two files - a "real" file /etc/real and a "ghost" file /etc/ghost.

Next, attempt to convert to .deb with
$ fakeroot alien ghost-1.0-1.noarch.rpm

This fails with
chown: cannot access 'ghost-1.0//etc/ghost': No such file or directory
failed chowning /etc/ghost to 0:0: Illegal seek at /usr/share/perl5/Alien/Package/Rpm.pm line 265, <GETPERMS> line 1.

The failure occurs because alien, after unpacking the cpio archive containing the actual file contents, attempts to set the permissions and ownership on each file using information in the RPM header. %ghost files are not installed by RPM, so are in the RPM header but not the cpio archive, and so any attempt to chown/chmod these files will fail.

The attached patch (alien-ghost.patch) modifies Rpm.pm to check each file for existence before chown/chmod, and resolves the issue for me.

Revision history for this message
Ben Webb (ben-salilab) wrote :
Revision history for this message
Ben Webb (ben-salilab) wrote :
Revision history for this message
Cocodude (marc-indivisibilities) wrote :

Excellent - this solves the issue I have with using alien on some SLES 11 kernels.

The patch worked a treat. I haven't tested extensively, but it at least works on the kernel-xen-base package at ftp://ftp.suse.com/pub/projects/kernel/kotd/SLE11_BRANCH/ for x64.

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Fixed in Maverick:

alien (8.81) unstable; urgency=low

   * Avoid uninitialized value warning when debian/rules fails to run
     due to alien being run in a noexec directory. Closes: #579216
   * Prevent DESTROY stomping on alien's exit code sometimes.
   * Support extracting lzma compressed RPMs.
     (Patch by unnamed person on some bug tracking system I don't frequent.)
   * Suggest lzma. If not installed, alien will still fail to decompress
     RPMs using it, but will support most rpms, which are not.
   * Fix precedence problem that prevented alien from preserving permissions
     of suid/sgid binaries that are not owned by root.
     (Patch by Duane Waddle, on a bug tracking system I don't frequent, that
     was about the "expire" it 4 days from now. We got lucky Duane, but please
     use the Debian BTS next time!)
   * Support RPMs containing ghost files.
     (Patch by Ben Webb, who would get his patches applied quicker if he
     actually communicated them to the program's author.)

 -- Joey Hess <email address hidden> Mon, 17 May 2010 20:56:59 -0400

Changed in alien (Ubuntu):
status: New → Fix Released
Revision history for this message
scm (scm) wrote :

This bug affects functionality of a self-contained software-package (alien), contains a patch that works cleanly on the lucid version (8.79) and seems unlikely to inadvertently affect users as the current behavior is incorrect. I therefore would like to see this fixed in lucid and have nominated the bug.

Revision history for this message
scm (scm) wrote :

SRU: minimal patch for Lucid is attached.

This fix is from Maverick and has been tested on Lucid.

# Before (alien 8.79)
$ fakeroot alien ghost-1.0-1.noarch.rpm
error: incorrect format: unknown tag
chown: cannot access `ghost-1.0//etc/ghost': No such file or directory
failed chowning /etc/ghost to 0:0: Illegal seek at /usr/share/perl5/Alien/Package/Rpm.pm line 265, <GETPERMS> line 1.

# After (alien 8.79ubuntu1)
$ fakeroot alien ghost-1.0-1.noarch.rpm
error: incorrect format: unknown tag
ghost_1.0-2_all.deb generated

Revision history for this message
Martin Pitt (pitti) wrote :

SRU ack, please upload. I subscribed the sponsor team.

tags: added: patch-accepted-debian
Changed in alien (Ubuntu Lucid):
assignee: nobody → Andrew Starr-Bochicchio (andrewsomething)
Changed in alien (Ubuntu Lucid):
assignee: Andrew Starr-Bochicchio (andrewsomething) → nobody
Revision history for this message
Benjamin Drung (bdrung) wrote :

uploaded with small changes:
* version: 8.79ubuntu1 -> 8.79ubuntu0.1
* distribution: lucid -> lucid-proposed
* update-maintainer

Changed in alien (Ubuntu Lucid):
status: New → Fix Committed
Revision history for this message
Jonathan Riddell (jr) wrote : Please test proposed package

Accepted into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
scm (scm) wrote :

I have tested that this works for me in Lucid:

scm@scm:/tmp$ dpkg -l alien
ii alien 8.79ubuntu0.1 convert and install rpm and other packages

scm@scm:/tmp$ fakeroot alien ghost-1.0-1.noarch.rpm
ghost_1.0-2_all.deb generated

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package alien - 8.79ubuntu0.1

---------------
alien (8.79ubuntu0.1) lucid-proposed; urgency=low

  * Fix for rpm with ghost files branched to lucid from 8.81 (maverick).
    LP: #507326
 -- Chuck McIntyre <email address hidden> Thu, 01 Jul 2010 15:00:06 -0700

Changed in alien (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.