[Scratchbox-users] argv[0] always has full path

Peter Pearse peter.pearse at arm.com
Thu Jul 6 13:02:47 EEST 2006


Problem
=======
My coreutils debian package build fails.

Environment
===========
Scratchbox 1.0.3 
Foreign tool chain
sbrsh 7.1

Cause
=====
Tests fail because error messages from the tested app include its' full
path.

EXAMPLE:
	-: test fail-1: stderr mismatch, comparing fail-1.1 (actual) and
fail-1.E (expected)

	*** fail-1.1    Wed Jul  5 13:52:15 2006
	--- fail-1.E    Wed Jul  5 13:52:15 2006

	***************
	*** 1,2 ****
	! basename: too few arguments
	! Try `basename --help' for more information.
	--- 1,2 ----
	!
/home/ppearse/coreutils-5.2.1/build-tree/coreutils-5.2.1/tests/basename/../.
./src/basename: too few arguments
	! Try
`/home/ppearse/coreutils-5.2.1/build-tree/coreutils-5.2.1/tests/basename/../
../src/basename --help' for more information.

More detail
===========

With  a test program which prints argv[0]:-

In my scratchbox:-

	[sbox-2006q1_6: ~] > pwd

	/home/ppearse

	[sbox-2006q1_6: ~] > ./a.out

	My argv[0] is ./a.out

	[sbox-2006q1_6: ~] > cd tests/testdir/appname

	My argv[0] is ../../../a.out

	[sbox-2006q1_6: ~/tests/testdir/appname] > export
PATH=/home/ppearse:${PATH}

	[sbox-2006q1_6: ~/tests/testdir/appname] > a.out

	My argv[0] is /home/ppearse/a.out

On my target (and various other machines) :-

	/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse # ./a.out

	My argv[0] is ./a.out

	/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse # cd
tests/testdir/appname

	
/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse/tests/testdir/appname
# ../../../a.out

	My argv[0] is ../../../a.out

	
/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse/tests/testdir/appname
# 

	export
PATH=/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse:${PATH}

	
/var/sbrshd/ppearse at 10.1.77.158/2006q1_6/home/ppearse/tests/testdir/appname
# a.out

	My argv[0] is a.out

Questions
=========
I know I could
	kludge the test scripts
	perhaps use coreutils/src/system.h/initialize_main to strip the path
	etc.

But not the answer to these questions:- 
	Is this due to an error in my installation?
	Is this an sbrsh bug which I should report?


Any answers welcomed.....

Peter Pearse






More information about the Scratchbox-users mailing list