2
# $Id: longpath.sh 61 2006-05-19 18:32:14Z steve-beattie $
4
# Copyright (C) 2002-2005 Novell/SUSE
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License as
8
# published by the Free Software Foundation, version 2 of the
13
# Verify handling of long pathnames.
19
_ascii="abcdefghijlkmnopqrstuvwxyz0123456789"
23
for _i in `seq 2 $_goal`
25
_c=$((RANDOM % $_mod))
26
_s="${_s}${_ascii:$_c:1}"
32
pwd=`cd $pwd ; /bin/pwd`
38
name_max=255 #NAME_MAX
39
direlem_max=235 #Length for intermediate dirs, slightly less than name_max
42
# generate 255 character filename
43
file=`genrandname $name_max`
44
file2=`genrandname $name_max`
59
direlem=`genrandname $direlem_max`
63
if [ ${#_dpath} -lt 4096 ]
71
genprofile $tmpdir/**:$okperm
72
runchecktest "LONGPATH MKDIR ($iter)" $dstatus mkdir $direlem
74
if [ $dstatus = "pass" ]
78
#echo "mkdir ($iter) passed at length ${#_dpath}"
81
echo "FAIL: $direlem ($_iter) was not created" >&2
86
echo "mkdir ($iter) incorrectly generated dir at length ${#_dpath}"
88
#echo "mkdir ($iter) failed at length ${#_dpath}"
95
if [ ${#_fpath} -lt 4096 ]
103
genprofile $tmpdir/**:$okperm
104
runchecktest "LONGPATH CREATE ($iter)" $fstatus $file
106
if [ $fstatus = "pass" ]
110
#echo "file creat ($iter) passed at length ${#_dpath}"
113
echo "FAIL: $file ($_iter) was not created" >&2
115
elif [ $fstatus = "fail" ]
119
echo "file creat ($iter) incorrectly generated file at length ${#_fpath}"
121
#echo "file creat ($iter) failed at length ${#_fpath}"
127
genprofile $tmpdir/**:$linkperm
135
echo "unable to find file to link" >&2
139
runchecktest "LONGPATH LINK ($iter)" $fstatus $_f $file2
141
if [ $fstatus = "pass" ]
145
#echo "file link ($iter) passed at length ${#_dpath}"
148
echo "FAIL: $file2 ($_iter) was not linked" >&2
150
elif [ $fstatus = "fail" ]
154
echo "file link ($iter) incorrectly generated file at length ${#_dpath}"
156
#echo "file link ($iter) failed at length ${#_fpath}"
161
if [ $mkdir_expected_fail -eq 1 -a \
162
$file_expected_fail -eq 1 -a \
163
$link_expected_fail -eq 1 ]