[Rpm-maint] corrupted cpio in case of hardlink on symlink

Pixel pixel at mandriva.com
Wed Sep 10 12:43:05 UTC 2008


there is a bug in rpmbuild triggered by hardlink on softlink.
ie things like:

lrwxrwxrwx 2 pixel pixel 1 Sep 10 13:28 b -> a
lrwxrwxrwx 2 pixel pixel 1 Sep 10 13:28 c -> a

the cpio generated by rpmbuild is broken.

suggested fix:

  replace 
    !S_ISDIR(st->st_mode) && st->st_nlink > 1
  with
    S_ISREG(st->st_mode) && st->st_nlink > 1
  in lib/fsm.c

rationale: in build/files.c, the 2 ocurrences of "flp->fl_nlink > 1"
are protected by "S_ISREG(flp->fl_mode)".

here is a test case:

----------
Summary: x
Name: a
Version: 1
Release: 1
License: x
Group: x
Url: x

%description
x

%install
rm -rf %buildroot
install -d %buildroot/etc
cd %buildroot/etc
ln -s a b
ln b c

%files
/etc/*
----------

another fix would be:
   !(S_ISDIR(st->st_mode) || S_ISLNK(st->st_mode))

(as done in jbj's rpm, but only at one place, hence the test case is
still failing: /etc/a /etc/b are not in the cpio)



More information about the Rpm-maint mailing list