freebsd-skq/usr.sbin/fmtree/test/test00.sh
bdrewery 889c33ba79 Rename usr.sbin/mtree to usr.sbin/fmtree since it is not what /usr/sbin/mtree
actually is (which is usr.sbin/nmtree).

This has tricked me numerous times.
2015-11-09 23:19:36 +00:00

68 lines
1.3 KiB
Bash

#!/bin/sh
#
# Copyright (c) 2003 Poul-Henning Kamp
# All rights reserved.
#
# Please see src/share/examples/etc/bsd-style-copyright.
#
# $FreeBSD$
#
set -e
TMP=/tmp/mtree.$$
rm -rf ${TMP}
mkdir -p ${TMP} ${TMP}/mr ${TMP}/mt
mkdir ${TMP}/mt/foo
mkdir ${TMP}/mr/\*
mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
if [ -d ${TMP}/mt/foo ] ; then
echo "ERROR Mtree create fell for filename with '*' char" 1>&2
rm -rf ${TMP}
exit 1
fi
rmdir ${TMP}/mr/\*
mkdir -p ${TMP}/mt/foo
mkdir ${TMP}/mr/\[f\]oo
mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
if [ -d ${TMP}/mt/foo ] ; then
echo "ERROR Mtree create fell for filename with '[' char" 1>&2
rm -rf ${TMP}
exit 1
fi
rmdir ${TMP}/mr/\[f\]oo
mkdir -p ${TMP}/mt/foo
mkdir ${TMP}/mr/\?oo
mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
if [ -d ${TMP}/mt/foo ] ; then
echo "ERROR Mtree create fell for filename with '?' char" 1>&2
rm -rf ${TMP}
exit 1
fi
rmdir ${TMP}/mr/\?oo
mkdir ${TMP}/mr/\#
mtree -c -p ${TMP}/mr > ${TMP}/_
if mtree -U -r -p ${TMP}/mt < ${TMP}/_ > /dev/null 2>&1 ; then
true
else
echo "ERROR Mtree create fell for filename with '#' char" 1>&2
rm -rf ${TMP}
exit 1
fi
if [ ! -d ${TMP}/mt/\# ] ; then
echo "ERROR Mtree update failed to create name with '#' char" 1>&2
rm -rf ${TMP}
exit 1
fi
rmdir ${TMP}/mr/\#
rm -rf ${TMP}
exit 0