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

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


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

And links without man\d seem to work. Is there any specification that
forbids them?

-- 
  Kacper


More information about the pld-devel-en mailing list