1#!/bin/sh
2#
3# Copyright (c) 2003 Poul-Henning Kamp
4# All rights reserved.
5#
6# Please see src/share/examples/etc/bsd-style-copyright.
7#
8# $FreeBSD: head/usr.sbin/mtree/test/test00.sh 122141 2003-11-05 22:26:08Z phk $
9#
10
11set -e
12
13TMP=/tmp/mtree.$$
14
15rm -rf ${TMP}
16mkdir -p ${TMP} ${TMP}/mr ${TMP}/mt
17
18
19mkdir ${TMP}/mt/foo
20mkdir ${TMP}/mr/\*
21mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
22if [ -d ${TMP}/mt/foo ] ; then
23 echo "ERROR Mtree create fell for filename with '*' char" 1>&2
24 rm -rf ${TMP}
25 exit 1
26fi
27rmdir ${TMP}/mr/\*
28
29mkdir -p ${TMP}/mt/foo
30mkdir ${TMP}/mr/\[f\]oo
31mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
32if [ -d ${TMP}/mt/foo ] ; then
33 echo "ERROR Mtree create fell for filename with '[' char" 1>&2
34 rm -rf ${TMP}
35 exit 1
36fi
37rmdir ${TMP}/mr/\[f\]oo
38
39mkdir -p ${TMP}/mt/foo
40mkdir ${TMP}/mr/\?oo
41mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
42if [ -d ${TMP}/mt/foo ] ; then
43 echo "ERROR Mtree create fell for filename with '?' char" 1>&2
44 rm -rf ${TMP}
45 exit 1
46fi
47rmdir ${TMP}/mr/\?oo
48
49mkdir ${TMP}/mr/\#
50mtree -c -p ${TMP}/mr > ${TMP}/_
51if mtree -U -r -p ${TMP}/mt < ${TMP}/_ > /dev/null 2>&1 ; then
52 true
53else
54 echo "ERROR Mtree create fell for filename with '#' char" 1>&2
55 rm -rf ${TMP}
56 exit 1
57fi
58
59if [ ! -d ${TMP}/mt/\# ] ; then
60 echo "ERROR Mtree update failed to create name with '#' char" 1>&2
61 rm -rf ${TMP}
62 exit 1
63fi
64rmdir ${TMP}/mr/\#
65
66rm -rf ${TMP}
67exit 0
2#
3# Copyright (c) 2003 Poul-Henning Kamp
4# All rights reserved.
5#
6# Please see src/share/examples/etc/bsd-style-copyright.
7#
8# $FreeBSD: head/usr.sbin/mtree/test/test00.sh 122141 2003-11-05 22:26:08Z phk $
9#
10
11set -e
12
13TMP=/tmp/mtree.$$
14
15rm -rf ${TMP}
16mkdir -p ${TMP} ${TMP}/mr ${TMP}/mt
17
18
19mkdir ${TMP}/mt/foo
20mkdir ${TMP}/mr/\*
21mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
22if [ -d ${TMP}/mt/foo ] ; then
23 echo "ERROR Mtree create fell for filename with '*' char" 1>&2
24 rm -rf ${TMP}
25 exit 1
26fi
27rmdir ${TMP}/mr/\*
28
29mkdir -p ${TMP}/mt/foo
30mkdir ${TMP}/mr/\[f\]oo
31mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
32if [ -d ${TMP}/mt/foo ] ; then
33 echo "ERROR Mtree create fell for filename with '[' char" 1>&2
34 rm -rf ${TMP}
35 exit 1
36fi
37rmdir ${TMP}/mr/\[f\]oo
38
39mkdir -p ${TMP}/mt/foo
40mkdir ${TMP}/mr/\?oo
41mtree -c -p ${TMP}/mr | mtree -U -r -p ${TMP}/mt > /dev/null 2>&1
42if [ -d ${TMP}/mt/foo ] ; then
43 echo "ERROR Mtree create fell for filename with '?' char" 1>&2
44 rm -rf ${TMP}
45 exit 1
46fi
47rmdir ${TMP}/mr/\?oo
48
49mkdir ${TMP}/mr/\#
50mtree -c -p ${TMP}/mr > ${TMP}/_
51if mtree -U -r -p ${TMP}/mt < ${TMP}/_ > /dev/null 2>&1 ; then
52 true
53else
54 echo "ERROR Mtree create fell for filename with '#' char" 1>&2
55 rm -rf ${TMP}
56 exit 1
57fi
58
59if [ ! -d ${TMP}/mt/\# ] ; then
60 echo "ERROR Mtree update failed to create name with '#' char" 1>&2
61 rm -rf ${TMP}
62 exit 1
63fi
64rmdir ${TMP}/mr/\#
65
66rm -rf ${TMP}
67exit 0