misc: fix $MKFS_PROG.$FSTYP usage treewide
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 11 Nov 2020 00:43:33 +0000 (16:43 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 22 Nov 2020 14:17:40 +0000 (22:17 +0800)
Replace all the $MKFS_PROG.$FSTYP invocations with $MKFS_PROG -t $FSTYP.
The mkfs wrapper binary knows how to search the user's $PATH to find the
appropriate mkfs delegate, which the author uses to switch between
development and distro versions of various tools.

Unfortunately, using "$MKFS_PROG.$FSTYP" means that the shell only looks
in the same directory as the mkfs wrapper, which means that we can end
up mixing different tool versions when this is the case.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
tests/ext4/032
tests/shared/032

index 985472cde3b7c8026bb297340f2b89287993d6f7..b5a504e0dcb4e7c9fd18a24d7a5a2e06bc5515d0 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -987,7 +987,7 @@ _scratch_mkfs_sized()
                fi
                ;;
        ext2|ext3|ext4|ext4dev)
                fi
                ;;
        ext2|ext3|ext4|ext4dev)
-               ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
                ;;
        gfs2)
                # mkfs.gfs2 doesn't automatically shrink journal files on small
                ;;
        gfs2)
                # mkfs.gfs2 doesn't automatically shrink journal files on small
@@ -1002,10 +1002,10 @@ _scratch_mkfs_sized()
                        (( journal_size >= min_journal_size )) || journal_size=$min_journal_size
                        MKFS_OPTIONS="-J $journal_size $MKFS_OPTIONS"
                fi
                        (( journal_size >= min_journal_size )) || journal_size=$min_journal_size
                        MKFS_OPTIONS="-J $journal_size $MKFS_OPTIONS"
                fi
-               ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks
                ;;
        ocfs2)
                ;;
        ocfs2)
-               yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
                ;;
        udf)
                $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
                ;;
        udf)
                $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
@@ -1019,10 +1019,10 @@ _scratch_mkfs_sized()
                $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
                ;;
        jfs)
                $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
                ;;
        jfs)
-               ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS $SCRATCH_DEV $blocks
                ;;
        reiserfs)
                ;;
        reiserfs)
-               ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
                ;;
        reiser4)
                # mkfs.resier4 requires size in KB as input for creating filesystem
                ;;
        reiser4)
                # mkfs.resier4 requires size in KB as input for creating filesystem
@@ -1101,13 +1101,13 @@ _scratch_mkfs_blocksized()
        _scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
        ;;
     ext2|ext3|ext4)
        _scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
        ;;
     ext2|ext3|ext4)
-       ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+       ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
        ;;
     gfs2)
        ;;
     gfs2)
-       ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
+       ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
        ;;
     ocfs2)
        ;;
     ocfs2)
-       yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
+       yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
        ;;
     *)
        _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
        ;;
     *)
        _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
index c63e70346700cd5f300f4d57aa356bc84cf2f9a8..4e8dac42a16a9a78d0af2f4c7b3195c3ac0de540 100755 (executable)
@@ -46,7 +46,7 @@ ext4_online_resize()
        echo "+++ create fs on image file $original_size" | \
                tee -a $seqres.full
 
        echo "+++ create fs on image file $original_size" | \
                tee -a $seqres.full
 
-       ${MKFS_PROG}.${FSTYP} -F -O bigalloc,resize_inode -C $CLUSTER_SIZ \
+       ${MKFS_PROG} -t ${FSTYP} -F -O bigalloc,resize_inode -C $CLUSTER_SIZ \
                -b $BLK_SIZ ${LOOP_DEVICE} $original_size >> \
                $seqres.full 2>&1 || _fail "mkfs failed"
 
                -b $BLK_SIZ ${LOOP_DEVICE} $original_size >> \
                $seqres.full 2>&1 || _fail "mkfs failed"
 
index 40d278981c356edf56d5cf7d5ef48af2cf8cde45..00ae6860d9d5333dadf6d9337b6bbf86c841b457 100755 (executable)
@@ -67,7 +67,7 @@ do
        if [ $? -eq 0 ] ; then
                # next, ensure we don't overwrite it
                echo "=== Attempting $FSTYP overwrite of $fs..." >>$seqres.full
        if [ $? -eq 0 ] ; then
                # next, ensure we don't overwrite it
                echo "=== Attempting $FSTYP overwrite of $fs..." >>$seqres.full
-               ${MKFS_PROG}.$FSTYP $SCRATCH_DEV >>$seqres.full 2>&1
+               ${MKFS_PROG} -t $FSTYP $SCRATCH_DEV >>$seqres.full 2>&1
 
                [ $? -eq 0 ] && echo "Failed - overwrote fs type ${fs}!"
        else
 
                [ $? -eq 0 ] && echo "Failed - overwrote fs type ${fs}!"
        else