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

Jindrich Novy jnovy at redhat.com
Wed Sep 10 13:51:11 UTC 2008


Hi Pixel,

On Wed, Sep 10, 2008 at 02:43:05PM +0200, Pixel wrote:
> 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)".

thanks for the fix and reproducer. It is now committed.

Jindrich

> 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)
> _______________________________________________
> Rpm-maint mailing list
> Rpm-maint at lists.rpm.org
> https://lists.rpm.org/mailman/listinfo/rpm-maint

-- 
Jindrich Novy <jnovy at redhat.com>   http://people.redhat.com/jnovy/



More information about the Rpm-maint mailing list