tst-32bit-uid-gid

来自「pwdutils是一套密码管理工具」· 代码 · 共 83 行

TXT
83
字号
#!/bin/bashexport LANG=C# Don't enable before we don't know on which filesystem# we run. faillog and lastlog can become very, very big.# XXX FIX THISexit 77TEMPDIR=`mktemp -d tests.XXXXXX`touch $TEMPDIR/passwdtouch $TEMPDIR/group# 31bit UID tests (signed int)./useradd -P $TEMPDIR -G "" -c "INT_MAX=2147483647" -u 2147483647 intmaxRET=$?if [ $RET != 0 ]; then        rm -rf $TEMPDIR        exit $RETfi./groupadd -P $TEMPDIR -g 2147483647 intmaxRET=$?if [ $RET != 0 ]; then        rm -rf $TEMPDIR        exit $RETficat << EOT > tst-32bit-uid-gid.expect-passwdintmax:!:2147483647:100:INT_MAX=2147483647:/home/intmax:/bin/bashEOTdiff -q -u tst-32bit-uid-gid.expect-passwd $TEMPDIR/passwdRET1=$?cat << EOT > tst-32bit-uid-gid.expect-groupintmax:!:2147483647:EOTdiff -q -u tst-32bit-uid-gid.expect-group $TEMPDIR/groupRET2=$?# 32bit UID tests (unsigned int)./useradd -P $TEMPDIR -G "" -c "UINT_MAX=4294967295" -u 4294967295 uintmaxRET=$?if [ $RET != 0 ]; then        rm -rf $TEMPDIR        exit $RETfi./groupadd -P $TEMPDIR -g 4294967295 uintmaxRET=$?if [ $RET != 0 ]; then        rm -rf $TEMPDIR        exit $RETficat << EOT >> tst-32bit-uid-gid.expect-passwduintmax:!:4294967295:100:UINT_MAX=4294967295:/home/uintmax:/bin/bashEOTdiff -q -u tst-32bit-uid-gid.expect-passwd $TEMPDIR/passwdRET3=$?cat << EOT >> tst-32bit-uid-gid.expect-groupuintmax:!:4294967295:EOTdiff -q -u tst-32bit-uid-gid.expect-group $TEMPDIR/groupRET4=$?cp $TEMPDIR/passwd tst-32bit-uid-gid.passwdcp $TEMPDIR/group tst-32bit-uid-gid.grouprm -rf $TEMPDIRif [ $RET1 != 0 || $RET2 != 0 ] ; then  exit 1fiif [ $RET3 != 0 && $RET4 != 0 ] ; then  echo "System supports only 31bit UIDs, not 32bit!"  exit 77fiif [ $RET3 != 0 || $RET4 != 0 ] ; then  exit 1fiexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?