xref: /freebsd/contrib/pjdfstest/tests/chflags/02.t (revision 2008043f386721d58158e37e0d7e50df8095942d)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/02.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10require chflags
11
12echo "1..12"
13
14nx=`namegen_max`
15nxx="${nx}x"
16
17expect 0 create ${nx} 0644
18expect 0 chflags ${nx} SF_IMMUTABLE
19expect SF_IMMUTABLE stat ${nx} flags
20expect 0 chflags ${nx} none
21expect 0 unlink ${nx}
22expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE
23
24expect 0 create ${nx} 0644
25expect 0 lchflags ${nx} SF_IMMUTABLE
26expect SF_IMMUTABLE stat ${nx} flags
27expect 0 lchflags ${nx} none
28expect 0 unlink ${nx}
29expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE
30