0
1
mirror of https://github.com/termux/proot.git synced 2024-11-11 13:49:26 +00:00
proot/tests/test-cb1143ab.sh
2016-08-21 07:42:00 -04:00

59 lines
1.3 KiB
Bash

if [ -z `which mcookie` ] || [ -z `which mkdir` ] || [ -z `which ln` ] || [ -z `which ls` ]; then
exit 125;
fi
D1=`mcookie`
D2=`mcookie`
LINK=`mcookie`
F=`mcookie`
TMP=/tmp/${D1}/${D2}
mkdir -p ${TMP}
ln -s ${TMP}/./. ${TMP}/${LINK}
${PROOT} \ls ${TMP}/${LINK} | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/ | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/. | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/.. | grep ^${D2}$
${PROOT} \ls ${TMP}/${LINK}/./.. | grep ^${D2}$
rm ${TMP}/${LINK}
touch ${TMP}/${F}
ln -s ${TMP}/${F} ${TMP}/${LINK}
${PROOT} \ls ${TMP}/${LINK}
! ${PROOT} \ls ${TMP}/${LINK}/
[ $? -eq 0 ]
! ${PROOT} \ls ${TMP}/${LINK}/.
[ $? -eq 0 ]
! ${PROOT} \ls ${TMP}/${LINK}/..
[ $? -eq 0 ]
! ${PROOT} \ls ${TMP}/${LINK}/./..
[ $? -eq 0 ]
! ${PROOT} \ls ${TMP}/${LINK}/../..
[ $? -eq 0 ]
${PROOT} -b /tmp/${D1}:${TMP}/${F} \ls ${TMP}/${LINK}
${PROOT} -b /tmp/${D1}:${TMP}/${F} \ls ${TMP}/${LINK}/
${PROOT} -b /tmp/${D1}:${TMP}/${F} \ls ${TMP}/${LINK}/.
${PROOT} -b /tmp/${D1}:${TMP}/${F} \ls ${TMP}/${LINK}/..
rm ${TMP}/${LINK}
ln -s ${TMP}/${D1} ${TMP}/${LINK}
${PROOT} -b /tmp/${F}:${TMP}/${D1} \ls ${TMP}/${LINK}
! ${PROOT} -b /tmp/${F}:${TMP}/${D1} \ls ${TMP}/${LINK}/
[ $? -eq 0 ]
! ${PROOT} -b /tmp/${F}:${TMP}/${D1} \ls ${TMP}/${LINK}/.
[ $? -eq 0 ]
! ${PROOT} -b /tmp/${F}:${TMP}/${D1} \ls ${TMP}/${LINK}/..
[ $? -eq 0 ]
rm -fr /tmp/${D1}