1# $OpenBSD: Makefile,v 1.5 2021/07/06 19:48:05 bluhm Exp $ 2 3REGRESS_TARGETS= chmod_abs_0000 chmod_abs_0644 4REGRESS_TARGETS+= chmod_sym_0644 chmod_sym_0000 5REGRESS_TARGETS+= chmod_R_0755 chmod_RP_0755 chmod_RH_0755 chmod_RL_0755 6REGRESS_TARGETS+= chmod_h_abs_0000 chmod_h_abs_0644 7REGRESS_TARGETS+= chmod_h_sym_0000 chmod_h_sym_0644 8REGRESS_TARGETS+= chmod_h_go_minus_r chmod_h_go_minus_rx 9REGRESS_TARGETS+= chmod_h_go_plus_r chmod_h_go_plus_rx 10REGRESS_TARGETS+= chmod_via_link_abs_0000 chmod_via_link_abs_0644 11REGRESS_TARGETS+= chmod_via_link_sym_0000 chmod_via_link_sym_0644 12REGRESS_TARGETS+= chmod_via_link_go_minus_r chmod_via_link_go_minus_rx 13REGRESS_TARGETS+= chmod_via_link_go_plus_r chmod_via_link_go_plus_rx 14REGRESS_TARGETS+= chmod_error 15 16REGRESS_TARGETS+= chgrp_error 17 18REGRESS_TARGETS+= chown_error 19 20REGRESS_TARGETS+= chflags chflags_no 21REGRESS_TARGETS+= chflags_R chflags_RP chflags_RH chflags_RL 22REGRESS_TARGETS+= chflags_via_link 23REGRESS_TARGETS+= chflags_error 24 25REGRESS_ROOT_TARGETS+= chgrp_id 26REGRESS_ROOT_TARGETS+= chgrp_name 27REGRESS_ROOT_TARGETS+= chgrp_symlink 28REGRESS_ROOT_TARGETS+= chgrp_h_symlink 29REGRESS_ROOT_TARGETS+= chgrp_R 30REGRESS_ROOT_TARGETS+= chgrp_RP 31REGRESS_ROOT_TARGETS+= chgrp_RH 32REGRESS_ROOT_TARGETS+= chgrp_RL 33REGRESS_ROOT_TARGETS+= chown_id 34REGRESS_ROOT_TARGETS+= chown_name 35REGRESS_ROOT_TARGETS+= chown_symlink 36REGRESS_ROOT_TARGETS+= chown_h_symlink 37REGRESS_ROOT_TARGETS+= chown_R 38REGRESS_ROOT_TARGETS+= chown_RP 39REGRESS_ROOT_TARGETS+= chown_RH 40REGRESS_ROOT_TARGETS+= chown_RL 41 42REGRESS_TARGETS+= ${REGRESS_ROOT_TARGETS} 43 44MKDIR= /bin/mkdir 45TOUCH= /usr/bin/touch 46CHMOD= /bin/chmod 47LN= /bin/ln 48CHFLAGS= /usr/bin/chflags 49CHGRP= ${SUDO} /bin/chgrp 50CHOWN= ${SUDO} /sbin/chown 51STAT= ${SUDO} /usr/bin/stat 52DIFF= /usr/bin/diff -up 53RM= ${SUDO} /bin/rm 54 55prepfile: clean 56 ${MKDIR} -p regress 57 ${TOUCH} regress/file 58 ${CHMOD} 000 regress/file 59 [ `${STAT} -f '%p' regress/file` == '100000' ] 60 61chmod_prepsymlink: prepfile 62 ${LN} -s ${.OBJDIR}/regress/file regress/link 63 ${CHMOD} -h 755 regress/link 64 [ `${STAT} -f '%p' regress/link` == '120755' ] 65 66prepdir: clean 67 ${MKDIR} -p regress/dir 68 ${TOUCH} regress/dir/file1 69 ${TOUCH} regress/dir/file2 70 ${CHMOD} 000 regress/dir/file1 71 ${CHMOD} 000 regress/dir/file2 72 ${TOUCH} regress/link_target_file 73 ${CHMOD} 0600 regress/link_target_file 74 [ `${STAT} -f '%p' regress/dir/file1` == '100000' ] 75 [ `${STAT} -f '%p' regress/dir/file2` == '100000' ] 76 ${LN} -s ${.OBJDIR}/regress/link_target_file regress/dir/linked_file 77 ${LN} -s ${.OBJDIR}/regress/dir regress/linked_dir 78 ${CHMOD} 000 regress/dir 79 [ `${STAT} -f '%p' regress/dir` == '40000' ] 80 [ `${STAT} -f '%p' regress/link_target_file` == '100600' ] 81 82chown_prepfile: prepfile 83 ${CHOWN} root:wheel regress/file 84 [ `${STAT} -f '%Su' regress/file` == 'root' ] 85 [ `${STAT} -f '%Sg' regress/file` == 'wheel' ] 86 87chown_prepsymlink: chown_prepfile 88 ${LN} -s ${.OBJDIR}/regress/file regress/symlink 89 ${CHOWN} -h root:wheel regress/symlink 90 [ `${STAT} -f '%Su' regress/symlink` == 'root' ] 91 [ `${STAT} -f '%Sg' regress/symlink` == 'wheel' ] 92 93chown_prepdir: prepdir 94 ${CHMOD} -R 0755 regress 95 ${CHOWN} -RL root:wheel regress 96 97chflags_prepfile: prepfile 98 ${CHFLAGS} dump regress/file 99 [ `${STAT} -f '%f' regress/file` == '0' ] 100 101chflags_prepdir: prepdir 102 ${CHMOD} -R 0755 regress 103 ${CHFLAGS} -RL dump regress 104 105chmod_abs_0000: prepfile 106 ${CHMOD} 0644 regress/file 107 ${CHMOD} 0000 regress/file 108 [ `${STAT} -f '%p' regress/file` == '100000' ] 109 110chmod_abs_0644: prepfile 111 ${CHMOD} 0644 regress/file 112 [ `${STAT} -f '%p' regress/file` == '100644' ] 113 114chmod_sym_0644: prepfile 115 ${CHMOD} u=rw,go=r regress/file 116 [ `${STAT} -f '%p' regress/file` == '100644' ] 117 118chmod_sym_0000: prepfile 119 ${CHMOD} 0644 regress/file 120 ${CHMOD} a-rwx regress/file 121 [ `${STAT} -f '%p' regress/file` == '100000' ] 122 123chmod_R_0755: prepdir 124 ${CHMOD} -R 0755 regress/dir 125 [ `${STAT} -f '%p' regress/dir/file1` == '100755' ] 126 [ `${STAT} -f '%p' regress/dir/file2` == '100755' ] 127 [ `${STAT} -f '%p' regress/dir` == '40755' ] 128 [ `${STAT} -f '%p' regress/link_target_file` == '100600' ] 129 130chmod_RP_0755: prepdir 131 ${CHMOD} -RP 0755 regress/dir 132 [ `${STAT} -f '%p' regress/dir/file1` == '100755' ] 133 [ `${STAT} -f '%p' regress/dir/file2` == '100755' ] 134 [ `${STAT} -f '%p' regress/dir` == '40755' ] 135 [ `${STAT} -f '%p' regress/link_target_file` == '100600' ] 136 137chmod_RH_0755: prepdir 138 ${CHMOD} -RH 0755 regress/linked_dir 139 [ `${STAT} -f '%p' regress/dir/file1` == '100755' ] 140 [ `${STAT} -f '%p' regress/dir/file2` == '100755' ] 141 [ `${STAT} -f '%p' regress/dir` == '40755' ] 142 [ `${STAT} -f '%p' regress/link_target_file` == '100600' ] 143 144chmod_RL_0755: prepdir 145 ${CHMOD} -RL 0755 regress/linked_dir 146 [ `${STAT} -f '%p' regress/dir/file1` == '100755' ] 147 [ `${STAT} -f '%p' regress/dir/file2` == '100755' ] 148 [ `${STAT} -f '%p' regress/dir` == '40755' ] 149 [ `${STAT} -f '%p' regress/link_target_file` == '100755' ] 150 151chmod_h_abs_0000: chmod_prepsymlink 152 ${CHMOD} -h 0000 regress/link 153 [ `${STAT} -f '%p' regress/file` == '100000' ] 154 [ `${STAT} -f '%p' regress/link` == '120000' ] 155 156chmod_h_abs_0644: chmod_prepsymlink 157 ${CHMOD} -h 0644 regress/link 158 [ `${STAT} -f '%p' regress/file` == '100000' ] 159 [ `${STAT} -f '%p' regress/link` == '120644' ] 160 161chmod_h_sym_0000: chmod_prepsymlink 162 ${CHMOD} -h a-rwx regress/link 163 [ `${STAT} -f '%p' regress/file` == '100000' ] 164 [ `${STAT} -f '%p' regress/link` == '120000' ] 165 166chmod_h_sym_0644: chmod_prepsymlink 167 ${CHMOD} -h u=rw,go=r regress/link 168 [ `${STAT} -f '%p' regress/file` == '100000' ] 169 [ `${STAT} -f '%p' regress/link` == '120644' ] 170 171chmod_h_go_minus_r: chmod_prepsymlink 172 ${CHMOD} -h go-r regress/link 173 [ `${STAT} -f '%p' regress/file` == '100000' ] 174 [ `${STAT} -f '%p' regress/link` == '120711' ] 175 176chmod_h_go_minus_rx: chmod_prepsymlink 177 ${CHMOD} -h go-rx regress/link 178 [ `${STAT} -f '%p' regress/file` == '100000' ] 179 [ `${STAT} -f '%p' regress/link` == '120700' ] 180 181chmod_h_go_plus_r: chmod_prepsymlink 182 ${CHMOD} -h go+r regress/link 183 [ `${STAT} -f '%p' regress/file` == '100000' ] 184 [ `${STAT} -f '%p' regress/link` == '120755' ] 185 186chmod_h_go_plus_rx: chmod_prepsymlink 187 ${CHMOD} -h go+rx regress/link 188 [ `${STAT} -f '%p' regress/file` == '100000' ] 189 [ `${STAT} -f '%p' regress/link` == '120755' ] 190 191chmod_via_link_abs_0000: chmod_prepsymlink 192 ${CHMOD} 0000 regress/link 193 [ `${STAT} -f '%p' regress/file` == '100000' ] 194 [ `${STAT} -f '%p' regress/link` == '120755' ] 195 196chmod_via_link_abs_0644: chmod_prepsymlink 197 ${CHMOD} 0644 regress/link 198 [ `${STAT} -f '%p' regress/file` == '100644' ] 199 [ `${STAT} -f '%p' regress/link` == '120755' ] 200 201chmod_via_link_sym_0000: chmod_prepsymlink 202 ${CHMOD} a-rwx regress/link 203 [ `${STAT} -f '%p' regress/file` == '100000' ] 204 [ `${STAT} -f '%p' regress/link` == '120755' ] 205 206chmod_via_link_sym_0644: chmod_prepsymlink 207 ${CHMOD} u=rw,go=r regress/link 208 [ `${STAT} -f '%p' regress/file` == '100644' ] 209 [ `${STAT} -f '%p' regress/link` == '120755' ] 210 211chmod_via_link_go_minus_r: chmod_prepsymlink 212 ${CHMOD} go-r regress/link 213 [ `${STAT} -f '%p' regress/file` == '100000' ] 214 [ `${STAT} -f '%p' regress/link` == '120755' ] 215 216chmod_via_link_go_minus_rx: chmod_prepsymlink 217 ${CHMOD} go-rx regress/link 218 [ `${STAT} -f '%p' regress/file` == '100000' ] 219 [ `${STAT} -f '%p' regress/link` == '120755' ] 220 221chmod_via_link_go_plus_r: chmod_prepsymlink 222 ${CHMOD} go+r regress/link 223 [ `${STAT} -f '%p' regress/file` == '100044' ] 224 [ `${STAT} -f '%p' regress/link` == '120755' ] 225 226chmod_via_link_go_plus_rx: chmod_prepsymlink 227 ${CHMOD} go+rx regress/link 228 [ `${STAT} -f '%p' regress/file` == '100055' ] 229 [ `${STAT} -f '%p' regress/link` == '120755' ] 230 231chmod_error: 232 ${CHMOD} foo bar 2>chmod.err || true 233 ${DIFF} ${.CURDIR}/chmod.error chmod.err 234 235chgrp_id: chown_prepfile 236 ${CHGRP} 32767 regress/file 237 [ `${STAT} -f '%g' regress/file` == 32767 ] 238 239chgrp_name: chown_prepfile 240 ${CHGRP} nobody regress/file 241 [ `${STAT} -f '%Sg' regress/file` == 'nobody' ] 242 243chgrp_symlink: chown_prepsymlink 244 ${CHGRP} nobody regress/symlink 245 [ `${STAT} -f '%Sg' regress/file` == 'nobody' ] 246 [ `${STAT} -f '%Sg' regress/symlink` == 'wheel' ] 247 248chgrp_h_symlink: chown_prepsymlink 249 ${CHGRP} -h nobody regress/symlink 250 [ `${STAT} -f '%Sg' regress/file` == 'wheel' ] 251 [ `${STAT} -f '%Sg' regress/symlink` == 'nobody' ] 252 253chgrp_R: chown_prepdir 254 ${CHGRP} -R nobody regress/dir 255 [ `${STAT} -f '%Sg' regress/dir/file1` == 'nobody' ] 256 [ `${STAT} -f '%Sg' regress/dir/file2` == 'nobody' ] 257 [ `${STAT} -f '%Sg' regress/dir` == 'nobody' ] 258 [ `${STAT} -f '%Sg' regress/link_target_file` == 'wheel' ] 259 260chgrp_RP: chown_prepdir 261 ${CHGRP} -RP nobody regress/dir 262 [ `${STAT} -f '%Sg' regress/dir/file1` == 'nobody' ] 263 [ `${STAT} -f '%Sg' regress/dir/file2` == 'nobody' ] 264 [ `${STAT} -f '%Sg' regress/dir` == 'nobody' ] 265 [ `${STAT} -f '%Sg' regress/link_target_file` == 'wheel' ] 266 267chgrp_RH: chown_prepdir 268 ${CHGRP} -RH nobody regress/linked_dir 269 [ `${STAT} -f '%Sg' regress/dir/file1` == 'nobody' ] 270 [ `${STAT} -f '%Sg' regress/dir/file2` == 'nobody' ] 271 [ `${STAT} -f '%Sg' regress/dir` == 'nobody' ] 272 [ `${STAT} -f '%Sg' regress/link_target_file` == 'wheel' ] 273 274chgrp_RL: chown_prepdir 275 ${CHGRP} -RL nobody regress/linked_dir 276 [ `${STAT} -f '%Sg' regress/dir/file1` == 'nobody' ] 277 [ `${STAT} -f '%Sg' regress/dir/file2` == 'nobody' ] 278 [ `${STAT} -f '%Sg' regress/dir` == 'nobody' ] 279 [ `${STAT} -f '%Sg' regress/link_target_file` == 'nobody' ] 280 281chgrp_error: 282 ${CHGRP} __hopefully_not_existing_group bar 2>chgrp.err || true 283 ${DIFF} ${.CURDIR}/chgrp.error chgrp.err 284 285chown_id: chown_prepfile 286 ${CHOWN} 32767 regress/file 287 [ `${STAT} -f '%u' regress/file` == 32767 ] 288 289chown_name: chown_prepfile 290 ${CHOWN} nobody regress/file 291 [ `${STAT} -f '%Su' regress/file` == 'nobody' ] 292 293chown_symlink: chown_prepsymlink 294 ${CHOWN} nobody regress/symlink 295 [ `${STAT} -f '%Su' regress/file` == 'nobody' ] 296 [ `${STAT} -f '%Su' regress/symlink` == 'root' ] 297 298chown_h_symlink: chown_prepsymlink 299 ${CHOWN} -h nobody regress/symlink 300 [ `${STAT} -f '%Su' regress/file` == 'root' ] 301 [ `${STAT} -f '%Su' regress/symlink` == 'nobody' ] 302 303chown_R: chown_prepdir 304 ${CHOWN} -R nobody regress/dir 305 [ `${STAT} -f '%Su' regress/dir/file1` == 'nobody' ] 306 [ `${STAT} -f '%Su' regress/dir/file2` == 'nobody' ] 307 [ `${STAT} -f '%Su' regress/dir` == 'nobody' ] 308 [ `${STAT} -f '%Su' regress/link_target_file` != 'nobody' ] 309 310chown_RP: chown_prepdir 311 ${CHOWN} -RP nobody regress/dir 312 [ `${STAT} -f '%Su' regress/dir/file1` == 'nobody' ] 313 [ `${STAT} -f '%Su' regress/dir/file2` == 'nobody' ] 314 [ `${STAT} -f '%Su' regress/dir` == 'nobody' ] 315 [ `${STAT} -f '%Su' regress/link_target_file` != 'nobody' ] 316 317chown_RH: chown_prepdir 318 ${CHOWN} -RH nobody regress/linked_dir 319 [ `${STAT} -f '%Su' regress/dir/file1` == 'nobody' ] 320 [ `${STAT} -f '%Su' regress/dir/file2` == 'nobody' ] 321 [ `${STAT} -f '%Su' regress/dir` == 'nobody' ] 322 [ `${STAT} -f '%Su' regress/link_target_file` != 'nobody' ] 323 324chown_RL: chown_prepdir 325 ${CHOWN} -RL nobody regress/linked_dir 326 [ `${STAT} -f '%Su' regress/dir/file1` == 'nobody' ] 327 [ `${STAT} -f '%Su' regress/dir/file2` == 'nobody' ] 328 [ `${STAT} -f '%Su' regress/dir` == 'nobody' ] 329 [ `${STAT} -f '%Su' regress/link_target_file` == 'nobody' ] 330 331chown_error: 332 ${CHOWN} __hopefully_not_existing_user bar 2>chown.err || true 333 ${DIFF} ${.CURDIR}/chown.error chown.err 334 335chflags: chflags_prepfile 336 ${CHFLAGS} nodump regress/file 337 [ `${STAT} -f '%f' regress/file` == '1' ] 338 339chflags_no: chflags_prepfile 340 ${CHFLAGS} nodump regress/file 341 [ `${STAT} -f '%f' regress/file` == '1' ] 342 ${CHFLAGS} dump regress/file 343 [ `${STAT} -f '%f' regress/file` == '0' ] 344 345chflags_R: chflags_prepdir 346 ${CHFLAGS} -R nodump regress/dir 347 [ `${STAT} -f '%f' regress/dir/file1` == '1' ] 348 [ `${STAT} -f '%f' regress/dir/file2` == '1' ] 349 [ `${STAT} -f '%f' regress/dir` == '1' ] 350 [ `${STAT} -f '%f' regress/link_target_file` == '0' ] 351 352chflags_RP: chflags_prepdir 353 ${CHFLAGS} -RP nodump regress/dir 354 [ `${STAT} -f '%f' regress/dir/file1` == '1' ] 355 [ `${STAT} -f '%f' regress/dir/file2` == '1' ] 356 [ `${STAT} -f '%f' regress/dir` == '1' ] 357 [ `${STAT} -f '%f' regress/link_target_file` == '0' ] 358 359chflags_RH: chflags_prepdir 360 ${CHFLAGS} -RH nodump regress/linked_dir 361 [ `${STAT} -f '%f' regress/dir/file1` == '1' ] 362 [ `${STAT} -f '%f' regress/dir/file2` == '1' ] 363 [ `${STAT} -f '%f' regress/dir` == '1' ] 364 [ `${STAT} -f '%f' regress/link_target_file` == '0' ] 365 366chflags_RL: chflags_prepdir 367 ${CHFLAGS} -RL nodump regress/linked_dir 368 [ `${STAT} -f '%f' regress/dir/file1` == '1' ] 369 [ `${STAT} -f '%f' regress/dir/file2` == '1' ] 370 [ `${STAT} -f '%f' regress/dir` == '1' ] 371 [ `${STAT} -f '%f' regress/link_target_file` == '1' ] 372 373chflags_via_link: chflags_prepfile 374 ${LN} -s ${.OBJDIR}/regress/file regress/link 375 chflags -h uchg regress/link 376 chflags nodump regress/link 377 [ `${STAT} -f '%f' regress/link` == '2' ] 378 [ `${STAT} -f '%f' regress/file` == '1' ] 379 chflags -h nouchg regress/link 380 chflags dump regress/link 381 [ `${STAT} -f '%f' regress/link` == '0' ] 382 [ `${STAT} -f '%f' regress/file` == '0' ] 383 384chflags_error: 385 ${CHFLAGS} foo bar 2>chflags.err || true 386 ${DIFF} ${.CURDIR}/chflags.error chflags.err 387 388clean: 389 ${RM} -f *.err 390 ${CHMOD} -R 0700 regress 2>/dev/null || true 391 ${RM} -rf regress 392 393.PHONY: ${REGRESS_TARGETS} prepfile prepdir chown_prepfile chown_prepsymlink \ 394 chown_prepdir chflags_prepfile chflags_prepdir 395 396.include <bsd.regress.mk> 397