# -*- shell-script -*-
-FILENAME=lha-test11
message testing the long filename support
# long long filename
# assume that we are allowed to create 255 bytes filename (not path name).
-# the _POSIX_PATH_MAX (the maximam length of relative path name) value may
+# the _POSIX_PATH_MAX (the maximum length of relative path name) value may
# be 255.
#
-# Note that on Cygwin/MinGW, on NTFS, the maximam length of whole path
+# Note that on Cygwin/MinGW, on NTFS, the maximum length of whole path
# name (contain the drive letter) is limited probably. it seems to be 259 (?)
#
+
+# 255 bytes
+file=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
+
mkdir test-tmp1
case $(uname) in
-CYGWIN*)
- # 190 bytes
- file=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 ;;
+MS-DOS* | CYGWIN*)
+ # omit the length of current path.
+ file=$(echo $file | cut -c$((echo X: && cd test-tmp1 && pwd && echo test-tmp1-hg) | wc -c)-)
+ ;;
*)
- # 255 bytes
- file=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 ;;
esac
(cd test-tmp1 && touch $file)
check $? $LINENO
$lha cg test-tmp1-hg.lzh test-tmp1 2> test-stderr
check $? $LINENO
# on Cygwin/MinGW, skip this test.
-# the length of pathname does not amount to the limit of level 0 header.
+# the length of pathname does not exceed the limit of level 0 header.
case $(uname) in
-CYGWIN*) true ;;
+MS-DOS* | CYGWIN*) true ;;
*) test -s test-stderr ;;
esac
check $? $LINENO
$lha c0 test-tmp1-h0.lzh test-tmp1 2> test-stderr
check $? $LINENO
# on Cygwin/MinGW, skip this test.
-# the length of pathname does not amount to the limit of level 0 header.
+# the length of pathname does not exceed the limit of level 0 header.
case $(uname) in
-CYGWIN*) true ;;
+MS-DOS* | CYGWIN*) true ;;
*) test -s test-stderr ;;
esac
check $? $LINENO
check $? $LINENO
test -f test-tmp1-h2/test-tmp1/$file
check $? $LINENO
-# the header size is 0x101 instead of 0x100 on level 2 header
+# 0x100 is never set on the header size field on level 2 header
file=test-tmp9012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
touch $file
+if [ $? -ne 0 ]; then
+ echo "$FILENAME: Warning: current directory is too deep. skip this test..." >&2
+else
+
+ $lha c2 test-tmp4-h2.lzh $file
check $? $LINENO
-$lha c2 test-tmp4-h2.lzh $file
+ $lha vv test-tmp4-h2.lzh
check $? $LINENO
-$lha vv test-tmp4-h2.lzh
+ $lha vv test-tmp4-h2.lzh | egrep '\[2\].?$'
check $? $LINENO
-$lha vv test-tmp4-h2.lzh | egrep '\[2\].?$'
+ rm -f $file
check $? $LINENO
-$lha xw=test-tmp4 test-tmp4-h2.lzh
+ $lha x test-tmp4-h2.lzh
check $? $LINENO
-test x"`/bin/ls -l test-tmp4-h2.lzh | awk '{print $5}'`" = x258
+ test x"`$lha vvvq test-tmp4-h2.lzh | head -1`" = x"00 2: 257(0x0101)"
check $? $LINENO
-test -f test-tmp4/$file
+ test -f $file
check $? $LINENO
+fi