Use absolute path for losetup.
PATCH 1/1 Use absolute path for losetup.
From: Vinson Lee <[email protected]>
/sbin may not be in the default $PATH.
--- runltp | 6 +++--- testcases/kernel/fs/acl/tacl_xattr.sh | 2 +- testcases/kernel/fs/acls/acl_test01 | 6 +++--- testcases/kernel/fs/mongo/test.sh | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-)
runltp +3 -3
@@ -952,13 +952,13 @@ create_block() return 1 else ##search for an unused loop dev - LOOP_DEV=$(losetup -f) + LOOP_DEV=$(/sbin/losetup -f) if [ $? -ne 0 ]; then echo "no unused loop device is found" return 1 else ##attach the created file to loop dev. - losetup $LOOP_DEV ${TMP}/test.img + /sbin/losetup $LOOP_DEV ${TMP}/test.img if [ $? -ne 0 ]; then echo "losetup failed to create block device" return 1
@@ -988,7 +988,7 @@ set_block_device() cleanup() { - [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV + [ "$LOOP_DEV" ] && /sbin/losetup -d $LOOP_DEV rm -rf ${TMP} }
testcases/kernel/fs/acl/tacl_xattr.sh +1 -1
@@ -80,7 +80,7 @@ fi dd if=/dev/zero of=tacl/blkext2 bs=1k count=10240 chmod 777 tacl/blkext2 -losetup /dev/loop0 tacl/blkext2 2>&1 > /dev/null +/sbin/losetup /dev/loop0 tacl/blkext2 2>&1 > /dev/null if [ $? != 0 ] then echo ""
testcases/kernel/fs/acls/acl_test01 +3 -3
@@ -89,7 +89,7 @@ do_cleanup() { rm -f $FILE_ACL > /dev/null 2>&1 rm -f $FILE_ACL_LINK > /dev/null 2>&1 mount | grep "$TMP/tacl/mount-ext3" && umount -d $TMP/tacl/mount-ext3 - [ "x$LOOP_DEV" != x ] && losetup -d $LOOP_DEV + [ "x$LOOP_DEV" != x ] && /sbin/losetup -d $LOOP_DEV rm -rf $TMP/tacl }
@@ -125,12 +125,12 @@ else # Avoid hardcoded loopback device values (-f tries to find the first # available loopback device name)! - if ! LOOP_DEV=$(losetup -f) || [ "x$LOOP_DEV" = x ]; then + if ! LOOP_DEV=$(/sbin/losetup -f) || [ "x$LOOP_DEV" = x ]; then tst_resm TCONF "[ losetup.1 ] Failed to find an available loopback device -- is the required support compiled in your kernel?" exit 0 fi - if ! losetup $LOOP_DEV $TMP/tacl/blkext3 2>&1 > /dev/null; then + if ! /sbin/losetup $LOOP_DEV $TMP/tacl/blkext3 2>&1 > /dev/null; then echo "" tst_resm TCONF "[ losetup.2 ] Failed to setup the device." exit 0
testcases/kernel/fs/mongo/test.sh +5 -5
@@ -57,13 +57,13 @@ reiserfs() cat > fs.sh <<EOF echo "performing mongo on reiserfs" dd if=/dev/zero of=reiserfs bs=8k count=10240 > /dev/null 2>&1 -losetup /dev/loop0 reiserfs +/sbin/losetup /dev/loop0 reiserfs mkdir -p $TEST_DIR ./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=reiserfs dev=/dev/loop0 dir=$TEST_DIR RUN log=$LOG_DIR/reiserlog > /dev/null 2>&1 echo "RESULTS LOGGED IN $LOG_DIR/reiserlog" export PATH=$PATH:/sbin -losetup -d /dev/loop0 +/sbin/losetup -d /dev/loop0 EOF }
@@ -76,12 +76,12 @@ cat >> fs.sh <<EOF echo "performing mongo on jfs file system" mkdir -p $TEST_DIR dd if=/dev/zero of=jfs bs=8k count=10240 > /dev/null 2>&1 -losetup /dev/loop0 jfs +/sbin/losetup /dev/loop0 jfs ./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=jfs dev=/dev/loop0 dir=$TEST_DIR RUN log=$LOG_DIR/jfslog echo "RESULTS LOGGED IN $LOG_DIR/jfslog" export PATH=$PATH:/sbin -losetup -d /dev/loop0 +/sbin/losetup -d /dev/loop0 echo "rm -rf ./fs.sh" >> ./fs.sh 2>&1 EOF }
@@ -105,5 +105,5 @@ echo "THIS MAY TAKE SOME MINUTES" sh fs.sh #performing cleanup -#losetup -d /dev/loop0 +#/sbin/losetup -d /dev/loop0 rm -rf $TEST_DIR
Signature · 13 lines
1.8.3.2 ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 3 lines
From: Vinson Lee <[email protected]>
/sbin may not be in the default $PATH.
You are supposed to start runltp as a root, if losetup is not in your $PATH something went wrong on your end.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): CACKvgLGan6cLbnkoQm4ueqxtTKTxhdW4tH34A46ph6BEyjOZkA@mail.gmail.com
Hi!
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
From: Vinson Lee <[email protected]>
/sbin may not be in the default $PATH.
You are supposed to start runltp as a root, if losetup is not in your $PATH something went wrong on your end.
Quoted 6 lines
Quoted 3 lines
--
Cyril Hrubis
[email protected]This situation can arise, for example, on CentOS 5 running LTP with sudo instead of directly as root.
That is a "security" feature for sudo. See for example bug:
https://bugzilla.redhat.com/show_bug.cgi?id=80215
You can either add /sbin/ and /bin/ to your PATH manually (PATH="$PATH:/sbin:/bin" sudo runltp) or add secure_path="/sbin:/bin:" into /etc/sudoers.
Using absolute paths in LTP is out of question because that would bring more harm than good. Note that distributions differ on placements for some of the standard tools and adding a layer for resolving the paths would add quite a bit complexity for a problem that could be solved by adding a few paths to the PATH.
On the other hand we should fix the scripts to check if the tool they use is available (see tst_check_cmds in testcases/lib/test.sh). And maybe we can print a warning from runltp if /sbin or /bin are not in $PATH.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list