[Rpm-maint] [PATCH] Link testing/usr/bin to testing/bin.

Panu Matilainen pmatilai at laiskiainen.org
Tue Jan 3 11:57:27 UTC 2017

Hi, and sorry about the very late response. This I remember seeing a 
patch from you but it got buried in other noise and then when I tried to 
look for it later I couldn't find it and then there was an earthquake 
and a fire and ... I mean x-mas and holidays and all.

On 12/09/2016 12:36 PM, Mark Wielaard wrote:
> Some tests running under fakechroot started failing because scripts tried
> to execute /usr/bin/rm but inside the testing chroot /usr/bin and /bin
> aren't linked. Just symlink testing/usr/bin to testing/bin to simulate
> a unified /usr setup.

Right, when $(bindir) is something else than /usr/bin, whether due to 
prefix or direct override, things start going wrong. I usually build 
with --prefix=/usr so haven't seen this.

I guess the problem originates from commit 
bd9f53bb7b0aaedb039e11be04e87b615c83c33a and possibly involving 
3cac383bb848e01a9f236d33710ef043897f2a94 (since /bin used to be special)

> Signed-off-by: Mark Wielaard <mjw at redhat.com>
> ---
>  tests/Makefile.am | 2 ++
>  1 file changed, 2 insertions(+)
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 7091220..8c036d6 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -104,6 +104,8 @@ testing$(bindir)/rpmbuild: ../rpmbuild
>  	rm -rf testing
>  	mkdir -p testing/$(bindir)
>  	ln -s ./$(bindir) testing/bin
> +	mkdir -p testing/usr
> +	ln -s ../bin testing/usr/bin
>  	(cd ${top_builddir} && \
>  	          $(MAKE) DESTDIR=`pwd`/${subdir}/testing install)
>  	cp -r ${srcdir}/data/ testing/

/bin in the test chroot is already a symlink to $(bindir) so it'd make 
more sense to link /usr/bin directly to $(bindir) too. Also in case 
$(bindir) == /usr/bin it creates an unwanted (if perhaps mostly 
harmless) "bin" link to itself inside /usr/bin. But then the existing 
links and all have similar issues, and also none of it is truly correct 
because the correct paths depend on what ends up in macros from 
configure path checks, so it'd need to check all the utility macro 
values or something.

Anyway, it does improve things - besides fixing non-/usr prefix it also 
makes test suite run almost correctly within distcheck. Applied, thanks 
for the patch!

Going forward, I think the test-chroot population is best split into a 
separate script where it's easier to do stuff, shell scripting embedded 
in a makefile gets cumbersome real fast.

	- Panu -

More information about the Rpm-maint mailing list