[packages/rpm-build-macros] validate that man links point to something resolveable

Kacper Kornet draenog at pld-linux.org
Tue Mar 26 17:15:13 CET 2013


On Tue, Mar 26, 2013 at 04:08:56PM +0100, Kacper Kornet wrote:
> On Tue, Mar 26, 2013 at 03:55:35PM +0100, Jakub Bogusz wrote:
> > On Tue, Mar 26, 2013 at 03:40:43PM +0100, Kacper Kornet wrote:
> > > On Tue, Mar 05, 2013 at 12:06:12AM +0100, glen wrote:
> > > > commit b012dc654b555d36b557416b2d78f3a98e5c22b9
> > > > Author: Elan Ruusamäe <glen at delfi.ee>
> > > > Date:   Tue Mar 5 01:05:40 2013 +0200

> > > >     validate that man links point to something resolveable

> > > >     for now, links to "outside" current package are not allowed

> > > >  rpm.macros | 8 ++++++++
> > > >  1 file changed, 8 insertions(+)
> > > > ---
> > > > diff --git a/rpm.macros b/rpm.macros
> > > > index d45501c..d7063b0 100644
> > > > --- a/rpm.macros
> > > > +++ b/rpm.macros
> > > > @@ -534,6 +534,14 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}
> > > >  				echo ".so $l" > $a; \
> > > >  				echo >&2 "Converted ${a#$RPM_BUILD_ROOT} from symlink to man link: $l"; \
> > > >  			done; \
> > > > +			# verify that .so links point to existing files (not allowed to point to "other package")
> > > > +			err=$(grep -rl '^\.so ' "$RPM_BUILD_ROOT$i" | while read doc; do \
> > > > +				l=$(cat "$doc"); \
> > > > +				l=${l#.so }; \
> > > > +				# TODO: iterate over all man dirs, but in Th there's only one true man dir \
> > > > +				test -e $RPM_BUILD_ROOT$i/$l || echo "  ${doc#$RPM_BUILD_ROOT} points to inexistent manpage: $l"; \
> > > > +			done); \
> > > > +			test "$err" != "" && { echo >&2 "Man page link errors:"; echo >&2 "$err"; exit 1; }; \
> > > >  			find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
> > > >  		fi; \
> > > >  	done; \


> > > Isn't this check too much restrictive? It breaks around 50 specs:

> > > $ grep -lP "echo '\.so (?!man\d)" *spec | wc -l
> > > 50

> By the way it is a lower limit. There are some more packages that
> internally use the syntax in question. So for example tcl aand tk would
> need to be patched.

> > > And links without man\d seem to work.

> > AFAIK they work with man program (which used to be in PLD) but don't
> > work with man-db.

> It seems to work for me:

> $ rpm -qf `which man`                     
> man-db-2.6.3-1.i686 
> $ cat /usr/share/man/man1/urxvtd.1
> .so urxvtc.1
> $ man -w urxvtd
> /usr/share/man/man1/urxvtc.1.gz

And indeed the NEWS file says it was fixed in man-db 2.6.0

-- 
  Kacper


More information about the pld-devel-en mailing list