diff options
author | ngie <ngie@FreeBSD.org> | 2014-09-24 07:00:35 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-09-24 07:00:35 +0000 |
commit | 6634a8c77a4067ede15d14a7c86b6f11fb4908f5 (patch) | |
tree | 10a420ae0001201ee983d47b651fd700f54dbf80 /tools | |
parent | 53b2bd36c92829c420a32c55989e6ef60ad8a5b5 (diff) | |
parent | 98bbb57ebef2dfd11fa74fb1facd7fe0f16db062 (diff) | |
download | FreeBSD-src-6634a8c77a4067ede15d14a7c86b6f11fb4908f5.zip FreeBSD-src-6634a8c77a4067ede15d14a7c86b6f11fb4908f5.tar.gz |
Import pjdfstest from ^/vendor/pjdfstest/abf03c3a47745d4521b0e4aa141317553ca48f91
- Remove tools/regression/pjdfstest
- Add upgrade directions for contrib/pjdfstest
- Add a note to UPDATING for the move (the reachover Makefiles are coming
soon)
Functional differences:
- ftruncate testcases are added from upstream (github)
Non-functional differences:
- The copyright for the project has been updated to 2012
- pjd's contact information has been updated
Discussed with: -testing, jmmv, pjd
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tools')
212 files changed, 0 insertions, 10470 deletions
diff --git a/tools/regression/pjdfstest/LICENSE b/tools/regression/pjdfstest/LICENSE deleted file mode 100644 index bde2232..0000000 --- a/tools/regression/pjdfstest/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -$FreeBSD$ - -License for all regression tests available with pjdfstest: - -Copyright (c) 2006-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/tools/regression/pjdfstest/Makefile b/tools/regression/pjdfstest/Makefile deleted file mode 100644 index 18f94e9..0000000 --- a/tools/regression/pjdfstest/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD$ - -PROG= pjdfstest - -${PROG}: ${PROG}.c - @OSTYPE=`uname`; \ - CFLAGS=-D__OS_$${OSTYPE}__; \ - if [ $$OSTYPE = "FreeBSD" ]; then \ - CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_CHFLAGSAT -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT -DHAS_LPATHCONF"; \ - elif [ $$OSTYPE = "SunOS" ]; then \ - CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \ - CFLAGS="$$CFLAGS -lsocket"; \ - elif [ $$OSTYPE = "Darwin" ]; then \ - CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS"; \ - elif [ $$OSTYPE == "Linux" ]; then \ - CFLAGS="$$CFLAGS -D_GNU_SOURCE"; \ - else \ - echo "Unsupported operating system: ${OSTYPE}."; \ - exit 1; \ - fi; \ - cmd="cc -Wall $$CFLAGS ${PROG}.c -o ${PROG}"; \ - echo $$cmd; \ - $$cmd - -clean: - rm -f ${PROG} diff --git a/tools/regression/pjdfstest/README b/tools/regression/pjdfstest/README deleted file mode 100644 index fb1cda5..0000000 --- a/tools/regression/pjdfstest/README +++ /dev/null @@ -1,22 +0,0 @@ -$FreeBSD$ - -Few notes on how to use pjdfstest in short steps: - - # cd pjdfstest - # vi tests/conf - Change 'fs' to file system type you want to test (UFS or ZFS). - # vi Makefile - You need to manually tweak few things by editing CFLAGS lines - at the top of the file. - # make - It will compile pjdfstest utility which is used by regression tests. - # cd /path/to/file/system/you/want/to/test/ - # prove -r /path/to/pjdfstest/tests - -That's all. Enjoy. - -Currently supported operating systems: FreeBSD, Solaris. -Currently supported file system types: UFS, ZFS. - --- -Pawel Jakub Dawidek <pjd@FreeBSD.org> diff --git a/tools/regression/pjdfstest/pjdfstest.c b/tools/regression/pjdfstest/pjdfstest.c deleted file mode 100644 index 046df49..0000000 --- a/tools/regression/pjdfstest/pjdfstest.c +++ /dev/null @@ -1,1493 +0,0 @@ -/*- - * Copyright (c) 2006-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/socket.h> -#include <sys/un.h> -#ifndef makedev -#include <sys/mkdev.h> -#endif - -#include <assert.h> -#include <ctype.h> -#include <errno.h> -#include <fcntl.h> -#include <grp.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifndef HAS_TRUNCATE64 -#define truncate64 truncate -#define ftruncate64 ftruncate -#endif -#ifndef HAS_STAT64 -#define stat64 stat -#define fstat64 fstat -#define lstat64 lstat -#endif -#ifdef HAS_FREEBSD_ACL -#include <sys/acl.h> -#endif - -#ifndef ALLPERMS -#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) -#endif - -enum action { - ACTION_OPEN, - ACTION_OPENAT, - ACTION_CREATE, - ACTION_UNLINK, - ACTION_UNLINKAT, - ACTION_MKDIR, - ACTION_MKDIRAT, - ACTION_RMDIR, - ACTION_LINK, - ACTION_LINKAT, - ACTION_SYMLINK, - ACTION_SYMLINKAT, - ACTION_RENAME, - ACTION_RENAMEAT, - ACTION_MKFIFO, - ACTION_MKFIFOAT, - ACTION_MKNOD, - ACTION_MKNODAT, - ACTION_BIND, -#ifdef HAS_BINDAT - ACTION_BINDAT, -#endif - ACTION_CONNECT, -#ifdef HAS_CONNECTAT - ACTION_CONNECTAT, -#endif - ACTION_CHMOD, - ACTION_FCHMOD, -#ifdef HAS_LCHMOD - ACTION_LCHMOD, -#endif - ACTION_FCHMODAT, - ACTION_CHOWN, - ACTION_FCHOWN, - ACTION_LCHOWN, - ACTION_FCHOWNAT, -#ifdef HAS_CHFLAGS - ACTION_CHFLAGS, -#endif -#ifdef HAS_FCHFLAGS - ACTION_FCHFLAGS, -#endif -#ifdef HAS_CHFLAGSAT - ACTION_CHFLAGSAT, -#endif -#ifdef HAS_LCHFLAGS - ACTION_LCHFLAGS, -#endif - ACTION_TRUNCATE, - ACTION_FTRUNCATE, - ACTION_STAT, - ACTION_FSTAT, - ACTION_LSTAT, - ACTION_FSTATAT, - ACTION_PATHCONF, - ACTION_FPATHCONF, -#ifdef HAS_LPATHCONF - ACTION_LPATHCONF, -#endif -#ifdef HAS_FREEBSD_ACL - ACTION_PREPENDACL, - ACTION_READACL, -#endif - ACTION_WRITE, -}; - -#define TYPE_NONE 0x0000 -#define TYPE_STRING 0x0001 -#define TYPE_NUMBER 0x0002 -#define TYPE_DESCRIPTOR 0x0003 -#define TYPE_MASK 0x000f - -#define TYPE_OPTIONAL 0x0100 - -#define MAX_ARGS 8 - -struct syscall_desc { - const char *sd_name; - enum action sd_action; - int sd_args[MAX_ARGS]; -}; - -static struct syscall_desc syscalls[] = { - { "open", ACTION_OPEN, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } }, - { "openat", ACTION_OPENAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } }, - { "create", ACTION_CREATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "unlink", ACTION_UNLINK, { TYPE_STRING, TYPE_NONE } }, - { "unlinkat", ACTION_UNLINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "mkdir", ACTION_MKDIR, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "mkdirat", ACTION_MKDIRAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "rmdir", ACTION_RMDIR, { TYPE_STRING, TYPE_NONE } }, - { "link", ACTION_LINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "linkat", ACTION_LINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "symlink", ACTION_SYMLINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "symlinkat", ACTION_SYMLINKAT, { TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, - { "rename", ACTION_RENAME, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "renameat", ACTION_RENAMEAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, - { "mkfifo", ACTION_MKFIFO, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "mkfifoat", ACTION_MKFIFOAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "mknod", ACTION_MKNOD, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, - { "mknodat", ACTION_MKNODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, - { "bind", ACTION_BIND, { TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_BINDAT - { "bindat", ACTION_BINDAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, -#endif - { "connect", ACTION_CONNECT, { TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_CONNECTAT - { "connectat", ACTION_CONNECTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, -#endif - { "chmod", ACTION_CHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "fchmod", ACTION_FCHMOD, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } }, -#ifdef HAS_LCHMOD - { "lchmod", ACTION_LCHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, -#endif - { "fchmodat", ACTION_FCHMODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } }, - { "chown", ACTION_CHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, - { "fchown", ACTION_FCHOWN, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, - { "lchown", ACTION_LCHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, - { "fchownat", ACTION_FCHOWNAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_CHFLAGS - { "chflags", ACTION_CHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, -#endif -#ifdef HAS_FCHFLAGS - { "fchflags", ACTION_FCHFLAGS, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, -#endif -#ifdef HAS_CHFLAGSAT - { "chflagsat", ACTION_CHFLAGSAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, -#endif -#ifdef HAS_LCHFLAGS - { "lchflags", ACTION_LCHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, -#endif - { "truncate", ACTION_TRUNCATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, - { "ftruncate", ACTION_FTRUNCATE, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } }, - { "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "fstat", ACTION_FSTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, - { "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "fstatat", ACTION_FSTATAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "fpathconf", ACTION_FPATHCONF, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, -#ifdef HAS_LPATHCONF - { "lpathconf", ACTION_LPATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, -#endif -#ifdef HAS_FREEBSD_ACL - { "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, - { "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } }, -#endif - { "write", ACTION_WRITE, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, - { NULL, -1, { TYPE_NONE } } -}; - -struct flag { - long long f_flag; - const char *f_str; -}; - -static struct flag open_flags[] = { -#ifdef O_RDONLY - { O_RDONLY, "O_RDONLY" }, -#endif -#ifdef O_WRONLY - { O_WRONLY, "O_WRONLY" }, -#endif -#ifdef O_RDWR - { O_RDWR, "O_RDWR" }, -#endif -#ifdef O_NONBLOCK - { O_NONBLOCK, "O_NONBLOCK" }, -#endif -#ifdef O_APPEND - { O_APPEND, "O_APPEND" }, -#endif -#ifdef O_CREAT - { O_CREAT, "O_CREAT" }, -#endif -#ifdef O_TRUNC - { O_TRUNC, "O_TRUNC" }, -#endif -#ifdef O_EXCL - { O_EXCL, "O_EXCL" }, -#endif -#ifdef O_SHLOCK - { O_SHLOCK, "O_SHLOCK" }, -#endif -#ifdef O_EXLOCK - { O_EXLOCK, "O_EXLOCK" }, -#endif -#ifdef O_DIRECT - { O_DIRECT, "O_DIRECT" }, -#endif -#ifdef O_FSYNC - { O_FSYNC, "O_FSYNC" }, -#endif -#ifdef O_SYNC - { O_SYNC, "O_SYNC" }, -#endif -#ifdef O_NOFOLLOW - { O_NOFOLLOW, "O_NOFOLLOW" }, -#endif -#ifdef O_NOCTTY - { O_NOCTTY, "O_NOCTTY" }, -#endif -#ifdef O_DIRECTORY - { O_DIRECTORY, "O_DIRECTORY" }, -#endif - { 0, NULL } -}; - -#ifdef HAS_CHFLAGS -static struct flag chflags_flags[] = { -#ifdef UF_NODUMP - { UF_NODUMP, "UF_NODUMP" }, -#endif -#ifdef UF_IMMUTABLE - { UF_IMMUTABLE, "UF_IMMUTABLE" }, -#endif -#ifdef UF_APPEND - { UF_APPEND, "UF_APPEND" }, -#endif -#ifdef UF_NOUNLINK - { UF_NOUNLINK, "UF_NOUNLINK" }, -#endif -#ifdef UF_OPAQUE - { UF_OPAQUE, "UF_OPAQUE" }, -#endif -#ifdef SF_ARCHIVED - { SF_ARCHIVED, "SF_ARCHIVED" }, -#endif -#ifdef SF_IMMUTABLE - { SF_IMMUTABLE, "SF_IMMUTABLE" }, -#endif -#ifdef SF_APPEND - { SF_APPEND, "SF_APPEND" }, -#endif -#ifdef SF_NOUNLINK - { SF_NOUNLINK, "SF_NOUNLINK" }, -#endif -#ifdef SF_SNAPSHOT - { SF_SNAPSHOT, "SF_SNAPSHOT" }, -#endif - { 0, NULL } -}; -#endif - -static struct flag unlinkat_flags[] = { - { AT_REMOVEDIR, "AT_REMOVEDIR" }, - { 0, NULL } -}; - -static struct flag linkat_flags[] = { - { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" }, - { 0, NULL } -}; - -static struct flag chflagsat_flags[] = { - { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, - { 0, NULL } -}; - -static struct flag fchmodat_flags[] = { - { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, - { 0, NULL } -}; - -static struct flag fchownat_flags[] = { - { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, - { 0, NULL } -}; - -static struct flag fstatat_flags[] = { - { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, - { 0, NULL } -}; - -struct name { - int n_name; - const char *n_str; -}; - -static struct name pathconf_names[] = { -#ifdef _PC_LINK_MAX - { _PC_LINK_MAX, "_PC_LINK_MAX" }, -#endif -#ifdef _PC_NAME_MAX - { _PC_NAME_MAX, "_PC_NAME_MAX" }, -#endif -#ifdef _PC_PATH_MAX - { _PC_PATH_MAX, "_PC_PATH_MAX" }, -#endif -#ifdef _PC_SYMLINK_MAX - { _PC_SYMLINK_MAX, "_PC_SYMLINK_MAX" }, -#endif - { 0, NULL } -}; - -static const char *err2str(int error); - -static int *descriptors; -static int ndescriptors; - -static void -usage(void) -{ - - fprintf(stderr, "usage: pjdfstest [-U umask] [-u uid] [-g gid1[,gid2[...]]] syscall args ...\n"); - exit(1); -} - -static long long -str2flags(struct flag *tflags, char *sflags) -{ - long long flags = 0; - unsigned int i; - char *f; - - /* 'none' or '0' means no flags */ - if (strcmp(sflags, "none") == 0 || strcmp(sflags, "0") == 0) - return (0); - for (f = strtok(sflags, ",|"); f != NULL; f = strtok(NULL, ",|")) { - for (i = 0; tflags[i].f_str != NULL; i++) { - if (strcmp(tflags[i].f_str, f) == 0) - break; - } - if (tflags[i].f_str == NULL) { - fprintf(stderr, "unknown flag '%s'\n", f); - exit(1); - } - flags |= tflags[i].f_flag; - } - return (flags); -} - -#ifdef HAS_CHFLAGS -static char * -flags2str(struct flag *tflags, long long flags) -{ - static char sflags[1024]; - unsigned int i; - - sflags[0] = '\0'; - for (i = 0; tflags[i].f_str != NULL; i++) { - if (flags & tflags[i].f_flag) { - if (sflags[0] != '\0') - strlcat(sflags, ",", sizeof(sflags)); - strlcat(sflags, tflags[i].f_str, sizeof(sflags)); - } - } - if (sflags[0] == '\0') - strlcpy(sflags, "none", sizeof(sflags)); - return (sflags); -} -#endif - -static int -str2name(struct name *names, char *name) -{ - unsigned int i; - - for (i = 0; names[i].n_str != NULL; i++) { - if (strcmp(names[i].n_str, name) == 0) - return (names[i].n_name); - } - return (-1); -} - -static struct syscall_desc * -find_syscall(const char *name) -{ - int i; - - for (i = 0; syscalls[i].sd_name != NULL; i++) { - if (strcmp(syscalls[i].sd_name, name) == 0) - return (&syscalls[i]); - } - return (NULL); -} - -static void -show_stat(struct stat64 *sp, const char *what) -{ - - if (strcmp(what, "mode") == 0) - printf("0%o", (unsigned int)(sp->st_mode & ALLPERMS)); - else if (strcmp(what, "inode") == 0) - printf("%lld", (long long)sp->st_ino); - else if (strcmp(what, "nlink") == 0) - printf("%lld", (long long)sp->st_nlink); - else if (strcmp(what, "uid") == 0) - printf("%d", (int)sp->st_uid); - else if (strcmp(what, "gid") == 0) - printf("%d", (int)sp->st_gid); - else if (strcmp(what, "size") == 0) - printf("%lld", (long long)sp->st_size); - else if (strcmp(what, "blocks") == 0) - printf("%lld", (long long)sp->st_blocks); - else if (strcmp(what, "atime") == 0) - printf("%lld", (long long)sp->st_atime); - else if (strcmp(what, "mtime") == 0) - printf("%lld", (long long)sp->st_mtime); - else if (strcmp(what, "ctime") == 0) - printf("%lld", (long long)sp->st_ctime); -#ifdef HAS_CHFLAGS - else if (strcmp(what, "flags") == 0) - printf("%s", flags2str(chflags_flags, (long long)sp->st_flags)); -#endif - else if (strcmp(what, "major") == 0) - printf("%u", (unsigned int)major(sp->st_rdev)); - else if (strcmp(what, "minor") == 0) - printf("%u", (unsigned int)minor(sp->st_rdev)); - else if (strcmp(what, "type") == 0) { - switch (sp->st_mode & S_IFMT) { - case S_IFIFO: - printf("fifo"); - break; - case S_IFCHR: - printf("char"); - break; - case S_IFDIR: - printf("dir"); - break; - case S_IFBLK: - printf("block"); - break; - case S_IFREG: - printf("regular"); - break; - case S_IFLNK: - printf("symlink"); - break; - case S_IFSOCK: - printf("socket"); - break; - default: - printf("unknown"); - break; - } - } else { - printf("unknown"); - } -} - -static void -show_stats(struct stat64 *sp, char *what) -{ - const char *s = ""; - char *w; - - for (w = strtok(what, ","); w != NULL; w = strtok(NULL, ",")) { - printf("%s", s); - show_stat(sp, w); - s = ","; - } - printf("\n"); -} - -static void -descriptor_add(int fd) -{ - - ndescriptors++; - if (descriptors == NULL) { - descriptors = malloc(sizeof(descriptors[0]) * ndescriptors); - } else { - descriptors = realloc(descriptors, - sizeof(descriptors[0]) * ndescriptors); - } - assert(descriptors != NULL); - descriptors[ndescriptors - 1] = fd; -} - -static int -descriptor_get(int pos) -{ - - if (pos < 0 || pos >= ndescriptors) { - fprintf(stderr, "invalid descriptor %d\n", pos); - exit(1); - } - - return (descriptors[pos]); -} - -static unsigned int -call_syscall(struct syscall_desc *scall, char *argv[]) -{ - struct stat64 sb; - long long flags; - unsigned int i; - char *endp; - int name, rval; - union { - char *str; - long long num; - } args[MAX_ARGS]; -#ifdef HAS_FREEBSD_ACL - int entry_id = ACL_FIRST_ENTRY; - acl_t acl, newacl; - acl_entry_t entry, newentry; -#endif - - /* - * Verify correctness of the arguments. - */ - for (i = 0; i < sizeof(args)/sizeof(args[0]); i++) { - if (scall->sd_args[i] == TYPE_NONE) { - if (argv[i] == NULL || strcmp(argv[i], ":") == 0) - break; - fprintf(stderr, "too many arguments [%s]\n", argv[i]); - exit(1); - } else { - if (argv[i] == NULL || strcmp(argv[i], ":") == 0) { - if (scall->sd_args[i] & TYPE_OPTIONAL) - break; - fprintf(stderr, "too few arguments\n"); - exit(1); - } - if ((scall->sd_args[i] & TYPE_MASK) == TYPE_STRING) { - if (strcmp(argv[i], "NULL") == 0) - args[i].str = NULL; - else if (strcmp(argv[i], "DEADCODE") == 0) - args[i].str = (void *)0xdeadc0de; - else - args[i].str = argv[i]; - } else if ((scall->sd_args[i] & TYPE_MASK) == - TYPE_NUMBER) { - args[i].num = strtoll(argv[i], &endp, 0); - if (*endp != '\0' && - !isspace((unsigned char)*endp)) { - fprintf(stderr, - "invalid argument %u, number expected [%s]\n", - i, endp); - exit(1); - } - } else if ((scall->sd_args[i] & TYPE_MASK) == - TYPE_DESCRIPTOR) { - if (strcmp(argv[i], "AT_FDCWD") == 0) { - args[i].num = AT_FDCWD; - } else if (strcmp(argv[i], "BADFD") == 0) { - /* In case AT_FDCWD is -1 on some systems... */ - if (AT_FDCWD == -1) - args[i].num = -2; - else - args[i].num = -1; - } else { - int pos; - - pos = strtoll(argv[i], &endp, 0); - if (*endp != '\0' && - !isspace((unsigned char)*endp)) { - fprintf(stderr, - "invalid argument %u, number expected [%s]\n", - i, endp); - exit(1); - } - args[i].num = descriptor_get(pos); - } - } - } - } - /* - * Call the given syscall. - */ -#define NUM(n) (args[(n)].num) -#define STR(n) (args[(n)].str) - switch (scall->sd_action) { - case ACTION_OPEN: - flags = str2flags(open_flags, STR(1)); - if (flags & O_CREAT) { - if (i == 2) { - fprintf(stderr, "too few arguments\n"); - exit(1); - } - rval = open(STR(0), (int)flags, (mode_t)NUM(2)); - } else { - if (i == 3) { - fprintf(stderr, "too many arguments\n"); - exit(1); - } - rval = open(STR(0), (int)flags); - } - if (rval >= 0) - descriptor_add(rval); - break; - case ACTION_OPENAT: - flags = str2flags(open_flags, STR(2)); - if (flags & O_CREAT) { - if (i == 3) { - fprintf(stderr, "too few arguments\n"); - exit(1); - } - rval = openat(NUM(0), STR(1), (int)flags, - (mode_t)NUM(3)); - } else { - if (i == 4) { - fprintf(stderr, "too many arguments\n"); - exit(1); - } - rval = openat(NUM(0), STR(1), (int)flags); - } - if (rval >= 0) - descriptor_add(rval); - break; - case ACTION_CREATE: - rval = open(STR(0), O_CREAT | O_EXCL, (mode_t)NUM(1)); - if (rval >= 0) - close(rval); - break; - case ACTION_UNLINK: - rval = unlink(STR(0)); - break; - case ACTION_UNLINKAT: - rval = unlinkat(NUM(0), STR(1), - (int)str2flags(unlinkat_flags, STR(2))); - break; - case ACTION_MKDIR: - rval = mkdir(STR(0), (mode_t)NUM(1)); - break; - case ACTION_MKDIRAT: - rval = mkdirat(NUM(0), STR(1), (mode_t)NUM(2)); - break; - case ACTION_RMDIR: - rval = rmdir(STR(0)); - break; - case ACTION_LINK: - rval = link(STR(0), STR(1)); - break; - case ACTION_LINKAT: - rval = linkat(NUM(0), STR(1), NUM(2), STR(3), - (int)str2flags(linkat_flags, STR(4))); - break; - case ACTION_SYMLINK: - rval = symlink(STR(0), STR(1)); - break; - case ACTION_SYMLINKAT: - rval = symlinkat(STR(0), NUM(1), STR(2)); - break; - case ACTION_RENAME: - rval = rename(STR(0), STR(1)); - break; - case ACTION_RENAMEAT: - rval = renameat(NUM(0), STR(1), NUM(2), STR(3)); - break; - case ACTION_MKFIFO: - rval = mkfifo(STR(0), (mode_t)NUM(1)); - break; - case ACTION_MKFIFOAT: - rval = mkfifoat(NUM(0), STR(1), (mode_t)NUM(2)); - break; - case ACTION_MKNOD: - case ACTION_MKNODAT: - { - mode_t ntype; - dev_t dev; - int fa; - - switch (scall->sd_action) { - case ACTION_MKNOD: - fa = 0; - break; - case ACTION_MKNODAT: - fa = 1; - break; - default: - abort(); - } - - dev = makedev(NUM(fa + 3), NUM(fa + 4)); - if (strcmp(STR(fa + 1), "c") == 0) /* character device */ - ntype = S_IFCHR; - else if (strcmp(STR(fa + 1), "b") == 0) /* block device */ - ntype = S_IFBLK; - else if (strcmp(STR(fa + 1), "f") == 0) /* fifo special */ - ntype = S_IFIFO; - else if (strcmp(STR(fa + 1), "d") == 0) /* directory */ - ntype = S_IFDIR; - else if (strcmp(STR(fa + 1), "o") == 0) /* regular file */ - ntype = S_IFREG; - else { - fprintf(stderr, "wrong argument 1\n"); - exit(1); - } - switch (scall->sd_action) { - case ACTION_MKNOD: - rval = mknod(STR(0), ntype | NUM(2), dev); - break; - case ACTION_MKNODAT: - rval = mknodat(NUM(0), STR(1), ntype | NUM(3), dev); - break; - default: - abort(); - } - break; - } - case ACTION_BIND: - { - struct sockaddr_un sunx; - - sunx.sun_family = AF_UNIX; - strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1); - sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; - rval = socket(AF_UNIX, SOCK_STREAM, 0); - if (rval < 0) - break; - rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx)); - break; - } -#ifdef HAS_BINDAT - case ACTION_BINDAT: - { - struct sockaddr_un sunx; - - sunx.sun_family = AF_UNIX; - strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1); - sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; - rval = socket(AF_UNIX, SOCK_STREAM, 0); - if (rval < 0) - break; - rval = bindat(NUM(0), rval, (struct sockaddr *)&sunx, - sizeof(sunx)); - break; - } -#endif - case ACTION_CONNECT: - { - struct sockaddr_un sunx; - - sunx.sun_family = AF_UNIX; - strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1); - sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; - rval = socket(AF_UNIX, SOCK_STREAM, 0); - if (rval < 0) - break; - rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx)); - break; - } -#ifdef HAS_CONNECTAT - case ACTION_CONNECTAT: - { - struct sockaddr_un sunx; - - sunx.sun_family = AF_UNIX; - strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1); - sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; - rval = socket(AF_UNIX, SOCK_STREAM, 0); - if (rval < 0) - break; - rval = connectat(NUM(0), rval, (struct sockaddr *)&sunx, - sizeof(sunx)); - break; - } -#endif - case ACTION_CHMOD: - rval = chmod(STR(0), (mode_t)NUM(1)); - break; - case ACTION_FCHMOD: - rval = fchmod(NUM(0), (mode_t)NUM(1)); - break; -#ifdef HAS_LCHMOD - case ACTION_LCHMOD: - rval = lchmod(STR(0), (mode_t)NUM(1)); - break; -#endif - case ACTION_FCHMODAT: - rval = fchmodat(NUM(0), STR(1), (mode_t)NUM(2), - str2flags(fchmodat_flags, STR(3))); - break; - case ACTION_CHOWN: - rval = chown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); - break; - case ACTION_FCHOWN: - rval = fchown(NUM(0), (uid_t)NUM(1), (gid_t)NUM(2)); - break; - case ACTION_LCHOWN: - rval = lchown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); - break; - case ACTION_FCHOWNAT: - rval = fchownat(NUM(0), STR(1), (uid_t)NUM(2), (gid_t)NUM(3), - (int)str2flags(fchownat_flags, STR(4))); - break; -#ifdef HAS_CHFLAGS - case ACTION_CHFLAGS: - rval = chflags(STR(0), - (unsigned long)str2flags(chflags_flags, STR(1))); - break; -#endif -#ifdef HAS_FCHFLAGS - case ACTION_FCHFLAGS: - rval = fchflags(NUM(0), - (unsigned long)str2flags(chflags_flags, STR(1))); - break; -#endif -#ifdef HAS_CHFLAGSAT - case ACTION_CHFLAGSAT: - rval = chflagsat(NUM(0), STR(1), - (unsigned long)str2flags(chflags_flags, STR(2)), - (int)str2flags(chflagsat_flags, STR(3))); - break; -#endif -#ifdef HAS_LCHFLAGS - case ACTION_LCHFLAGS: - rval = lchflags(STR(0), - (unsigned long)str2flags(chflags_flags, STR(1))); - break; -#endif - case ACTION_TRUNCATE: - rval = truncate64(STR(0), NUM(1)); - break; - case ACTION_FTRUNCATE: - rval = ftruncate64(NUM(0), NUM(1)); - break; - case ACTION_STAT: - rval = stat64(STR(0), &sb); - if (rval == 0) { - show_stats(&sb, STR(1)); - return (i); - } - break; - case ACTION_FSTAT: - rval = fstat64(NUM(0), &sb); - if (rval == 0) { - show_stats(&sb, STR(1)); - return (i); - } - break; - case ACTION_LSTAT: - rval = lstat64(STR(0), &sb); - if (rval == 0) { - show_stats(&sb, STR(1)); - return (i); - } - break; - case ACTION_FSTATAT: - rval = fstatat(NUM(0), STR(1), &sb, - (int)str2flags(fstatat_flags, STR(2))); - if (rval == 0) { - show_stats(&sb, STR(3)); - return (i); - } - break; - case ACTION_PATHCONF: - case ACTION_FPATHCONF: -#ifdef HAS_LPATHCONF - case ACTION_LPATHCONF: -#endif - { - long lrval; - - name = str2name(pathconf_names, STR(1)); - if (name == -1) { - fprintf(stderr, "unknown name %s", STR(1)); - exit(1); - } - errno = 0; - switch (scall->sd_action) { - case ACTION_PATHCONF: - lrval = pathconf(STR(0), name); - break; - case ACTION_FPATHCONF: - lrval = fpathconf(NUM(0), name); - break; -#ifdef HAS_LPATHCONF - case ACTION_LPATHCONF: - lrval = lpathconf(STR(0), name); - break; -#endif - default: - abort(); - } - if (lrval == -1 && errno == 0) { - printf("unlimited\n"); - return (i); - } else if (lrval >= 0) { - printf("%ld\n", lrval); - return (i); - } - rval = -1; - break; - } -#ifdef HAS_FREEBSD_ACL - case ACTION_PREPENDACL: - rval = -1; - - acl = acl_get_file(STR(0), ACL_TYPE_NFS4); - if (acl == NULL) - break; - - newacl = acl_from_text(STR(1)); - if (acl == NULL) - break; - - while (acl_get_entry(newacl, entry_id, &newentry) == 1) { - entry_id = ACL_NEXT_ENTRY; - - if (acl_create_entry_np(&acl, &entry, 0)) - break; - - if (acl_copy_entry(entry, newentry)) - break; - } - - rval = acl_set_file(STR(0), ACL_TYPE_NFS4, acl); - break; - case ACTION_READACL: - acl = acl_get_file(STR(0), ACL_TYPE_NFS4); - if (acl == NULL) - rval = -1; - else - rval = 0; - break; -#endif - case ACTION_WRITE: - rval = write(NUM(0), STR(1), strlen(STR(1))); - break; - default: - fprintf(stderr, "unsupported syscall\n"); - exit(1); - } -#undef STR -#undef NUM - if (rval < 0) { - const char *serrno; - - serrno = err2str(errno); - fprintf(stderr, "%s returned %d\n", scall->sd_name, rval); - printf("%s\n", serrno); - exit(1); - } - printf("0\n"); - return (i); -} - -static void -set_gids(char *gids) -{ - gid_t *gidset; - long ngroups; - char *g, *endp; - unsigned i; - - ngroups = sysconf(_SC_NGROUPS_MAX); - assert(ngroups > 0); - gidset = malloc(sizeof(*gidset) * ngroups); - assert(gidset != NULL); - for (i = 0, g = strtok(gids, ","); g != NULL; - g = strtok(NULL, ","), i++) { - if (i >= ngroups) { - fprintf(stderr, "too many gids\n"); - exit(1); - } - gidset[i] = strtol(g, &endp, 0); - if (*endp != '\0' && !isspace((unsigned char)*endp)) { - fprintf(stderr, "invalid gid '%s' - number expected\n", - g); - exit(1); - } - } - if (setgroups(i, gidset) < 0) { - fprintf(stderr, "cannot change groups: %s\n", strerror(errno)); - exit(1); - } - if (setegid(gidset[0]) < 0) { - fprintf(stderr, "cannot change effective gid: %s\n", - strerror(errno)); - exit(1); - } - free(gidset); -} - -int -main(int argc, char *argv[]) -{ - struct syscall_desc *scall; - unsigned int n; - char *gids, *endp; - int uid, umsk, ch; - - uid = -1; - gids = NULL; - umsk = 0; - - while ((ch = getopt(argc, argv, "g:u:U:")) != -1) { - switch(ch) { - case 'g': - gids = optarg; - break; - case 'u': - uid = (int)strtol(optarg, &endp, 0); - if (*endp != '\0' && !isspace((unsigned char)*endp)) { - fprintf(stderr, "invalid uid '%s' - number " - "expected\n", optarg); - exit(1); - } - break; - case 'U': - umsk = (int)strtol(optarg, &endp, 0); - if (*endp != '\0' && !isspace((unsigned char)*endp)) { - fprintf(stderr, "invalid umask '%s' - number " - "expected\n", optarg); - exit(1); - } - break; - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if (argc < 1) { - fprintf(stderr, "too few arguments\n"); - usage(); - } - - if (gids != NULL) { - fprintf(stderr, "changing groups to %s\n", gids); - set_gids(gids); - } - if (uid != -1) { - fprintf(stderr, "changing uid to %d\n", uid); - if (setuid(uid) < 0) { - fprintf(stderr, "cannot change uid: %s\n", - strerror(errno)); - exit(1); - } - } - - /* Change umask to requested value or to 0, if not requested. */ - umask(umsk); - - for (;;) { - scall = find_syscall(argv[0]); - if (scall == NULL) { - fprintf(stderr, "syscall '%s' not supported\n", - argv[0]); - exit(1); - } - argc++; - argv++; - n = call_syscall(scall, argv); - argc += n; - argv += n; - if (argv[0] == NULL) - break; - argc++; - argv++; - } - - exit(0); -} - -static const char * -err2str(int error) -{ - static char errnum[8]; - - switch (error) { -#ifdef EPERM - case EPERM: - return ("EPERM"); -#endif -#ifdef ENOENT - case ENOENT: - return ("ENOENT"); -#endif -#ifdef ESRCH - case ESRCH: - return ("ESRCH"); -#endif -#ifdef EINTR - case EINTR: - return ("EINTR"); -#endif -#ifdef EIO - case EIO: - return ("EIO"); -#endif -#ifdef ENXIO - case ENXIO: - return ("ENXIO"); -#endif -#ifdef E2BIG - case E2BIG: - return ("E2BIG"); -#endif -#ifdef ENOEXEC - case ENOEXEC: - return ("ENOEXEC"); -#endif -#ifdef EBADF - case EBADF: - return ("EBADF"); -#endif -#ifdef ECHILD - case ECHILD: - return ("ECHILD"); -#endif -#ifdef EDEADLK - case EDEADLK: - return ("EDEADLK"); -#endif -#ifdef ENOMEM - case ENOMEM: - return ("ENOMEM"); -#endif -#ifdef EACCES - case EACCES: - return ("EACCES"); -#endif -#ifdef EFAULT - case EFAULT: - return ("EFAULT"); -#endif -#ifdef ENOTBLK - case ENOTBLK: - return ("ENOTBLK"); -#endif -#ifdef EBUSY - case EBUSY: - return ("EBUSY"); -#endif -#ifdef EEXIST - case EEXIST: - return ("EEXIST"); -#endif -#ifdef EXDEV - case EXDEV: - return ("EXDEV"); -#endif -#ifdef ENODEV - case ENODEV: - return ("ENODEV"); -#endif -#ifdef ENOTDIR - case ENOTDIR: - return ("ENOTDIR"); -#endif -#ifdef EISDIR - case EISDIR: - return ("EISDIR"); -#endif -#ifdef EINVAL - case EINVAL: - return ("EINVAL"); -#endif -#ifdef ENFILE - case ENFILE: - return ("ENFILE"); -#endif -#ifdef EMFILE - case EMFILE: - return ("EMFILE"); -#endif -#ifdef ENOTTY - case ENOTTY: - return ("ENOTTY"); -#endif -#ifdef ETXTBSY - case ETXTBSY: - return ("ETXTBSY"); -#endif -#ifdef EFBIG - case EFBIG: - return ("EFBIG"); -#endif -#ifdef ENOSPC - case ENOSPC: - return ("ENOSPC"); -#endif -#ifdef ESPIPE - case ESPIPE: - return ("ESPIPE"); -#endif -#ifdef EROFS - case EROFS: - return ("EROFS"); -#endif -#ifdef EMLINK - case EMLINK: - return ("EMLINK"); -#endif -#ifdef EPIPE - case EPIPE: - return ("EPIPE"); -#endif -#ifdef EDOM - case EDOM: - return ("EDOM"); -#endif -#ifdef ERANGE - case ERANGE: - return ("ERANGE"); -#endif -#ifdef EAGAIN - case EAGAIN: - return ("EAGAIN"); -#endif -#ifdef EINPROGRESS - case EINPROGRESS: - return ("EINPROGRESS"); -#endif -#ifdef EALREADY - case EALREADY: - return ("EALREADY"); -#endif -#ifdef ENOTSOCK - case ENOTSOCK: - return ("ENOTSOCK"); -#endif -#ifdef EDESTADDRREQ - case EDESTADDRREQ: - return ("EDESTADDRREQ"); -#endif -#ifdef EMSGSIZE - case EMSGSIZE: - return ("EMSGSIZE"); -#endif -#ifdef EPROTOTYPE - case EPROTOTYPE: - return ("EPROTOTYPE"); -#endif -#ifdef ENOPROTOOPT - case ENOPROTOOPT: - return ("ENOPROTOOPT"); -#endif -#ifdef EPROTONOSUPPORT - case EPROTONOSUPPORT: - return ("EPROTONOSUPPORT"); -#endif -#ifdef ESOCKTNOSUPPORT - case ESOCKTNOSUPPORT: - return ("ESOCKTNOSUPPORT"); -#endif -#ifdef EOPNOTSUPP - case EOPNOTSUPP: - return ("EOPNOTSUPP"); -#endif -#ifdef EPFNOSUPPORT - case EPFNOSUPPORT: - return ("EPFNOSUPPORT"); -#endif -#ifdef EAFNOSUPPORT - case EAFNOSUPPORT: - return ("EAFNOSUPPORT"); -#endif -#ifdef EADDRINUSE - case EADDRINUSE: - return ("EADDRINUSE"); -#endif -#ifdef EADDRNOTAVAIL - case EADDRNOTAVAIL: - return ("EADDRNOTAVAIL"); -#endif -#ifdef ENETDOWN - case ENETDOWN: - return ("ENETDOWN"); -#endif -#ifdef ENETUNREACH - case ENETUNREACH: - return ("ENETUNREACH"); -#endif -#ifdef ENETRESET - case ENETRESET: - return ("ENETRESET"); -#endif -#ifdef ECONNABORTED - case ECONNABORTED: - return ("ECONNABORTED"); -#endif -#ifdef ECONNRESET - case ECONNRESET: - return ("ECONNRESET"); -#endif -#ifdef ENOBUFS - case ENOBUFS: - return ("ENOBUFS"); -#endif -#ifdef EISCONN - case EISCONN: - return ("EISCONN"); -#endif -#ifdef ENOTCONN - case ENOTCONN: - return ("ENOTCONN"); -#endif -#ifdef ESHUTDOWN - case ESHUTDOWN: - return ("ESHUTDOWN"); -#endif -#ifdef ETOOMANYREFS - case ETOOMANYREFS: - return ("ETOOMANYREFS"); -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: - return ("ETIMEDOUT"); -#endif -#ifdef ECONNREFUSED - case ECONNREFUSED: - return ("ECONNREFUSED"); -#endif -#ifdef ELOOP - case ELOOP: - return ("ELOOP"); -#endif -#ifdef ENAMETOOLONG - case ENAMETOOLONG: - return ("ENAMETOOLONG"); -#endif -#ifdef EHOSTDOWN - case EHOSTDOWN: - return ("EHOSTDOWN"); -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: - return ("EHOSTUNREACH"); -#endif -#ifdef ENOTEMPTY - case ENOTEMPTY: - return ("ENOTEMPTY"); -#endif -#ifdef EPROCLIM - case EPROCLIM: - return ("EPROCLIM"); -#endif -#ifdef EUSERS - case EUSERS: - return ("EUSERS"); -#endif -#ifdef EDQUOT - case EDQUOT: - return ("EDQUOT"); -#endif -#ifdef ESTALE - case ESTALE: - return ("ESTALE"); -#endif -#ifdef EREMOTE - case EREMOTE: - return ("EREMOTE"); -#endif -#ifdef EBADRPC - case EBADRPC: - return ("EBADRPC"); -#endif -#ifdef ERPCMISMATCH - case ERPCMISMATCH: - return ("ERPCMISMATCH"); -#endif -#ifdef EPROGUNAVAIL - case EPROGUNAVAIL: - return ("EPROGUNAVAIL"); -#endif -#ifdef EPROGMISMATCH - case EPROGMISMATCH: - return ("EPROGMISMATCH"); -#endif -#ifdef EPROCUNAVAIL - case EPROCUNAVAIL: - return ("EPROCUNAVAIL"); -#endif -#ifdef ENOLCK - case ENOLCK: - return ("ENOLCK"); -#endif -#ifdef ENOSYS - case ENOSYS: - return ("ENOSYS"); -#endif -#ifdef EFTYPE - case EFTYPE: - return ("EFTYPE"); -#endif -#ifdef EAUTH - case EAUTH: - return ("EAUTH"); -#endif -#ifdef ENEEDAUTH - case ENEEDAUTH: - return ("ENEEDAUTH"); -#endif -#ifdef EIDRM - case EIDRM: - return ("EIDRM"); -#endif -#ifdef ENOMSG - case ENOMSG: - return ("ENOMSG"); -#endif -#ifdef EOVERFLOW - case EOVERFLOW: - return ("EOVERFLOW"); -#endif -#ifdef ECANCELED - case ECANCELED: - return ("ECANCELED"); -#endif -#ifdef EILSEQ - case EILSEQ: - return ("EILSEQ"); -#endif -#ifdef ENOATTR - case ENOATTR: - return ("ENOATTR"); -#endif -#ifdef EDOOFUS - case EDOOFUS: - return ("EDOOFUS"); -#endif -#ifdef EBADMSG - case EBADMSG: - return ("EBADMSG"); -#endif -#ifdef EMULTIHOP - case EMULTIHOP: - return ("EMULTIHOP"); -#endif -#ifdef ENOLINK - case ENOLINK: - return ("ENOLINK"); -#endif -#ifdef EPROTO - case EPROTO: - return ("EPROTO"); -#endif - default: - snprintf(errnum, sizeof(errnum), "%d", error); - return (errnum); - } -} diff --git a/tools/regression/pjdfstest/tests/chflags/00.t b/tools/regression/pjdfstest/tests/chflags/00.t deleted file mode 100644 index b233b8e..0000000 --- a/tools/regression/pjdfstest/tests/chflags/00.t +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags changes flags" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:UFS) - allflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE" - systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - - echo "1..742" - ;; -FreeBSD:ZFS) - allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - userflags="UF_NODUMP" - systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - - echo "1..482" - ;; -*) - quick_exit - ;; -esac - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -for type in regular dir fifo block char socket; do - create_file ${type} ${n0} - expect none stat ${n0} flags - expect 0 chflags ${n0} ${allflags} - expect ${allflags} stat ${n0} flags - expect 0 chflags ${n0} ${userflags} - expect ${userflags} stat ${n0} flags - expect 0 chflags ${n0} ${systemflags} - expect ${systemflags} stat ${n0} flags - expect 0 chflags ${n0} none - expect none stat ${n0} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - - create_file ${type} ${n0} - expect none stat ${n0} flags - expect 0 lchflags ${n0} ${allflags} - expect ${allflags} stat ${n0} flags - expect 0 lchflags ${n0} ${userflags} - expect ${userflags} stat ${n0} flags - expect 0 lchflags ${n0} ${systemflags} - expect ${systemflags} stat ${n0} flags - expect 0 lchflags ${n0} none - expect none stat ${n0} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -expect 0 create ${n0} 0644 -expect 0 symlink ${n0} ${n1} -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${allflags} -expect ${allflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${userflags} -expect ${userflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} ${systemflags} -expect ${systemflags} stat ${n1} flags -expect none lstat ${n1} flags -expect 0 chflags ${n1} none -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 symlink ${n0} ${n1} -expect none stat ${n1} flags -expect none lstat ${n1} flags -expect 0 lchflags ${n1} ${allflags} -expect ${allflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} ${userflags} -expect ${userflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} ${systemflags} -expect ${systemflags} lstat ${n1} flags -expect none stat ${n1} flags -expect 0 lchflags ${n1} none -expect none lstat ${n1} flags -expect none stat ${n1} flags -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -# successful chflags(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# unsuccessful chflags(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/chflags/01.t b/tools/regression/pjdfstest/tests/chflags/01.t deleted file mode 100644 index b71951b..0000000 --- a/tools/regression/pjdfstest/tests/chflags/01.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chflags ${n0}/${n1}/test SF_IMMUTABLE - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/02.t b/tools/regression/pjdfstest/tests/chflags/02.t deleted file mode 100644 index b64345b..0000000 --- a/tools/regression/pjdfstest/tests/chflags/02.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..12" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 chflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE - -expect 0 create ${nx} 0644 -expect 0 lchflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 lchflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE diff --git a/tools/regression/pjdfstest/tests/chflags/03.t b/tools/regression/pjdfstest/tests/chflags/03.t deleted file mode 100644 index 9552831..0000000 --- a/tools/regression/pjdfstest/tests/chflags/03.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..12" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 chflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE - -expect 0 create ${nx} 0644 -expect 0 lchflags ${nx} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${nx} flags -expect 0 lchflags ${nx} none -expect 0 unlink ${nx} -expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/chflags/04.t b/tools/regression/pjdfstest/tests/chflags/04.t deleted file mode 100644 index 591ae69..0000000 --- a/tools/regression/pjdfstest/tests/chflags/04.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chflags ${n0}/${n1}/test SF_IMMUTABLE -expect ENOENT chflags ${n0}/${n1} SF_IMMUTABLE -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/05.t b/tools/regression/pjdfstest/tests/chflags/05.t deleted file mode 100644 index 7409798..0000000 --- a/tools/regression/pjdfstest/tests/chflags/05.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..16" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP -expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP -expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags -expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/06.t b/tools/regression/pjdfstest/tests/chflags/06.t deleted file mode 100644 index ae5973e..0000000 --- a/tools/regression/pjdfstest/tests/chflags/06.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chflags ${n0}/test SF_IMMUTABLE -expect ELOOP chflags ${n1}/test SF_IMMUTABLE -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/chflags/07.t b/tools/regression/pjdfstest/tests/chflags/07.t deleted file mode 100644 index 5d898d8..0000000 --- a/tools/regression/pjdfstest/tests/chflags/07.t +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EPERM when the effective user ID does not match the owner of the file and the effective user ID is not the super-user" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..93" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect none stat ${n1} flags - expect 0 chown ${n1} 65534 65534 - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect none stat ${n1} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect none lstat ${n1} flags - expect 0 lchown ${n1} 65534 65534 - expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect none lstat ${n1} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/08.t b/tools/regression/pjdfstest/tests/chflags/08.t deleted file mode 100644 index 18d593d..0000000 --- a/tools/regression/pjdfstest/tests/chflags/08.t +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and the user is not the super-user" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..249" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - done - expect 0 chflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect 0 lchown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 lchflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - done - expect 0 lchflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/09.t b/tools/regression/pjdfstest/tests/chflags/09.t deleted file mode 100644 index e40d7a8..0000000 --- a/tools/regression/pjdfstest/tests/chflags/09.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and securelevel is greater than 0" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..327" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -old=`sysctl -n security.jail.chflags_allowed` -sysctl security.jail.chflags_allowed=1 >/dev/null - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - done - expect 0 chflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect 0 lchown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 lchflags ${n1} ${flag} - jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - done - expect 0 lchflags ${n1} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -sysctl security.jail.chflags_allowed=${old} >/dev/null -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/10.t b/tools/regression/pjdfstest/tests/chflags/10.t deleted file mode 100644 index 55f0be6..0000000 --- a/tools/regression/pjdfstest/tests/chflags/10.t +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EPERM if non-super-user tries to set one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..197" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} - expect none stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} - expect none stat ${n1} flags - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect 0 lchown ${n1} 65534 65534 - for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag} - expect none lstat ${n1} flags - expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag} - expect none lstat ${n1} flags - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/11.t b/tools/regression/pjdfstest/tests/chflags/11.t deleted file mode 100644 index 19af411..0000000 --- a/tools/regression/pjdfstest/tests/chflags/11.t +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags_SF_SNAPSHOT - -echo "1..145" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT - expect none stat ${n1} flags - expect EPERM chflags ${n1} SF_SNAPSHOT - expect none stat ${n1} flags - expect 0 chown ${n1} 65534 65534 - expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT - expect none stat ${n1} flags - expect EPERM chflags ${n1} SF_SNAPSHOT - expect none stat ${n1} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - create_file ${type} ${n1} - expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT - expect none lstat ${n1} flags - expect EPERM lchflags ${n1} SF_SNAPSHOT - expect none lstat ${n1} flags - expect 0 lchown ${n1} 65534 65534 - expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT - expect none lstat ${n1} flags - expect EPERM lchflags ${n1} SF_SNAPSHOT - expect none lstat ${n1} flags - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chflags/12.t b/tools/regression/pjdfstest/tests/chflags/12.t deleted file mode 100644 index 950458e..0000000 --- a/tools/regression/pjdfstest/tests/chflags/12.t +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:UFS) - echo "1..14" - - n0=`namegen` - n1=`namegen` - - expect 0 mkdir ${n0} 0755 - n=`mdconfig -a -n -t malloc -s 1m` - newfs /dev/md${n} >/dev/null - mount /dev/md${n} ${n0} - expect 0 create ${n0}/${n1} 0644 - expect 0 chflags ${n0}/${n1} UF_IMMUTABLE - expect UF_IMMUTABLE stat ${n0}/${n1} flags - expect 0 chflags ${n0}/${n1} none - expect none stat ${n0}/${n1} flags - mount -ur /dev/md${n} - expect EROFS chflags ${n0}/${n1} UF_IMMUTABLE - expect none stat ${n0}/${n1} flags - mount -uw /dev/md${n} - expect 0 chflags ${n0}/${n1} UF_IMMUTABLE - expect UF_IMMUTABLE stat ${n0}/${n1} flags - expect 0 chflags ${n0}/${n1} none - expect none stat ${n0}/${n1} flags - expect 0 unlink ${n0}/${n1} - umount /dev/md${n} - mdconfig -d -u ${n} - expect 0 rmdir ${n0} - ;; -FreeBSD:ZFS) - echo "1..12" - - n0=`namegen` - n1=`namegen` - - n=`mdconfig -a -n -t malloc -s 128m` - zpool create ${n0} /dev/md${n} - expect 0 create /${n0}/${n1} 0644 - expect 0 chflags /${n0}/${n1} UF_NODUMP - expect UF_NODUMP stat /${n0}/${n1} flags - expect 0 chflags /${n0}/${n1} none - expect none stat /${n0}/${n1} flags - zfs set readonly=on ${n0} - expect EROFS chflags /${n0}/${n1} UF_NODUMP - expect none stat /${n0}/${n1} flags - zfs set readonly=off ${n0} - expect 0 chflags /${n0}/${n1} UF_NODUMP - expect UF_NODUMP stat /${n0}/${n1} flags - expect 0 chflags /${n0}/${n1} none - expect none stat /${n0}/${n1} flags - expect 0 unlink /${n0}/${n1} - zpool destroy ${n0} - mdconfig -d -u ${n} - ;; -*) - quick_exit - ;; -esac diff --git a/tools/regression/pjdfstest/tests/chflags/13.t b/tools/regression/pjdfstest/tests/chflags/13.t deleted file mode 100644 index 247246a..0000000 --- a/tools/regression/pjdfstest/tests/chflags/13.t +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chflags returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..2" - -expect EFAULT chflags NULL UF_NODUMP -expect EFAULT chflags DEADCODE UF_NODUMP diff --git a/tools/regression/pjdfstest/tests/chmod/00.t b/tools/regression/pjdfstest/tests/chmod/00.t deleted file mode 100644 index 311a8c8..0000000 --- a/tools/regression/pjdfstest/tests/chmod/00.t +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod changes permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..203" -else - echo "1..119" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - expect 0 chmod ${n0} 0111 - expect 0111 stat ${n0} mode - - expect 0 symlink ${n0} ${n1} - mode=`${fstest} lstat ${n1} mode` - expect 0 chmod ${n1} 0222 - expect 0222 stat ${n1} mode - expect 0222 stat ${n0} mode - expect ${mode} lstat ${n1} mode - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - expect 0 lchmod ${n0} 0111 - expect 0111 lstat ${n0} mode - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# successful chmod(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chmod ${n0} 0111 - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchmod ${n0} 0111 - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# unsuccessful chmod(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chmod ${n0} 0111 - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if supported lchmod; then - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 lchmod ${n0} 0321 - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# POSIX: If the calling process does not have appropriate privileges, and if -# the group ID of the file does not match the effective group ID or one of the -# supplementary group IDs and if the file is a regular file, bit S_ISGID -# (set-group-ID on execution) in the file's mode shall be cleared upon -# successful return from chmod(). - -expect 0 create ${n0} 0755 -expect 0 chown ${n0} 65535 65535 -expect 0 -u 65535 -g 65535 chmod ${n0} 02755 -expect 02755 stat ${n0} mode -expect 0 -u 65535 -g 65535 chmod ${n0} 0755 -expect 0755 stat ${n0} mode - -todo FreeBSD "S_ISGID should be removed and chmod(2) should success and FreeBSD returns EPERM." -expect 0 -u 65535 -g 65534 chmod ${n0} 02755 -expect 0755 stat ${n0} mode - -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/chmod/01.t b/tools/regression/pjdfstest/tests/chmod/01.t deleted file mode 100644 index 49164e7..0000000 --- a/tools/regression/pjdfstest/tests/chmod/01.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chmod ${n0}/${n1}/test 0644 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/02.t b/tools/regression/pjdfstest/tests/chmod/02.t deleted file mode 100644 index ece2b6c..0000000 --- a/tools/regression/pjdfstest/tests/chmod/02.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chmod ${nx} 0620 -expect 0620 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG chmod ${nxx} 0620 - -expect 0 create ${nx} 0644 -expect 0 lchmod ${nx} 0620 -expect 0620 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG lchmod ${nxx} 0620 diff --git a/tools/regression/pjdfstest/tests/chmod/03.t b/tools/regression/pjdfstest/tests/chmod/03.t deleted file mode 100644 index 30261d5..0000000 --- a/tools/regression/pjdfstest/tests/chmod/03.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chmod ${nx} 0642 -expect 0642 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG chmod ${nxx} 0642 - -expect 0 create ${nx} 0644 -expect 0 lchmod ${nx} 0642 -expect 0642 stat ${nx} mode -expect 0 unlink ${nx} -expect ENAMETOOLONG lchmod ${nxx} 0642 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/chmod/04.t b/tools/regression/pjdfstest/tests/chmod/04.t deleted file mode 100644 index a125ae2..0000000 --- a/tools/regression/pjdfstest/tests/chmod/04.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..9" -else - echo "1..7" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chmod ${n0}/${n1}/test 0644 -expect ENOENT chmod ${n0}/${n1} 0644 -if supported lchmod; then - expect ENOENT lchmod ${n0}/${n1}/test 0644 - expect ENOENT lchmod ${n0}/${n1} 0644 -fi -expect 0 symlink ${n2} ${n0}/${n1} -expect ENOENT chmod ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/05.t b/tools/regression/pjdfstest/tests/chmod/05.t deleted file mode 100644 index c06895a..0000000 --- a/tools/regression/pjdfstest/tests/chmod/05.t +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..19" -else - echo "1..14" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642 -expect 0642 -u 65534 -g 65534 stat ${n1}/${n2} mode -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 chmod ${n1}/${n2} 0620 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0420 -expect 0420 -u 65534 -g 65534 stat ${n1}/${n2} mode -if supported lchmod; then - expect 0 chmod ${n1} 0644 - expect EACCES -u 65534 -g 65534 lchmod ${n1}/${n2} 0410 - expect 0 chmod ${n1} 0755 - expect 0 -u 65534 -g 65534 lchmod ${n1}/${n2} 0710 - expect 0710 -u 65534 -g 65534 stat ${n1}/${n2} mode -fi -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/06.t b/tools/regression/pjdfstest/tests/chmod/06.t deleted file mode 100644 index c06fe2b..0000000 --- a/tools/regression/pjdfstest/tests/chmod/06.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..10" -else - echo "1..8" -fi - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chmod ${n0} 0644 -expect ELOOP chmod ${n1} 0644 -expect ELOOP chmod ${n0}/test 0644 -expect ELOOP chmod ${n1}/test 0644 -if supported lchmod; then - expect ELOOP lchmod ${n0}/test 0644 - expect ELOOP lchmod ${n1}/test 0644 -fi -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/chmod/07.t b/tools/regression/pjdfstest/tests/chmod/07.t deleted file mode 100644 index 519b7fd..0000000 --- a/tools/regression/pjdfstest/tests/chmod/07.t +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..34" -else - echo "1..25" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 - -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642 -expect 0642 stat ${n1}/${n2} mode -expect EPERM -u 65533 -g 65533 chmod ${n1}/${n2} 0641 -expect 0642 stat ${n1}/${n2} mode -expect 0 chown ${n1}/${n2} 0 0 -expect EPERM -u 65534 -g 65534 chmod ${n1}/${n2} 0641 -expect 0642 stat ${n1}/${n2} mode -expect 0 unlink ${n1}/${n2} - -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3} -expect 0 -u 65534 -g 65534 chmod ${n1}/${n3} 0642 -expect 0642,65534,65534 stat ${n1}/${n2} mode,uid,gid -expect EPERM -u 65533 -g 65533 chmod ${n1}/${n3} 0641 -expect 0642,65534,65534 stat ${n1}/${n2} mode,uid,gid -expect 0 chown ${n1}/${n3} 0 0 -expect EPERM -u 65534 -g 65534 chmod ${n1}/${n3} 0641 -expect 0642,0,0 stat ${n1}/${n2} mode,uid,gid -expect 0 unlink ${n1}/${n2} -expect 0 unlink ${n1}/${n3} - -if supported lchmod; then - expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 - expect 0 -u 65534 -g 65534 lchmod ${n1}/${n2} 0642 - expect 0642 stat ${n1}/${n2} mode - expect EPERM -u 65533 -g 65533 lchmod ${n1}/${n2} 0641 - expect 0642 stat ${n1}/${n2} mode - expect 0 chown ${n1}/${n2} 0 0 - expect EPERM -u 65534 -g 65534 lchmod ${n1}/${n2} 0641 - expect 0642 stat ${n1}/${n2} mode - expect 0 unlink ${n1}/${n2} -fi - -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/08.t b/tools/regression/pjdfstest/tests/chmod/08.t deleted file mode 100644 index bf27134..0000000 --- a/tools/regression/pjdfstest/tests/chmod/08.t +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EPERM if the named file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..29" - ;; -FreeBSD:UFS) - echo "1..54" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM chmod ${n0} 0600 -supported lchmod && expect EPERM lchmod ${n0} 0600 -expect 0644 stat ${n0} mode -expect 0 chflags ${n0} none -expect 0 chmod ${n0} 0600 -expect 0600 stat ${n0} mode -supported lchmod && expect 0 lchmod ${n0} 0400 -supported lchmod && expect 0400 stat ${n0} mode -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 chmod ${n0} 0600 -expect 0600 stat ${n0} mode -supported lchmod && expect 0 lchmod ${n0} 0400 -supported lchmod && expect 0400 stat ${n0} mode -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:ZFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} SF_APPEND - expect 0 chmod ${n0} 0600 - expect 0600 stat ${n0} mode - supported lchmod && expect 0 lchmod ${n0} 0500 - supported lchmod && expect 0500 stat ${n0} mode - expect 0 chflags ${n0} none - expect 0 chmod ${n0} 0400 - expect 0400 stat ${n0} mode - expect 0 unlink ${n0} - ;; -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} SF_APPEND - expect EPERM chmod ${n0} 0600 - supported lchmod && expect EPERM lchmod ${n0} 0600 - expect 0644 stat ${n0} mode - expect 0 chflags ${n0} none - expect 0 chmod ${n0} 0600 - expect 0600 stat ${n0} mode - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM chmod ${n0} 0600 - supported lchmod && expect EPERM lchmod ${n0} 0600 - expect 0644 stat ${n0} mode - expect 0 chflags ${n0} none - expect 0 chmod ${n0} 0600 - expect 0600 stat ${n0} mode - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 chmod ${n0} 0600 - expect 0600 stat ${n0} mode - supported lchmod && expect 0 lchmod ${n0} 0400 - supported lchmod && expect 0400 stat ${n0} mode - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_APPEND - expect EPERM chmod ${n0} 0600 - supported lchmod && expect EPERM lchmod ${n0} 0600 - expect 0644 stat ${n0} mode - expect 0 chflags ${n0} none - expect 0 chmod ${n0} 0600 - expect 0600 stat ${n0} mode - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/chmod/09.t b/tools/regression/pjdfstest/tests/chmod/09.t deleted file mode 100644 index 18e4cdc..0000000 --- a/tools/regression/pjdfstest/tests/chmod/09.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..15" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -expect 0 chmod ${n0}/${n1} 0640 -expect 0640 stat ${n0}/${n1} mode -expect 0 lchmod ${n0}/${n1} 0530 -expect 0530 stat ${n0}/${n1} mode -mount -ur /dev/md${n} -expect EROFS chmod ${n0}/${n1} 0600 -expect EROFS lchmod ${n0}/${n1} 0600 -expect 0530 stat ${n0}/${n1} mode -mount -uw /dev/md${n} -expect 0 chmod ${n0}/${n1} 0600 -expect 0600 stat ${n0}/${n1} mode -expect 0 lchmod ${n0}/${n1} 0640 -expect 0640 stat ${n0}/${n1} mode -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/10.t b/tools/regression/pjdfstest/tests/chmod/10.t deleted file mode 100644 index b75b712..0000000 --- a/tools/regression/pjdfstest/tests/chmod/10.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..4" -else - echo "1..2" -fi - -expect EFAULT chmod NULL 0644 -expect EFAULT chmod DEADCODE 0644 -if supported lchmod; then - expect EFAULT lchmod NULL 0644 - expect EFAULT lchmod DEADCODE 0644 -fi diff --git a/tools/regression/pjdfstest/tests/chmod/11.t b/tools/regression/pjdfstest/tests/chmod/11.t deleted file mode 100644 index 8829896..0000000 --- a/tools/regression/pjdfstest/tests/chmod/11.t +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..173" -else - echo "1..109" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} - expect 0 chmod ${n1} 01621 - expect 01621 stat ${n1} mode - expect 0 symlink ${n1} ${n2} - expect 0 chmod ${n2} 01700 - expect 01700 stat ${n1} mode - expect 0 unlink ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - if supported lchmod; then - create_file ${type} ${n1} - expect 0 lchmod ${n1} 01621 - expect 01621 lstat ${n1} mode - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi -done - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 chmod ${n1} 01755 -expect 01755 stat ${n1} mode -expect 0 symlink ${n1} ${n2} -expect 0 chmod ${n2} 01700 -expect 01700 stat ${n1} mode -expect 0 unlink ${n2} -expect 0 rmdir ${n1} - -for type in regular fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0640 65534 65534 - expect 0 symlink ${n1} ${n2} - case "${os}" in - FreeBSD) - expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644 - expect 0640 stat ${n1} mode - expect EFTYPE -u 65534 -g 65534 chmod ${n2} 01644 - expect 0640 stat ${n1} mode - ;; - SunOS) - expect 0 -u 65534 -g 65534 chmod ${n1} 01644 - expect 0644 stat ${n1} mode - expect 0 -u 65534 -g 65534 chmod ${n2} 01640 - expect 0640 stat ${n1} mode - ;; - Linux) - expect 0 -u 65534 -g 65534 chmod ${n1} 01644 - expect 01644 stat ${n1} mode - expect 0 -u 65534 -g 65534 chmod ${n2} 01640 - expect 01640 stat ${n1} mode - ;; - esac - expect 0 unlink ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi - - if supported lchmod; then - create_file ${type} ${n1} 0640 65534 65534 - case "${os}" in - FreeBSD) - expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644 - expect 0640 lstat ${n1} mode - ;; - SunOS) - expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 - expect 0644 lstat ${n1} mode - ;; - Linux) - expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 - expect 01644 lstat ${n1} mode - ;; - esac - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi - fi -done - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chmod/12.t b/tools/regression/pjdfstest/tests/chmod/12.t deleted file mode 100644 index affa8de..0000000 --- a/tools/regression/pjdfstest/tests/chmod/12.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="verify SUID/SGID bit behaviour" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..14" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Check whether writing to the file by non-owner clears the SUID. -expect 0 create ${n0} 04777 -expect 0777 -u 65534 -g 65534 open ${n0} O_WRONLY : write 0 x : fstat 0 mode -expect 0777 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether writing to the file by non-owner clears the SGID. -expect 0 create ${n0} 02777 -expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode -expect 0777 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether writing to the file by non-owner clears the SUID+SGID. -expect 0 create ${n0} 06777 -expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode -expect 0777 stat ${n0} mode -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/chown/00.t b/tools/regression/pjdfstest/tests/chown/00.t deleted file mode 100644 index a3ccbac..0000000 --- a/tools/regression/pjdfstest/tests/chown/00.t +++ /dev/null @@ -1,458 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown changes ownership" - -dir=`dirname $0` -. ${dir}/../misc.sh - -if supported lchmod; then - echo "1..1349" -else - echo "1..1323" -fi - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# super-user can always modify ownership -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - expect 0 chown ${n0} 123 456 - expect 123,456 lstat ${n0} uid,gid - expect 0 chown ${n0} 0 0 - expect 0,0 lstat ${n0} uid,gid - - expect 0 symlink ${n0} ${n1} - uidgid=`${fstest} lstat ${n1} uid,gid` - expect 0 chown ${n1} 123 456 - expect 123,456 stat ${n1} uid,gid - expect 123,456 stat ${n0} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - expect 0 lchown ${n0} 123 456 - expect 123,456 lstat ${n0} uid,gid - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# non-super-user can modify file group if he is owner of a file and -# gid he is setting is in his groups list. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - expect 0 chown ${n0} 65534 65533 - expect 65534,65533 lstat ${n0} uid,gid - expect 0 -u 65534 -g 65532,65531 -- chown ${n0} -1 65532 - expect 65534,65532 lstat ${n0} uid,gid - expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 - expect 65534,65531 lstat ${n0} uid,gid - - expect 0 symlink ${n0} ${n1} - uidgid=`${fstest} lstat ${n1} uid,gid` - expect 0 chown ${n1} 65534 65533 - expect 65534,65533 stat ${n0} uid,gid - expect 65534,65533 stat ${n1} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 -u 65534 -g 65532,65531 -- chown ${n1} -1 65532 - expect 65534,65532 stat ${n0} uid,gid - expect 65534,65532 stat ${n1} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 -u 65534 -g 65532,65531 chown ${n1} 65534 65531 - expect 65534,65531 stat ${n0} uid,gid - expect 65534,65531 stat ${n1} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - expect 0 lchown ${n0} 65534 65533 - expect 65534,65533 lstat ${n0} uid,gid - expect 0 -u 65534 -g 65532,65531 -- lchown ${n0} -1 65532 - expect 65534,65532 lstat ${n0} uid,gid - expect 0 -u 65534 -g 65532,65531 lchown ${n0} 65534 65531 - expect 65534,65531 lstat ${n0} uid,gid - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# chown(2) return 0 if user is not owner of a file, but chown(2) is called -# with both uid and gid equal to -1. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - expect 0 chown ${n0} 65534 65533 - expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1 - expect 65534,65533 stat ${n0} uid,gid - - expect 0 symlink ${n0} ${n1} - uidgid=`${fstest} lstat ${n1} uid,gid` - expect 0 chown ${n1} 65534 65533 - expect 65534,65533 stat ${n0} uid,gid - expect 65534,65533 stat ${n1} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1 - expect 65534,65533 stat ${n0} uid,gid - expect 65534,65533 stat ${n1} uid,gid - expect ${uidgid} lstat ${n1} uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - expect 0 lchown ${n0} 65534 65533 - expect 0 -u 65532 -g 65531 -- lchown ${n0} -1 -1 - expect 65534,65533 lstat ${n0} uid,gid - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# when super-user calls chown(2), set-uid and set-gid bits may be removed. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - expect 0 chown ${n0} 65534 65533 - expect 0 chmod ${n0} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 0 chown ${n0} 65532 65531 - expect "(06555|0555),65532,65531" stat ${n0} mode,uid,gid - expect 0 chmod ${n0} 06555 - expect 06555,65532,65531 stat ${n0} mode,uid,gid - expect 0 chown ${n0} 0 0 - expect "(06555|0555),0,0" stat ${n0} mode,uid,gid - - expect 0 symlink ${n0} ${n1} - expect 0 chown ${n1} 65534 65533 - expect 0 chmod ${n1} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 06555,65534,65533 stat ${n1} mode,uid,gid - expect 0 chown ${n1} 65532 65531 - expect "(06555|0555),65532,65531" stat ${n0} mode,uid,gid - expect "(06555|0555),65532,65531" stat ${n1} mode,uid,gid - expect 0 chmod ${n1} 06555 - expect 06555,65532,65531 stat ${n0} mode,uid,gid - expect 06555,65532,65531 stat ${n1} mode,uid,gid - expect 0 chown ${n1} 0 0 - expect "(06555|0555),0,0" stat ${n0} mode,uid,gid - expect "(06555|0555),0,0" stat ${n1} mode,uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if [ "${type}" != "symlink" ] || supported lchmod; then - create_file ${type} ${n0} - expect 0 lchown ${n0} 65534 65533 - if supported lchmod; then - expect 0 lchmod ${n0} 06555 - else - expect 0 chmod ${n0} 06555 - fi - expect 06555,65534,65533 lstat ${n0} mode,uid,gid - expect 0 lchown ${n0} 65532 65531 - expect "(06555|0555),65532,65531" lstat ${n0} mode,uid,gid - if supported lchmod; then - expect 0 lchmod ${n0} 06555 - else - expect 0 chmod ${n0} 06555 - fi - expect 06555,65532,65531 lstat ${n0} mode,uid,gid - expect 0 lchown ${n0} 0 0 - expect "(06555|0555),0,0" lstat ${n0} mode,uid,gid - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# when non-super-user calls chown(2) successfully, set-uid and set-gid bits may -# be removed, except when both uid and gid are equal to -1. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - expect 0 chown ${n0} 65534 65533 - expect 0 chmod ${n0} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 - expect 0555,65534,65532 stat ${n0} mode,uid,gid - expect 0 chmod ${n0} 06555 - expect 06555,65534,65532 stat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533 - expect 0555,65534,65533 stat ${n0} mode,uid,gid - expect 0 chmod ${n0} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1 - expect "(06555|0555),65534,65533" stat ${n0} mode,uid,gid - - expect 0 symlink ${n0} ${n1} - expect 0 chown ${n1} 65534 65533 - expect 0 chmod ${n1} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 06555,65534,65533 stat ${n1} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 chown ${n1} 65534 65532 - expect 0555,65534,65532 stat ${n0} mode,uid,gid - expect 0555,65534,65532 stat ${n1} mode,uid,gid - expect 0 chmod ${n1} 06555 - expect 06555,65534,65532 stat ${n0} mode,uid,gid - expect 06555,65534,65532 stat ${n1} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- chown ${n1} -1 65533 - expect 0555,65534,65533 stat ${n0} mode,uid,gid - expect 0555,65534,65533 stat ${n1} mode,uid,gid - expect 0 chmod ${n1} 06555 - expect 06555,65534,65533 stat ${n0} mode,uid,gid - expect 06555,65534,65533 stat ${n1} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- chown ${n1} -1 -1 - expect "(06555|0555),65534,65533" stat ${n0} mode,uid,gid - expect "(06555|0555),65534,65533" stat ${n1} mode,uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - if [ "${type}" != "symlink" ] || supported lchmod; then - create_file ${type} ${n0} - - expect 0 lchown ${n0} 65534 65533 - if supported lchmod; then - expect 0 lchmod ${n0} 06555 - else - expect 0 chmod ${n0} 06555 - fi - expect 06555,65534,65533 lstat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 lchown ${n0} 65534 65532 - expect 0555,65534,65532 lstat ${n0} mode,uid,gid - if supported lchmod; then - expect 0 lchmod ${n0} 06555 - else - expect 0 chmod ${n0} 06555 - fi - expect 06555,65534,65532 lstat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 65533 - expect 0555,65534,65533 lstat ${n0} mode,uid,gid - if supported lchmod; then - expect 0 lchmod ${n0} 06555 - else - expect 0 chmod ${n0} 06555 - fi - expect 06555,65534,65533 lstat ${n0} mode,uid,gid - expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 -1 - expect "(06555|0555),65534,65533" lstat ${n0} mode,uid,gid - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi -done - -# successful chown(2) call (except uid and gid equal to -1) updates ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chown ${n0} 65534 65533 - expect 65534,65533 stat ${n0} uid,gid - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532 - expect 65534,65532 stat ${n0} uid,gid - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - - expect 0 symlink ${n0} ${n1} - ctime1=`${fstest} stat ${n1} ctime` - sleep 1 - expect 0 chown ${n1} 65533 65532 - expect 65533,65532 stat ${n1} uid,gid - ctime2=`${fstest} stat ${n1} ctime` - test_check $ctime1 -lt $ctime2 - ctime1=`${fstest} stat ${n1} ctime` - sleep 1 - expect 0 -u 65533 -g 65531 chown ${n1} 65533 65531 - expect 65533,65531 stat ${n1} uid,gid - ctime2=`${fstest} stat ${n1} ctime` - test_check $ctime1 -lt $ctime2 - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchown ${n0} 65534 65533 - expect 65534,65533 lstat ${n0} uid,gid - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 -u 65534 -g 65532 lchown ${n0} 65534 65532 - expect 65534,65532 lstat ${n0} uid,gid - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 -- chown ${n0} -1 -1 - ctime2=`${fstest} stat ${n0} ctime` - todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." - test_check $ctime1 -eq $ctime2 - expect 0,0 stat ${n0} uid,gid - - expect 0 symlink ${n0} ${n1} - ctime1=`${fstest} stat ${n1} ctime` - sleep 1 - expect 0 -- chown ${n1} -1 -1 - ctime2=`${fstest} stat ${n1} ctime` - todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." - test_check $ctime1 -eq $ctime2 - expect 0,0 stat ${n1} uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 -- lchown ${n0} -1 -1 - ctime2=`${fstest} lstat ${n0} ctime` - todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." - test_check $ctime1 -eq $ctime2 - expect 0,0 lstat ${n0} uid,gid - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -# unsuccessful chown(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 -- chown ${n0} 65534 -1 - expect EPERM -u 65534 -g 65534 -- chown ${n0} -1 65534 - expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534 - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - expect 0,0 stat ${n0} uid,gid - - expect 0 symlink ${n0} ${n1} - ctime1=`${fstest} stat ${n1} ctime` - sleep 1 - expect EPERM -u 65534 -- chown ${n1} 65534 -1 - expect EPERM -u 65534 -g 65534 -- chown ${n1} -1 65534 - expect EPERM -u 65534 -g 65534 chown ${n1} 65534 65534 - ctime2=`${fstest} stat ${n1} ctime` - test_check $ctime1 -eq $ctime2 - expect 0,0 stat ${n1} uid,gid - expect 0 unlink ${n1} - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 -- lchown ${n0} 65534 -1 - expect EPERM -u 65534 -g 65534 -- lchown ${n0} -1 65534 - expect EPERM -u 65534 -g 65534 lchown ${n0} 65534 65534 - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - expect 0,0 lstat ${n0} uid,gid - - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/chown/01.t b/tools/regression/pjdfstest/tests/chown/01.t deleted file mode 100644 index 249ce4d..0000000 --- a/tools/regression/pjdfstest/tests/chown/01.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..22" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR chown ${n0}/${n1}/test 65534 65534 - expect ENOTDIR lchown ${n0}/${n1}/test 65534 65534 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chown/02.t b/tools/regression/pjdfstest/tests/chown/02.t deleted file mode 100644 index 2225f64..0000000 --- a/tools/regression/pjdfstest/tests/chown/02.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns ENAMETOOLONG if a component of a pathname exceeded ${NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 chown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG chown ${nxx} 65534 65534 - -expect 0 create ${nx} 0644 -expect 0 lchown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG lchown ${nxx} 65534 65534 diff --git a/tools/regression/pjdfstest/tests/chown/03.t b/tools/regression/pjdfstest/tests/chown/03.t deleted file mode 100644 index 6bb43a2..0000000 --- a/tools/regression/pjdfstest/tests/chown/03.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 chown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG chown ${nxx} 65534 65534 - -expect 0 create ${nx} 0644 -expect 0 lchown ${nx} 65534 65534 -expect 65534,65534 stat ${nx} uid,gid -expect 0 unlink ${nx} -expect ENAMETOOLONG lchown ${nxx} 65534 65534 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/chown/04.t b/tools/regression/pjdfstest/tests/chown/04.t deleted file mode 100644 index e66d936..0000000 --- a/tools/regression/pjdfstest/tests/chown/04.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..9" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT chown ${n0}/${n1}/test 65534 65534 -expect ENOENT chown ${n0}/${n1} 65534 65534 -expect ENOENT lchown ${n0}/${n1}/test 65534 65534 -expect ENOENT lchown ${n0}/${n1} 65534 65534 -expect 0 symlink ${n2} ${n0}/${n1} -expect ENOENT chown ${n0}/${n1} 65534 65534 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chown/05.t b/tools/regression/pjdfstest/tests/chown/05.t deleted file mode 100644 index ec7cd5c..0000000 --- a/tools/regression/pjdfstest/tests/chown/05.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..18" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65533 -expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 -expect EACCES -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65534 -expect 0 chmod ${n1} 0755 -expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 -expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65533 -expect 65534,65533 -u 65534 -g 65533 stat ${n1}/${n2} uid,gid -expect 0 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chown/06.t b/tools/regression/pjdfstest/tests/chown/06.t deleted file mode 100644 index 39ccac6..0000000 --- a/tools/regression/pjdfstest/tests/chown/06.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP chown ${n0} 65534 65534 -expect ELOOP chown ${n1} 65534 65534 -expect ELOOP chown ${n0}/test 65534 65534 -expect ELOOP chown ${n1}/test 65534 65534 -expect ELOOP lchown ${n0}/test 65534 65534 -expect ELOOP lchown ${n1}/test 65534 65534 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/chown/07.t b/tools/regression/pjdfstest/tests/chown/07.t deleted file mode 100644 index 7f73cbe..0000000 --- a/tools/regression/pjdfstest/tests/chown/07.t +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..132" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1}/${n2} 65534 65534 - expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 - expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 - expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 - expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 - expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3} - expect EPERM -u 65534 -g 65534 chown ${n1}/${n3} 65533 65533 - expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65534 65534 - expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65533 65533 - expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n3} -1 65533 - expect 0 unlink ${n1}/${n3} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1}/${n2} - else - expect 0 unlink ${n1}/${n2} - fi - fi - create_file ${type} ${n1}/${n2} 65534 65534 - expect EPERM -u 65534 -g 65534 lchown ${n1}/${n2} 65533 65533 - expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65534 65534 - expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65533 65533 - expect EPERM -u 65534 -g 65534 -- lchown ${n1}/${n2} -1 65533 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1}/${n2} - else - expect 0 unlink ${n1}/${n2} - fi -done -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chown/08.t b/tools/regression/pjdfstest/tests/chown/08.t deleted file mode 100644 index 9bff354..0000000 --- a/tools/regression/pjdfstest/tests/chown/08.t +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns EPERM if the named file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..20" - ;; -FreeBSD:UFS) - echo "1..44" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM chown ${n0} 65534 65534 -expect 0,0 stat ${n0} uid,gid -expect 0 chflags ${n0} none -expect 0 chown ${n0} 65534 65534 -expect 65534,65534 stat ${n0} uid,gid -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 chown ${n0} 65534 65534 -expect 65534,65534 stat ${n0} uid,gid -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:ZFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} SF_APPEND - expect 0 chown ${n0} 65534 65534 - expect 65534,65534 stat ${n0} uid,gid - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - ;; -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} SF_APPEND - expect EPERM chown ${n0} 65534 65534 - expect 0,0 stat ${n0} uid,gid - expect 0 chflags ${n0} none - expect 0 chown ${n0} 65534 65534 - expect 65534,65534 stat ${n0} uid,gid - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM chown ${n0} 65534 65534 - expect 0,0 stat ${n0} uid,gid - expect 0 chflags ${n0} none - expect 0 chown ${n0} 65534 65534 - expect 65534,65534 stat ${n0} uid,gid - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 chown ${n0} 65534 65534 - expect 65534,65534 stat ${n0} uid,gid - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_APPEND - expect EPERM chown ${n0} 65534 65534 - expect 0,0 stat ${n0} uid,gid - expect 0 chflags ${n0} none - expect 0 chown ${n0} 65534 65534 - expect 65534,65534 stat ${n0} uid,gid - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/chown/09.t b/tools/regression/pjdfstest/tests/chown/09.t deleted file mode 100644 index cc14328..0000000 --- a/tools/regression/pjdfstest/tests/chown/09.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -expect 0 chown ${n0}/${n1} 65534 65534 -expect 65534,65534 stat ${n0}/${n1} uid,gid -mount -ur /dev/md${n} -expect EROFS chown ${n0}/${n1} 65533 65533 -expect 65534,65534 stat ${n0}/${n1} uid,gid -mount -uw /dev/md${n} -expect 0 chown ${n0}/${n1} 65533 65533 -expect 65533,65533 stat ${n0}/${n1} uid,gid -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/chown/10.t b/tools/regression/pjdfstest/tests/chown/10.t deleted file mode 100644 index 961a5be..0000000 --- a/tools/regression/pjdfstest/tests/chown/10.t +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="chown returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -expect EFAULT chown NULL 65534 65534 -expect EFAULT chown DEADCODE 65534 65534 -expect EFAULT lchown NULL 65534 65534 -expect EFAULT lchown DEADCODE 65534 65534 diff --git a/tools/regression/pjdfstest/tests/conf b/tools/regression/pjdfstest/tests/conf deleted file mode 100644 index f914941..0000000 --- a/tools/regression/pjdfstest/tests/conf +++ /dev/null @@ -1,36 +0,0 @@ -# $FreeBSD$ -# pjdfstest configuration file - -# Supported operating systems: FreeBSD, Darwin, SunOS, Linux -os=`uname` - -case "${os}" in -FreeBSD|Darwin) - GREP=grep - #fs=`df -T . | tail -1 | awk '{print $2}'` - pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`" - fs=`mount | ${GREP} -E "^${pattern}" | awk -F '[(,]' '{print toupper($2)}'` - ;; -Solaris|SunOS) - GREP=ggrep - pattern=`df -Pk . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'` - fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \ - tr -s '[:lower:]' '[:upper:]'` - ;; -Linux) - GREP=grep - fs=`df -PT . | tail -1 | awk '{print toupper($2)}'` - ;; -*) - echo "Unsupported operating system ${os}." >/dev/stderr - exit 1 - ;; -esac - -# If we cannot figure out file system type, define it here. -#fs="UFS" - -if [ -z "${fs}" ]; then - echo "Cannot figure out file system type, define it by hand." >/dev/stderr - exit 1 -fi diff --git a/tools/regression/pjdfstest/tests/ftruncate/00.t b/tools/regression/pjdfstest/tests/ftruncate/00.t deleted file mode 100644 index 9028a29..0000000 --- a/tools/regression/pjdfstest/tests/ftruncate/00.t +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="ftruncate descrease/increase file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_RDWR : ftruncate 0 1234567 -expect 1234567 lstat ${n0} size -expect 0 open ${n0} O_WRONLY : ftruncate 0 567 -expect 567 lstat ${n0} size -expect 0 unlink ${n0} - -dd if=/dev/random of=${n0} bs=12345 count=1 >/dev/null 2>&1 -expect 0 open ${n0} O_RDWR : ftruncate 0 23456 -expect 23456 lstat ${n0} size -expect 0 open ${n0} O_WRONLY : ftruncate 0 1 -expect 1 lstat ${n0} size -expect 0 unlink ${n0} - -# successful ftruncate(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 open ${n0} O_RDWR : ftruncate 0 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful ftruncate(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EINVAL -u 65534 open ${n0} O_RDONLY : ftruncate 0 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -# third argument should not affect permission. -expect 0 open ${n0} O_CREAT,O_RDWR 0 : ftruncate 0 0 -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 open ${n0} O_CREAT,O_RDWR 0 : ftruncate 0 0 -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/granular/00.t b/tools/regression/pjdfstest/tests/granular/00.t deleted file mode 100644 index 4e04260..0000000 --- a/tools/regression/pjdfstest/tests/granular/00.t +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..49" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Tests 2..7 - check out whether root user can do stuff. -# Can create files? -expect 0 create ${n0} 0644 - -# Can create symlinks? -expect 0 link ${n0} ${n1} -expect 0 unlink ${n1} -expect 0 unlink ${n0} - -# Can create directories? -expect 0 mkdir ${n0} 0755 -expect 0 rmdir ${n0} - -# Check whether user 65534 is permitted to create and remove -# files, but not subdirectories. -expect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny - -# Can create files? -expect 0 -u 65534 -g 65534 create ${n0} 0644 - -# Can create symlinks? -expect 0 -u 65534 -g 65534 link ${n0} ${n1} -expect 0 -u 65534 -g 65534 unlink ${n1} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Can create directories? -expect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 -expect ENOENT -u 65534 -g 65534 rmdir ${n0} -expect 0 mkdir ${n0} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Can move files from other directory? -expect 0 create ../${n3}/${n1} 0644 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move files from other directory overwriting existing files? -expect 0 create ../${n3}/${n1} 0644 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Can move directories from other directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move directories from other directory overwriting existing directory? -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} - -# Check whether user 65534 is permitted to create -# subdirectories, but not files - and to remove neither of them. -expect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow - -# Can create files? -expect EACCES -u 65534 -g 65534 create ${n0} 0644 - -# Can create symlinks? -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 link ${n0} ${n1} -expect ENOENT -u 65534 -g 65534 unlink ${n1} -expect EACCES -u 65534 -g 65534 unlink ${n0} -expect 0 unlink ${n0} - -# Can create directories? -expect 0 -u 65534 -g 65534 mkdir ${n0} 0755 -expect EACCES -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# Can move files from other directory? -expect 0 create ../${n3}/${n1} 0644 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move files from other directory overwriting existing files? -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} - -# Can move directories from other directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} - -# Can move directories from other directory overwriting existing directory? -expect 0 mkdir ../${n3}/${n1} 0777 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} -expect 0 rmdir ${n3} diff --git a/tools/regression/pjdfstest/tests/granular/01.t b/tools/regression/pjdfstest/tests/granular/01.t deleted file mode 100644 index 1c6b3f3..0000000 --- a/tools/regression/pjdfstest/tests/granular/01.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Tests 1..12 - check out whether user 65534 is permitted to read attributes. -expect 0 create ${n0} 0644 -expect 0 lstat ${n0} size -expect 0 -u 65534 -g 65534 stat ${n0} size -expect 0 prependacl ${n0} user:65534:read_attributes::deny -expect 0 lstat ${n0} size -expect EACCES -u 65534 -g 65534 stat ${n0} size -expect 0 prependacl ${n0} user:65534:read_attributes::allow -expect 0 -u 65534 -g 65534 stat ${n0} size -expect 0 lstat ${n0} size -expect 0 unlink ${n0} - -# Tests 12..12 - check out whether user 65534 is permitted to write attributes. -# XXX: Check if ACL_WRITE_ATTRIBUTES allows for modifying access times. - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/granular/02.t b/tools/regression/pjdfstest/tests/granular/02.t deleted file mode 100644 index 4a33dad..0000000 --- a/tools/regression/pjdfstest/tests/granular/02.t +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..83" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# Check whether user 65534 is permitted to read ACL. -expect 0 create ${n0} 0644 -expect 0 readacl ${n0} -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0 prependacl ${n0} user:65534:read_acl::deny -expect 0 readacl ${n0} -expect EACCES -u 65534 -g 65534 readacl ${n0} -expect 0 prependacl ${n0} user:65534:read_acl::allow -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0 readacl ${n0} -expect 0 unlink ${n0} - -# Check whether user 65534 is permitted to write ACL. -expect 0 create ${n0} 0644 -expect EPERM -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow -expect 0 unlink ${n0} - -# Check whether user 65534 is permitted to write mode. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 unlink ${n0} - -# There is an interesting problem with interaction between ACL_WRITE_ACL -# and SUID/SGID bits. In case user does have ACL_WRITE_ACL, but is not -# a file owner, Solaris does the following: -# 1. Setting SUID fails with EPERM. -# 2. Setting SGID succeeds, but mode is not changed. -# 3. Modifying ACL does not clear SUID nor SGID bits. -# 4. Writing the file does clear both SUID and SGID bits. -# -# What we are doing is the following: -# 1. Setting SUID or SGID fails with EPERM. -# 2. Modifying ACL does not clear SUID nor SGID bits. -# 3. Writing the file does clear both SUID and SGID bits. -# -# Check whether user 65534 is denied to write mode with SUID bit. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 -expect 0 unlink ${n0} - -# Check whether user 65534 is denied to write mode with SGID bit. -expect 0 create ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 -expect 0 unlink ${n0} - -# Check whether user 65534 is allowed to write mode with sticky bit. -expect 0 mkdir ${n0} 0755 -expect EPERM -u 65534 -g 65534 chmod ${n0} 01777 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 chmod ${n0} 01777 -expect 0 rmdir ${n0} - -# Check whether modifying the ACL by not-owner preserves the SUID. -expect 0 create ${n0} 04755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 04755 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether modifying the ACL by not-owner preserves the SGID. -expect 0 create ${n0} 02755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 02755 stat ${n0} mode -expect 0 unlink ${n0} - -# Check whether modifying the ACL by not-owner preserves the sticky bit. -expect 0 mkdir ${n0} 0755 -expect 0 chmod ${n0} 01755 -expect 0 prependacl ${n0} user:65534:write_acl::allow -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow -expect 01755 stat ${n0} mode -expect 0 rmdir ${n0} - -# Clearing the SUID and SGID bits when being written to by non-owner -# is checked in chmod/12.t. - -# Check whether the file owner is always permitted to get and set -# ACL and file mode, even if ACL_{READ,WRITE}_ACL would deny it. -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65534 create ${n0} 0600 -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0600 -u 65534 -g 65534 stat ${n0} mode -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 unlink ${n0} - -expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny -expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny -expect 0 -u 65534 -g 65534 readacl ${n0} -expect 0600 -u 65534 -g 65534 stat ${n0} mode -expect 0 -u 65534 -g 65534 chmod ${n0} 0777 -expect 0 rmdir ${n0} - -# Check whether the root is allowed for these as well. -expect 0 -u 65534 -g 65534 create ${n0} 0600 -expect 0 prependacl ${n0} everyone@:write_acl::deny -expect 0 prependacl ${n0} everyone@:read_acl::deny -expect 0 readacl ${n0} -expect 0600 stat ${n0} mode -expect 0 chmod ${n0} 0777 -expect 0 unlink ${n0} - -expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 -expect 0 prependacl ${n0} everyone@:write_acl::deny -expect 0 prependacl ${n0} everyone@:read_acl::deny -expect 0600 stat ${n0} mode -expect 0 readacl ${n0} -expect 0600 stat ${n0} mode -expect 0 chmod ${n0} 0777 -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/granular/03.t b/tools/regression/pjdfstest/tests/granular/03.t deleted file mode 100644 index 195065f..0000000 --- a/tools/regression/pjdfstest/tests/granular/03.t +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..65" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Unlink allowed on writable directory. -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 unlink ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving file elsewhere allowed on writable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Moving file from elsewhere allowed on writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving file from elsewhere overwriting local file allowed -# on writable directory. -expect 0 create ${n0} 0644 -expect 0 create ../${n3}/${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. -expect 0 create ${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 unlink ${n0} - -# DELETE_CHILD denies unlink on writable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 unlink ${n0} -expect 0 unlink ${n0} - -# DELETE_CHILD denies moving file elsewhere. -expect 0 create ${n0} 0644 -expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 rename ${n0} ../${n3}/${n0} - -# DELETE_CHILD does not deny moving file from elsewhere -# to a writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE_CHILD denies moving file from elsewhere -# to a writable directory overwriting local file. -expect 0 create ../${n3}/${n0} 0644 -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE allowed on file allows for unlinking, no matter -# what permissions on containing directory are. -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Same for moving the file elsewhere. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Same for moving the file from elsewhere into a writable -# directory with DELETE_CHILD denied. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 unlink ${n0} - -# DELETE does not allow for overwriting a file in a unwritable -# directory with DELETE_CHILD denied. -expect 0 create ${n0} 0644 -expect 0 create ../${n3}/${n0} 0644 -expect 0 prependacl . user:65534:write_data::deny -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl ${n0} user:65534:delete::allow -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# But it allows for plain deletion. -expect 0 -u 65534 -g 65534 unlink ${n0} - -# DELETE_CHILD allowed on unwritable directory. -expect 0 create ${n0} 0644 -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 unlink ${n0} - -# Moving things elsewhere is allowed. -expect 0 create ${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# Moving things back is not. -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we're overwriting. -expect 0 create ${n0} 0644 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we have DELETE on the existing file. -expect 0 prependacl ${n0} user:65534:delete::allow -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/granular/04.t b/tools/regression/pjdfstest/tests/granular/04.t deleted file mode 100644 index 9c0841d..0000000 --- a/tools/regression/pjdfstest/tests/granular/04.t +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..52" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -# ACL_WRITE_OWNER permits to set gid to our own only. -expect 0 create ${n0} 0644 -expect 0,0 lstat ${n0} uid,gid -expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532 -expect 0,0 lstat ${n0} uid,gid -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530 -expect 0,0 lstat ${n0} uid,gid -expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 -expect 0,65532 lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# ACL_WRITE_OWNER permits to set uid to our own only. -expect 0 create ${n0} 0644 -expect 0,0 lstat ${n0} uid,gid -expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531 -expect 0,0 lstat ${n0} uid,gid -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531 -expect 0,0 lstat ${n0} uid,gid -expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 -expect 65534,65531 lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# When non-owner calls chown(2) successfully, set-uid and set-gid bits are -# removed, except when both uid and gid are equal to -1. -expect 0 create ${n0} 0644 -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 -expect 0555,65534,65532 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 -expect 0555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 -expect 06555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 prependacl ${n0} user:65534:write_owner::allow -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 -expect 0555,65534,65532 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 -expect 0555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 chmod ${n0} 06555 -expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 -expect 06555,65534,65533 lstat ${n0} mode,uid,gid -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/granular/05.t b/tools/regression/pjdfstest/tests/granular/05.t deleted file mode 100644 index 8abf357..0000000 --- a/tools/regression/pjdfstest/tests/granular/05.t +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit - -echo "1..68" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0755 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` -cd ${n2} - -# Unlink allowed on writable directory. -expect 0 mkdir ${n0} 0755 -expect EACCES -u 65534 -g 65534 rmdir ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving directory elsewhere allowed on writable directory. -expect 0 mkdir ${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 12 -# Moving directory from elsewhere allowed on writable directory. -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:append_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving directory from elsewhere overwriting local directory allowed -# on writable directory. -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl . user:65534:write_data::allow -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# 23 -# Denied DELETE changes nothing wrt removing. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. -expect 0 mkdir ${n0} 0777 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# DELETE_CHILD denies unlink on writable directory. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# 35 -# DELETE_CHILD denies moving directory elsewhere. -expect 0 mkdir ${n0} 0777 -expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} -expect 0 rename ${n0} ../${n3}/${n0} - -# DELETE_CHILD does not deny moving directory from elsewhere -# to a writable directory. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE_CHILD denies moving directory from elsewhere -# to a writable directory overwriting local directory. -expect 0 mkdir ../${n3}/${n0} 0755 -expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# DELETE allowed on directory allows for unlinking, no matter -# what permissions on containing directory are. -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Same for moving the directory elsewhere. -expect 0 mkdir ${n0} 0777 -expect 0 prependacl ${n0} user:65534:delete::allow -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 46 -# Same for moving the directory from elsewhere into a writable -# directory with DELETE_CHILD denied. -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 rmdir ${n0} - -# DELETE does not allow for overwriting a directory in a unwritable -# directory with DELETE_CHILD denied. -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -expect 0 prependacl . user:65534:write_data::deny -expect 0 prependacl . user:65534:delete_child::deny -expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 prependacl ${n0} user:65534:delete::allow -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# 54 -# But it allows for plain deletion. -# XXX: expect 0 -u 65534 -g 65534 rmdir ${n0} -expect 0 rmdir ${n0} - -# DELETE_CHILD allowed on unwritable directory. -expect 0 mkdir ${n0} 0755 -expect 0 prependacl . user:65534:delete_child::allow -expect 0 -u 65534 -g 65534 rmdir ${n0} - -# Moving things elsewhere is allowed. -expect 0 mkdir ${n0} 0777 -expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} - -# 60 -# Moving things back is not. -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Even if we're overwriting. -# XXX: expect 0 mkdir ${n0} 0755 -expect 0 mkdir ../${n3}/${n0} 0777 -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 mkdir ../${n3}/${n0} 0777 - -# Even if we have DELETE on the existing directory. -expect 0 prependacl ${n0} user:65534:delete::allow -# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} -expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} - -# Denied DELETE changes nothing wrt removing. -expect 0 prependacl ${n0} user:65534:delete::deny -expect 0 -u 65534 -g 65534 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/link/00.t b/tools/regression/pjdfstest/tests/link/00.t deleted file mode 100644 index b003d78..0000000 --- a/tools/regression/pjdfstest/tests/link/00.t +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link creates hardlinks" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..202" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n3} 0755 -cdir=`pwd` -cd ${n3} - -for type in regular fifo block char socket; do - create_file ${type} ${n0} - expect ${type},1 lstat ${n0} type,nlink - - expect 0 link ${n0} ${n1} - expect ${type},2 lstat ${n0} type,nlink - expect ${type},2 lstat ${n1} type,nlink - - expect 0 link ${n1} ${n2} - expect ${type},3 lstat ${n0} type,nlink - expect ${type},3 lstat ${n1} type,nlink - expect ${type},3 lstat ${n2} type,nlink - - expect 0 chmod ${n1} 0201 - expect 0 chown ${n1} 65534 65533 - - expect ${type},0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ${type},0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n0} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ${type},0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n2} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ${type},0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid - expect ENOENT lstat ${n2} type,mode,nlink,uid,gid - - expect 0 unlink ${n1} - expect ENOENT lstat ${n0} type,mode,nlink,uid,gid - expect ENOENT lstat ${n1} type,mode,nlink,uid,gid - expect ENOENT lstat ${n2} type,mode,nlink,uid,gid -done - -# successful link(2) updates ctime. -for type in regular fifo block char socket; do - create_file ${type} ${n0} - ctime1=`${fstest} stat ${n0} ctime` - dctime1=`${fstest} stat . ctime` - dmtime1=`${fstest} stat . mtime` - sleep 1 - expect 0 link ${n0} ${n1} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 - dctime2=`${fstest} stat . ctime` - test_check $dctime1 -lt $dctime2 - dmtime2=`${fstest} stat . mtime` - test_check $dctime1 -lt $dmtime2 - expect 0 unlink ${n0} - expect 0 unlink ${n1} -done - -# unsuccessful link(2) does not update ctime. -for type in regular fifo block char socket; do - create_file ${type} ${n0} - expect 0 -- chown ${n0} 65534 -1 - ctime1=`${fstest} stat ${n0} ctime` - dctime1=`${fstest} stat . ctime` - dmtime1=`${fstest} stat . mtime` - sleep 1 - expect EACCES -u 65534 link ${n0} ${n1} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - dctime2=`${fstest} stat . ctime` - test_check $dctime1 -eq $dctime2 - dmtime2=`${fstest} stat . mtime` - test_check $dctime1 -eq $dmtime2 - expect 0 unlink ${n0} -done - -cd ${cdir} -expect 0 rmdir ${n3} diff --git a/tools/regression/pjdfstest/tests/link/01.t b/tools/regression/pjdfstest/tests/link/01.t deleted file mode 100644 index 9400901..0000000 --- a/tools/regression/pjdfstest/tests/link/01.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENOTDIR if a component of either path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR link ${n0}/${n1}/test ${n0}/${n2} - create_file ${type} ${n0}/${n2} - expect ENOTDIR link ${n0}/${n2} ${n0}/${n1}/test - expect 0 unlink ${n0}/${n1} - expect 0 unlink ${n0}/${n2} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/02.t b/tools/regression/pjdfstest/tests/link/02.t deleted file mode 100644 index 32f78c4..0000000 --- a/tools/regression/pjdfstest/tests/link/02.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 link ${nx} ${n0} -expect 0 unlink ${nx} -expect 0 link ${n0} ${nx} -expect 0 unlink ${n0} -expect 0 unlink ${nx} - -expect 0 create ${n0} 0644 -expect ENAMETOOLONG link ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG link ${nxx} ${n0} diff --git a/tools/regression/pjdfstest/tests/link/03.t b/tools/regression/pjdfstest/tests/link/03.t deleted file mode 100644 index 0ad79c3..0000000 --- a/tools/regression/pjdfstest/tests/link/03.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..13" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 link ${nx} ${n0} -expect 2 stat ${n0} nlink -expect 2 stat ${nx} nlink -expect 0 unlink ${nx} -expect 0 link ${n0} ${nx} -expect 2 stat ${n0} nlink -expect 2 stat ${nx} nlink -expect 0 unlink ${nx} -expect ENAMETOOLONG link ${n0} ${nxx} -expect 1 stat ${n0} nlink -expect 0 unlink ${n0} -expect ENAMETOOLONG link ${nxx} ${n0} - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/link/04.t b/tools/regression/pjdfstest/tests/link/04.t deleted file mode 100644 index d27beef..0000000 --- a/tools/regression/pjdfstest/tests/link/04.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENOENT if a component of either path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT link ${n0}/${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ENOENT link ${n2} ${n0}/${n1}/test -expect 0 unlink ${n2} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/05.t b/tools/regression/pjdfstest/tests/link/05.t deleted file mode 100644 index ee63ef6..0000000 --- a/tools/regression/pjdfstest/tests/link/05.t +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs -i 1 /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -i=1 -while :; do - link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -test_check $i -eq 32767 - -expect EMLINK link ${n0}/${n1} ${n0}/${n2} - -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/06.t b/tools/regression/pjdfstest/tests/link/06.t deleted file mode 100644 index 3ce0919..0000000 --- a/tools/regression/pjdfstest/tests/link/06.t +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EACCES when a component of either path prefix denies search permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..18" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 mkdir ${n2} 0755 -expect 0 chown ${n2} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 - -expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4} -expect 0 -u 65534 -g 65534 unlink ${n2}/${n4} - -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4} -expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4} - -expect 0 chmod ${n1} 0755 -expect 0 chmod ${n2} 0644 -expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4} - -expect 0 unlink ${n1}/${n3} -expect 0 rmdir ${n1} -expect 0 rmdir ${n2} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/07.t b/tools/regression/pjdfstest/tests/link/07.t deleted file mode 100644 index f9d35e7..0000000 --- a/tools/regression/pjdfstest/tests/link/07.t +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EACCES when the requested link requires writing in a directory with a mode that denies write permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 mkdir ${n2} 0755 -expect 0 chown ${n2} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 - -expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4} -expect 0 -u 65534 -g 65534 unlink ${n2}/${n4} - -expect 0 chmod ${n2} 0555 -expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4} -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4} -expect 0 chmod ${n1} 0755 - -expect 0 unlink ${n1}/${n3} -expect 0 rmdir ${n1} -expect 0 rmdir ${n2} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/08.t b/tools/regression/pjdfstest/tests/link/08.t deleted file mode 100644 index f9d9445..0000000 --- a/tools/regression/pjdfstest/tests/link/08.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ELOOP if too many symbolic links were encountered in translating one of the pathnames" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP link ${n0}/test ${n2} -expect ELOOP link ${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ELOOP link ${n2} ${n0}/test -expect ELOOP link ${n2} ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect 0 unlink ${n2} diff --git a/tools/regression/pjdfstest/tests/link/09.t b/tools/regression/pjdfstest/tests/link/09.t deleted file mode 100644 index 224395f..0000000 --- a/tools/regression/pjdfstest/tests/link/09.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENOENT if the source file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect ENOENT link ${n0} ${n1} diff --git a/tools/regression/pjdfstest/tests/link/10.t b/tools/regression/pjdfstest/tests/link/10.t deleted file mode 100644 index 725a020..0000000 --- a/tools/regression/pjdfstest/tests/link/10.t +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EEXIST if the destination file does exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..23" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1} - expect EEXIST link ${n0} ${n1} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/link/11.t b/tools/regression/pjdfstest/tests/link/11.t deleted file mode 100644 index cf31c9e..0000000 --- a/tools/regression/pjdfstest/tests/link/11.t +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EPERM if the source file is a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -case "${os}:${fs}" in -SunOS:UFS) - echo "1..10" - - expect 0 mkdir ${n0} 0755 - expect 0 link ${n0} ${n1} - expect 0 unlink ${n1} - expect 0 rmdir ${n0} - ;; -*) - echo "1..9" - - expect 0 mkdir ${n0} 0755 - expect EPERM link ${n0} ${n1} - expect 0 rmdir ${n0} - ;; -esac - -expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 -cdir=`pwd` -cd ${n0} - -expect 0 -u 65534 -g 65534 mkdir ${n1} 0755 -expect EPERM -u 65534 -g 65534 link ${n1} ${n2} -expect 0 -u 65534 -g 65534 rmdir ${n1} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/12.t b/tools/regression/pjdfstest/tests/link/12.t deleted file mode 100644 index 8bf9510..0000000 --- a/tools/regression/pjdfstest/tests/link/12.t +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EPERM if the source file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..27" - ;; -FreeBSD:UFS) - echo "1..48" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 - -expect 1 stat ${n0} nlink -expect 0 link ${n0} ${n1} -expect 2 stat ${n0} nlink -expect 0 unlink ${n1} -expect 1 stat ${n0} nlink - -expect 0 chflags ${n0} SF_IMMUTABLE -todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM." -expect EPERM link ${n0} ${n1} -todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM." -expect 1 stat ${n0} nlink -expect 0 chflags ${n0} none -todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM." -expect 0 link ${n0} ${n1} -expect 2 stat ${n0} nlink -expect 0 unlink ${n1} -expect 1 stat ${n0} nlink - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 link ${n0} ${n1} -expect 2 stat ${n0} nlink -expect 0 chflags ${n0} none -expect 0 unlink ${n1} -expect 1 stat ${n0} nlink - -case "${os}:${fs}" in -FreeBSD:ZFS) - expect 0 chflags ${n0} SF_APPEND - expect 0 link ${n0} ${n1} - expect 2 stat ${n0} nlink - expect 0 chflags ${n0} none - expect 0 unlink ${n1} - expect 1 stat ${n0} nlink - ;; -FreeBSD:UFS) - expect 0 chflags ${n0} SF_APPEND - expect EPERM link ${n0} ${n1} - expect 0 chflags ${n0} none - expect 0 link ${n0} ${n1} - expect 2 stat ${n0} nlink - expect 0 unlink ${n1} - expect 1 stat ${n0} nlink - - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM link ${n0} ${n1} - expect 0 chflags ${n0} none - expect 0 link ${n0} ${n1} - expect 2 stat ${n0} nlink - expect 0 unlink ${n1} - expect 1 stat ${n0} nlink - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 link ${n0} ${n1} - expect 2 stat ${n0} nlink - expect 0 chflags ${n0} none - expect 0 unlink ${n1} - expect 1 stat ${n0} nlink - - expect 0 chflags ${n0} UF_APPEND - expect EPERM link ${n0} ${n1} - expect 0 chflags ${n0} none - expect 0 link ${n0} ${n1} - expect 2 stat ${n0} nlink - expect 0 unlink ${n1} - expect 1 stat ${n0} nlink - ;; -esac - -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/link/13.t b/tools/regression/pjdfstest/tests/link/13.t deleted file mode 100644 index 9b35a4b..0000000 --- a/tools/regression/pjdfstest/tests/link/13.t +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EPERM if the parent directory of the destination file has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..29" - ;; -FreeBSD:UFS) - echo "1..49" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 create ${n0}/${n1} 0644 -expect 1 stat ${n0}/${n1} nlink -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 2 stat ${n0}/${n1} nlink -expect 0 unlink ${n0}/${n2} -expect 1 stat ${n0}/${n1} nlink - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM link ${n0}/${n1} ${n0}/${n2} -expect 1 stat ${n0}/${n1} nlink -expect 0 chflags ${n0} none -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 2 stat ${n0}/${n1} nlink -expect 0 unlink ${n0}/${n2} -expect 1 stat ${n0}/${n1} nlink - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 2 stat ${n0}/${n1} nlink -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n2} -expect 1 stat ${n0}/${n1} nlink - -expect 0 chflags ${n0} SF_APPEND -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 2 stat ${n0}/${n1} nlink -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n2} -expect 1 stat ${n0}/${n1} nlink - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM link ${n0}/${n1} ${n0}/${n2} - expect 1 stat ${n0}/${n1} nlink - expect 0 chflags ${n0} none - expect 0 link ${n0}/${n1} ${n0}/${n2} - expect 2 stat ${n0}/${n1} nlink - expect 0 unlink ${n0}/${n2} - expect 1 stat ${n0}/${n1} nlink - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 link ${n0}/${n1} ${n0}/${n2} - expect 2 stat ${n0}/${n1} nlink - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n2} - expect 1 stat ${n0}/${n1} nlink - - expect 0 chflags ${n0} UF_APPEND - expect 0 link ${n0}/${n1} ${n0}/${n2} - expect 2 stat ${n0}/${n1} nlink - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n2} - expect 1 stat ${n0}/${n1} nlink - ;; -esac - -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/14.t b/tools/regression/pjdfstest/tests/link/14.t deleted file mode 100644 index 4eb5a56..0000000 --- a/tools/regression/pjdfstest/tests/link/14.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EXDEV if the source and the destination files are on different file systems" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..8" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -expect EXDEV link ${n0}/${n1} ${n2} -expect 0 unlink ${n0}/${n1} -expect 0 create ${n1} 0644 -expect EXDEV link ${n1} ${n0}/${n2} -expect 0 unlink ${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/15.t b/tools/regression/pjdfstest/tests/link/15.t deleted file mode 100644 index eea1844..0000000 --- a/tools/regression/pjdfstest/tests/link/15.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns ENOSPC if the directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..4" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 256k` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -i=0 -while :; do - link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -expect ENOSPC link ${n0}/${n1} ${n0}/${n2} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/16.t b/tools/regression/pjdfstest/tests/link/16.t deleted file mode 100644 index df04521..0000000 --- a/tools/regression/pjdfstest/tests/link/16.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EROFS if the requested link requires writing in a directory on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..9" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 - -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 0 unlink ${n0}/${n2} -mount -ur /dev/md${n} -expect EROFS link ${n0}/${n1} ${n0}/${n2} -mount -uw /dev/md${n} -expect 0 link ${n0}/${n1} ${n0}/${n2} -expect 0 unlink ${n0}/${n2} - -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/link/17.t b/tools/regression/pjdfstest/tests/link/17.t deleted file mode 100644 index cb56128..0000000 --- a/tools/regression/pjdfstest/tests/link/17.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="link returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EFAULT link ${n0} NULL -expect EFAULT link ${n0} DEADCODE -expect 0 unlink ${n0} -expect EFAULT link NULL ${n0} -expect EFAULT link DEADCODE ${n0} -expect EFAULT link NULL DEADCODE -expect EFAULT link DEADCODE NULL diff --git a/tools/regression/pjdfstest/tests/misc.sh b/tools/regression/pjdfstest/tests/misc.sh deleted file mode 100644 index 8978b5f..0000000 --- a/tools/regression/pjdfstest/tests/misc.sh +++ /dev/null @@ -1,221 +0,0 @@ -# $FreeBSD$ - -ntest=1 - -case "${dir}" in -/*) - maindir="${dir}/../.." - ;; -*) - maindir="`pwd`/${dir}/../.." - ;; -esac -fstest="${maindir}/pjdfstest" -. ${maindir}/tests/conf - -expect() -{ - e="${1}" - shift - r=`${fstest} $* 2>/dev/null | tail -1` - echo "${r}" | ${GREP} -Eq '^'${e}'$' - if [ $? -eq 0 ]; then - if [ -z "${todomsg}" ]; then - echo "ok ${ntest}" - else - echo "ok ${ntest} # TODO ${todomsg}" - fi - else - if [ -z "${todomsg}" ]; then - echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" - else - echo "not ok ${ntest} # TODO ${todomsg}" - fi - fi - todomsg="" - ntest=$((ntest+1)) -} - -jexpect() -{ - s="${1}" - d="${2}" - e="${3}" - shift 3 - r=`jail -s ${s} / pjdfstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1` - echo "${r}" | ${GREP} -Eq '^'${e}'$' - if [ $? -eq 0 ]; then - if [ -z "${todomsg}" ]; then - echo "ok ${ntest}" - else - echo "ok ${ntest} # TODO ${todomsg}" - fi - else - if [ -z "${todomsg}" ]; then - echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" - else - echo "not ok ${ntest} # TODO ${todomsg}" - fi - fi - todomsg="" - ntest=$((ntest+1)) -} - -test_check() -{ - if [ $* ]; then - if [ -z "${todomsg}" ]; then - echo "ok ${ntest}" - else - echo "ok ${ntest} # TODO ${todomsg}" - fi - else - if [ -z "${todomsg}" ]; then - echo "not ok ${ntest}" - else - echo "not ok ${ntest} # TODO ${todomsg}" - fi - fi - todomsg="" - ntest=$((ntest+1)) -} - -todo() -{ - if [ "${os}" = "${1}" -o "${os}:${fs}" = "${1}" ]; then - todomsg="${2}" - fi -} - -namegen() -{ - echo "pjdfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | awk '{print $NF}'`" -} - -namegen_len() -{ - len="${1}" - - name="" - while :; do - namepart="`dd if=/dev/urandom bs=64 count=1 2>/dev/null | openssl md5 | awk '{print $NF}'`" - name="${name}${namepart}" - curlen=`printf "%s" "${name}" | wc -c` - [ ${curlen} -lt ${len} ] || break - done - name=`echo "${name}" | cut -b -${len}` - printf "%s" "${name}" -} - -# POSIX: -# {NAME_MAX} -# Maximum number of bytes in a filename (not including terminating null). -namegen_max() -{ - name_max=`${fstest} pathconf . _PC_NAME_MAX` - namegen_len ${name_max} -} - -# POSIX: -# {PATH_MAX} -# Maximum number of bytes in a pathname, including the terminating null character. -dirgen_max() -{ - name_max=`${fstest} pathconf . _PC_NAME_MAX` - complen=$((name_max/2)) - path_max=`${fstest} pathconf . _PC_PATH_MAX` - # "...including the terminating null character." - path_max=$((path_max-1)) - - name="" - while :; do - name="${name}`namegen_len ${complen}`/" - curlen=`printf "%s" "${name}" | wc -c` - [ ${curlen} -lt ${path_max} ] || break - done - name=`echo "${name}" | cut -b -${path_max}` - name=`echo "${name}" | sed -E 's@/$@x@'` - printf "%s" "${name}" -} - -quick_exit() -{ - echo "1..1" - echo "ok 1" - exit 0 -} - -supported() -{ - case "${1}" in - lchmod) - if [ "${os}" != "FreeBSD" ]; then - return 1 - fi - ;; - chflags) - if [ "${os}" != "FreeBSD" ]; then - return 1 - fi - ;; - chflags_SF_SNAPSHOT) - if [ "${os}" != "FreeBSD" -o "${fs}" != "UFS" ]; then - return 1 - fi - ;; - esac - return 0 -} - -require() -{ - if supported ${1}; then - return - fi - quick_exit -} - -# usage: -# create_file <type> <name> -# create_file <type> <name> <mode> -# create_file <type> <name> <uid> <gid> -# create_file <type> <name> <mode> <uid> <gid> -create_file() { - type="${1}" - name="${2}" - - case "${type}" in - none) - return - ;; - regular) - expect 0 create ${name} 0644 - ;; - dir) - expect 0 mkdir ${name} 0755 - ;; - fifo) - expect 0 mkfifo ${name} 0644 - ;; - block) - expect 0 mknod ${name} b 0644 1 2 - ;; - char) - expect 0 mknod ${name} c 0644 1 2 - ;; - socket) - expect 0 bind ${name} - ;; - symlink) - expect 0 symlink test ${name} - ;; - esac - if [ -n "${3}" -a -n "${4}" -a -n "${5}" ]; then - expect 0 lchmod ${name} ${3} - expect 0 lchown ${name} ${4} ${5} - elif [ -n "${3}" -a -n "${4}" ]; then - expect 0 lchown ${name} ${3} ${4} - elif [ -n "${3}" ]; then - expect 0 lchmod ${name} ${3} - fi -} diff --git a/tools/regression/pjdfstest/tests/mkdir/00.t b/tools/regression/pjdfstest/tests/mkdir/00.t deleted file mode 100644 index d640de9..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/00.t +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir creates directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new directory shall be initialized from -# mode. These file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mkdir ${n0} 0755 -expect dir,0755 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 mkdir ${n0} 0151 -expect dir,0151 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 077 mkdir ${n0} 0151 -expect dir,0100 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 070 mkdir ${n0} 0345 -expect dir,0305 lstat ${n0} type,mode -expect 0 rmdir ${n0} -expect 0 -U 0501 mkdir ${n0} 0345 -expect dir,0244 lstat ${n0} type,mode -expect 0 rmdir ${n0} - -# POSIX: The directory's user ID shall be set to the process' effective user ID. -# The directory's group ID shall be set to the group ID of the parent directory -# or to the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mkdir ${n0} 0755 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 rmdir ${n0} -expect 0 -u 65535 -g 65534 mkdir ${n0} 0755 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 rmdir ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mkdir ${n0} 0755 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 rmdir ${n0} - -# POSIX: Upon successful completion, mkdir() shall mark for update the st_atime, -# st_ctime, and st_mtime fields of the directory. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mkdir ${n0} 0755 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/mkdir/01.t b/tools/regression/pjdfstest/tests/mkdir/01.t deleted file mode 100644 index c1de087..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/01.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mkdir ${n0}/${n1}/test 0755 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/02.t b/tools/regression/pjdfstest/tests/mkdir/02.t deleted file mode 100644 index edb103d..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/02.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENAMETOOLONG mkdir ${nxx} 0755 diff --git a/tools/regression/pjdfstest/tests/mkdir/03.t b/tools/regression/pjdfstest/tests/mkdir/03.t deleted file mode 100644 index aa3b44c..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/03.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENAMETOOLONG mkdir ${nxx} 0755 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/mkdir/04.t b/tools/regression/pjdfstest/tests/mkdir/04.t deleted file mode 100644 index cd65819..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/04.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mkdir ${n0}/${n1}/test 0755 -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/05.t b/tools/regression/pjdfstest/tests/mkdir/05.t deleted file mode 100644 index 7e97d9b..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/05.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/06.t b/tools/regression/pjdfstest/tests/mkdir/06.t deleted file mode 100644 index 79aa539..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/06.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EACCES when write permission is denied on the parent directory of the directory to be created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/07.t b/tools/regression/pjdfstest/tests/mkdir/07.t deleted file mode 100644 index dbb00df..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mkdir ${n0}/test 0755 -expect ELOOP mkdir ${n1}/test 0755 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/mkdir/08.t b/tools/regression/pjdfstest/tests/mkdir/08.t deleted file mode 100644 index ed6d92e..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/08.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EPERM if the parent directory of the directory to be created has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..17" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM mkdir ${n0}/${n1} 0755 -expect 0 chflags ${n0} none -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} -expect 0 chflags ${n0} none - -expect 0 chflags ${n0} SF_APPEND -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM mkdir ${n0}/${n1} 0755 - expect 0 chflags ${n0} none - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 rmdir ${n0}/${n1} - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 rmdir ${n0}/${n1} - expect 0 chflags ${n0} none - - expect 0 chflags ${n0} UF_APPEND - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 chflags ${n0} none - expect 0 rmdir ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/09.t b/tools/regression/pjdfstest/tests/mkdir/09.t deleted file mode 100644 index ce4bc9d..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/09.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS mkdir ${n0}/${n1} 0755 -mount -uw /dev/md${n} -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 rmdir ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/10.t b/tools/regression/pjdfstest/tests/mkdir/10.t deleted file mode 100644 index f64b8fd..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/10.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mkdir ${n0} 0755 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/mkdir/11.t b/tools/regression/pjdfstest/tests/mkdir/11.t deleted file mode 100644 index 3943e61..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/11.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns ENOSPC if there are no free inodes on the file system on which the directory is being created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 256k` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -i=0 -while :; do - mkdir ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -expect ENOSPC mkdir ${n0}/${n1} 0755 -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkdir/12.t b/tools/regression/pjdfstest/tests/mkdir/12.t deleted file mode 100644 index af322c4..0000000 --- a/tools/regression/pjdfstest/tests/mkdir/12.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkdir returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT mkdir NULL 0755 -expect EFAULT mkdir DEADCODE 0755 diff --git a/tools/regression/pjdfstest/tests/mkfifo/00.t b/tools/regression/pjdfstest/tests/mkfifo/00.t deleted file mode 100644 index eda7b17..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/00.t +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo creates fifo files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new FIFO shall be initialized from -# mode. The file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mkfifo ${n0} 0755 -expect fifo,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 mkfifo ${n0} 0151 -expect fifo,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 mkfifo ${n0} 0151 -expect fifo,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 mkfifo ${n0} 0345 -expect fifo,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 mkfifo ${n0} 0345 -expect fifo,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: The FIFO's user ID shall be set to the process' effective user ID. -# The FIFO's group ID shall be set to the group ID of the parent directory or to -# the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mkfifo ${n0} 0755 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 mkfifo ${n0} 0755 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mkfifo ${n0} 0755 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# POSIX: Upon successful completion, mkfifo() shall mark for update the -# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mkfifo ${n0} 0755 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/mkfifo/01.t b/tools/regression/pjdfstest/tests/mkfifo/01.t deleted file mode 100644 index 1c6193b..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/01.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mkfifo ${n0}/${n1}/test 0644 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/02.t b/tools/regression/pjdfstest/tests/mkfifo/02.t deleted file mode 100644 index 8589e9d..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/02.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkfifo ${nx} 0644 -expect fifo,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mkfifo ${nxx} 0644 diff --git a/tools/regression/pjdfstest/tests/mkfifo/03.t b/tools/regression/pjdfstest/tests/mkfifo/03.t deleted file mode 100644 index caf529f..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/03.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkfifo ${nx} 0644 -expect fifo stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mkfifo ${nxx} 0644 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/mkfifo/04.t b/tools/regression/pjdfstest/tests/mkfifo/04.t deleted file mode 100644 index d9ad951..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/04.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mkfifo ${n0}/${n1}/test 0644 -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/05.t b/tools/regression/pjdfstest/tests/mkfifo/05.t deleted file mode 100644 index d93d568..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/05.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/06.t b/tools/regression/pjdfstest/tests/mkfifo/06.t deleted file mode 100644 index 47f199b..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/06.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EACCES when write permission is denied on the parent directory of the file to be created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/07.t b/tools/regression/pjdfstest/tests/mkfifo/07.t deleted file mode 100644 index 44271b6..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mkfifo ${n0}/test 0644 -expect ELOOP mkfifo ${n1}/test 0644 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/mkfifo/08.t b/tools/regression/pjdfstest/tests/mkfifo/08.t deleted file mode 100644 index 0bdf430..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/08.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS mkfifo ${n0}/${n1} 0644 -mount -uw /dev/md${n} -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/09.t b/tools/regression/pjdfstest/tests/mkfifo/09.t deleted file mode 100644 index 6b2015e..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/09.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mkfifo ${n0} 0644 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/mkfifo/10.t b/tools/regression/pjdfstest/tests/mkfifo/10.t deleted file mode 100644 index e6aec44..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/10.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EPERM if the parent directory of the file to be created has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..17" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM mkfifo ${n0}/${n1} 0644 -expect 0 chflags ${n0} none -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 unlink ${n0}/${n1} -expect 0 chflags ${n0} none - -expect 0 chflags ${n0} SF_APPEND -expect 0 mkfifo ${n0}/${n1} 0644 -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM mkfifo ${n0}/${n1} 0644 - expect 0 chflags ${n0} none - expect 0 mkfifo ${n0}/${n1} 0644 - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 mkfifo ${n0}/${n1} 0644 - expect 0 unlink ${n0}/${n1} - expect 0 chflags ${n0} none - - expect 0 chflags ${n0} UF_APPEND - expect 0 mkfifo ${n0}/${n1} 0644 - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/11.t b/tools/regression/pjdfstest/tests/mkfifo/11.t deleted file mode 100644 index 261a8a7..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/11.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENOSPC if there are no free inodes on the file system on which the file is being created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 256k` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -i=0 -while :; do - mkfifo ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -expect ENOSPC mkfifo ${n0}/${n1} 0644 -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mkfifo/12.t b/tools/regression/pjdfstest/tests/mkfifo/12.t deleted file mode 100644 index 40c1455..0000000 --- a/tools/regression/pjdfstest/tests/mkfifo/12.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT mkfifo NULL 0644 -expect EFAULT mkfifo DEADCODE 0644 diff --git a/tools/regression/pjdfstest/tests/mknod/00.t b/tools/regression/pjdfstest/tests/mknod/00.t deleted file mode 100644 index 13f017d..0000000 --- a/tools/regression/pjdfstest/tests/mknod/00.t +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod creates fifo files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..36" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: The file permission bits of the new FIFO shall be initialized from -# mode. The file permission bits of the mode argument shall be modified by the -# process' file creation mask. -expect 0 mknod ${n0} f 0755 0 0 -expect fifo,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 mknod ${n0} f 0151 0 0 -expect fifo,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 mknod ${n0} f 0151 0 0 -expect fifo,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 mknod ${n0} f 0345 0 0 -expect fifo,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 mknod ${n0} f 0345 0 0 -expect fifo,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: The FIFO's user ID shall be set to the process' effective user ID. -# The FIFO's group ID shall be set to the group ID of the parent directory or to -# the effective group ID of the process. -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 mknod ${n0} f 0755 0 0 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 mknod ${n0} f 0755 0 0 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 mknod ${n0} f 0755 0 0 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# POSIX: Upon successful completion, mkfifo() shall mark for update the -# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and -# st_mtime fields of the directory that contains the new entry shall be marked -# for update. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 mknod ${n0} f 0755 0 0 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/mknod/01.t b/tools/regression/pjdfstest/tests/mknod/01.t deleted file mode 100644 index bc2b658..0000000 --- a/tools/regression/pjdfstest/tests/mknod/01.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..27" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR mknod ${n0}/${n1}/test b 0644 1 2 - expect ENOTDIR mknod ${n0}/${n1}/test c 0644 1 2 - expect ENOTDIR mknod ${n0}/${n1}/test f 0644 0 0 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mknod/02.t b/tools/regression/pjdfstest/tests/mknod/02.t deleted file mode 100644 index 99e607f..0000000 --- a/tools/regression/pjdfstest/tests/mknod/02.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mknod ${nx} f 0644 0 0 -expect fifo,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 - -expect 0 mknod ${nx} b 0644 1 2 -expect block,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} b 0644 0 0 - -expect 0 mknod ${nx} c 0644 1 2 -expect char,0644 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} c 0644 0 0 diff --git a/tools/regression/pjdfstest/tests/mknod/03.t b/tools/regression/pjdfstest/tests/mknod/03.t deleted file mode 100644 index 10776c7..0000000 --- a/tools/regression/pjdfstest/tests/mknod/03.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mknod ${nx} f 0644 0 0 -expect fifo stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 - -expect 0 mknod ${nx} b 0644 1 2 -expect block stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} b 0644 1 2 - -expect 0 mknod ${nx} c 0644 1 2 -expect char stat ${nx} type -expect 0 unlink ${nx} -expect ENAMETOOLONG mknod ${nxx} c 0644 1 2 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/mknod/04.t b/tools/regression/pjdfstest/tests/mknod/04.t deleted file mode 100644 index 6c30318..0000000 --- a/tools/regression/pjdfstest/tests/mknod/04.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mkfifo returns ENOENT if a component of the path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT mknod ${n0}/${n1}/test f 0644 0 0 -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mknod/05.t b/tools/regression/pjdfstest/tests/mknod/05.t deleted file mode 100644 index 8003541..0000000 --- a/tools/regression/pjdfstest/tests/mknod/05.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mknod/06.t b/tools/regression/pjdfstest/tests/mknod/06.t deleted file mode 100644 index 180cb9a..0000000 --- a/tools/regression/pjdfstest/tests/mknod/06.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns EACCES when write permission is denied on the parent directory of the file to be created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mknod/07.t b/tools/regression/pjdfstest/tests/mknod/07.t deleted file mode 100644 index 855d990..0000000 --- a/tools/regression/pjdfstest/tests/mknod/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP mknod ${n0}/test f 0644 0 0 -expect ELOOP mknod ${n1}/test f 0644 0 0 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/mknod/08.t b/tools/regression/pjdfstest/tests/mknod/08.t deleted file mode 100644 index 47d0010..0000000 --- a/tools/regression/pjdfstest/tests/mknod/08.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns EEXIST if the named file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..35" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST mknod ${n0} b 0644 0 0 - expect EEXIST mknod ${n0} c 0644 0 0 - expect EEXIST mknod ${n0} f 0644 0 0 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/mknod/09.t b/tools/regression/pjdfstest/tests/mknod/09.t deleted file mode 100644 index a12a02c..0000000 --- a/tools/regression/pjdfstest/tests/mknod/09.t +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns EPERM if the parent directory of the file to be created has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:UFS) - echo "1..30" - ;; -*) - echo "1..17" - ;; -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 mknod ${n0}/${n1} f 0644 0 0 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM mknod ${n0}/${n1} f 0644 0 0 -expect 0 chflags ${n0} none -expect 0 mknod ${n0}/${n1} f 0644 0 0 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_APPEND -expect 0 mknod ${n0}/${n1} f 0644 0 0 -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 mknod ${n0}/${n1} f 0644 0 0 -expect 0 unlink ${n0}/${n1} -expect 0 chflags ${n0} none - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM mknod ${n0}/${n1} f 0644 0 0 - expect 0 chflags ${n0} none - expect 0 mknod ${n0}/${n1} f 0644 0 0 - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_APPEND - expect 0 mknod ${n0}/${n1} f 0644 0 0 - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 mknod ${n0}/${n1} f 0644 0 0 - expect 0 unlink ${n0}/${n1} - expect 0 chflags ${n0} none - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/mknod/10.t b/tools/regression/pjdfstest/tests/mknod/10.t deleted file mode 100644 index fa6730f..0000000 --- a/tools/regression/pjdfstest/tests/mknod/10.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT mknod NULL f 0644 0 0 -expect EFAULT mknod DEADCODE f 0644 0 0 diff --git a/tools/regression/pjdfstest/tests/mknod/11.t b/tools/regression/pjdfstest/tests/mknod/11.t deleted file mode 100644 index da46cb9..0000000 --- a/tools/regression/pjdfstest/tests/mknod/11.t +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="mknod creates device files" - -dir=`dirname $0` -. ${dir}/../misc.sh - -case "${os}" in -SunOS) - echo "1..40" - ;; -*) - echo "1..28" - ;; -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -for type in c b; do - case "${type}" in - c) - stattype="char" - ;; - b) - stattype="block" - ;; - esac - - # Create char special with old-style numbers - expect 0 mknod ${n0} ${type} 0755 1 2 - expect ${stattype},0755 lstat ${n0} type,mode - expect 1,2 lstat ${n0} major,minor - expect EEXIST mknod ${n0} ${type} 0777 3 4 - expect 0 unlink ${n0} - - case "${os}" in - SunOS) - # Create char special with new-style numbers - expect 0 mknod ${n0} ${type} 0755 4095 4095 - expect ${stattype},0755 lstat ${n0} type,mode - expect 4095,4095 lstat ${n0} major,minor - expect EEXIST mknod ${n0} ${type} 0777 4000 4000 - expect 0 unlink ${n0} - - # mknod returns EINVAL if device's numbers are too big - # for 32-bit solaris !! - expect EINVAL mknod ${n0} ${type} 0755 4096 262144 - ;; - esac - - # POSIX: Upon successful completion, mknod(2) shall mark for update the - # st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and - # st_mtime fields of the directory that contains the new entry shall be marked - # for update. - expect 0 chown . 0 0 - time=`${fstest} stat . ctime` - sleep 1 - expect 0 mknod ${n0} ${type} 0755 1 2 - atime=`${fstest} stat ${n0} atime` - test_check $time -lt $atime - mtime=`${fstest} stat ${n0} mtime` - test_check $time -lt $mtime - ctime=`${fstest} stat ${n0} ctime` - test_check $time -lt $ctime - mtime=`${fstest} stat . mtime` - test_check $time -lt $mtime - ctime=`${fstest} stat . ctime` - test_check $time -lt $ctime - expect 0 unlink ${n0} -done - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/open/00.t b/tools/regression/pjdfstest/tests/open/00.t deleted file mode 100644 index caa24f0..0000000 --- a/tools/regression/pjdfstest/tests/open/00.t +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open opens (and eventually creates) a file" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..47" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -# POSIX: (If O_CREAT is specified and the file doesn't exist) [...] the access -# permission bits of the file mode shall be set to the value of the third -# argument taken as type mode_t modified as follows: a bitwise AND is performed -# on the file-mode bits and the corresponding bits in the complement of the -# process' file mode creation mask. Thus, all bits in the file mode whose -# corresponding bit in the file mode creation mask is set are cleared. -expect 0 open ${n0} O_CREAT,O_WRONLY 0755 -expect regular,0755 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 open ${n0} O_CREAT,O_WRONLY 0151 -expect regular,0151 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 077 open ${n0} O_CREAT,O_WRONLY 0151 -expect regular,0100 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 070 open ${n0} O_CREAT,O_WRONLY 0345 -expect regular,0305 lstat ${n0} type,mode -expect 0 unlink ${n0} -expect 0 -U 0501 open ${n0} O_CREAT,O_WRONLY 0345 -expect regular,0244 lstat ${n0} type,mode -expect 0 unlink ${n0} - -# POSIX: (If O_CREAT is specified and the file doesn't exist) [...] the user ID -# of the file shall be set to the effective user ID of the process; the group ID -# of the file shall be set to the group ID of the file's parent directory or to -# the effective group ID of the process [...] -expect 0 chown . 65535 65535 -expect 0 -u 65535 -g 65535 open ${n0} O_CREAT,O_WRONLY 0644 -expect 65535,65535 lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 -u 65535 -g 65534 open ${n0} O_CREAT,O_WRONLY 0644 -expect "65535,6553[45]" lstat ${n0} uid,gid -expect 0 unlink ${n0} -expect 0 chmod . 0777 -expect 0 -u 65534 -g 65533 open ${n0} O_CREAT,O_WRONLY 0644 -expect "65534,6553[35]" lstat ${n0} uid,gid -expect 0 unlink ${n0} - -# Update parent directory ctime/mtime if file didn't exist. -expect 0 chown . 0 0 -time=`${fstest} stat . ctime` -sleep 1 -expect 0 open ${n0} O_CREAT,O_WRONLY 0644 -atime=`${fstest} stat ${n0} atime` -test_check $time -lt $atime -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -mtime=`${fstest} stat . mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat . ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -# Don't update parent directory ctime/mtime if file existed. -expect 0 create ${n0} 0644 -dmtime=`${fstest} stat . mtime` -dctime=`${fstest} stat . ctime` -sleep 1 -expect 0 open ${n0} O_CREAT,O_RDONLY 0644 -mtime=`${fstest} stat . mtime` -test_check $dmtime -eq $mtime -ctime=`${fstest} stat . ctime` -test_check $dctime -eq $ctime -expect 0 unlink ${n0} - -echo test > ${n0} -expect 5 stat ${n0} size -mtime1=`${fstest} stat ${n0} mtime` -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 open ${n0} O_WRONLY,O_TRUNC -mtime2=`${fstest} stat ${n0} mtime` -test_check $mtime1 -lt $mtime2 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 stat ${n0} size -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/open/01.t b/tools/regression/pjdfstest/tests/open/01.t deleted file mode 100644 index 6dfc6f5..0000000 --- a/tools/regression/pjdfstest/tests/open/01.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..22" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR open ${n0}/${n1}/test O_RDONLY - expect ENOTDIR open ${n0}/${n1}/test O_CREAT 0644 - expect 0 unlink ${n0}/${n1} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/02.t b/tools/regression/pjdfstest/tests/open/02.t deleted file mode 100644 index 44ca1d7..0000000 --- a/tools/regression/pjdfstest/tests/open/02.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 open ${nx} O_CREAT 0620 -expect regular,0620 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG open ${nxx} O_CREAT 0620 diff --git a/tools/regression/pjdfstest/tests/open/03.t b/tools/regression/pjdfstest/tests/open/03.t deleted file mode 100644 index c398be1..0000000 --- a/tools/regression/pjdfstest/tests/open/03.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 open ${nx} O_CREAT 0642 -expect regular,0642 stat ${nx} type,mode -expect 0 unlink ${nx} -expect ENAMETOOLONG open ${nxx} O_CREAT 0642 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/open/04.t b/tools/regression/pjdfstest/tests/open/04.t deleted file mode 100644 index 1ce99cb..0000000 --- a/tools/regression/pjdfstest/tests/open/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENOENT if a component of the path name that must exist does not exist or O_CREAT is not set and the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT open ${n0}/${n1}/test O_CREAT 0644 -expect ENOENT open ${n0}/${n1} O_RDONLY -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/05.t b/tools/regression/pjdfstest/tests/open/05.t deleted file mode 100644 index 25ad7da..0000000 --- a/tools/regression/pjdfstest/tests/open/05.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 open ${n1}/${n2} O_RDONLY -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 open ${n1}/${n2} O_RDONLY -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 open ${n1}/${n2} O_RDONLY -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/06.t b/tools/regression/pjdfstest/tests/open/06.t deleted file mode 100644 index 007e24a..0000000 --- a/tools/regression/pjdfstest/tests/open/06.t +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EACCES when the required permissions (for reading and/or writing) are denied for the given flags" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..144" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 -cdir=`pwd` -cd ${n0} - -# Regular file. - -expect 0 -u 65534 -g 65534 create ${n1} 0644 - -expect 0 -u 65534 -g 65534 chmod ${n1} 0600 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY, -expect 0 -u 65534 -g 65534 open ${n1} O_WRONLY, -expect 0 -u 65534 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0060 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY, -expect 0 -u 65533 -g 65534 open ${n1} O_WRONLY, -expect 0 -u 65533 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0006 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY, -expect 0 -u 65533 -g 65533 open ${n1} O_WRONLY, -expect 0 -u 65533 -g 65533 open ${n1} O_RDWR, - -expect 0 -u 65534 -g 65534 chmod ${n1} 0477 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0747 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0774 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR, - -expect 0 -u 65534 -g 65534 chmod ${n1} 0277 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY, -expect 0 -u 65534 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0727 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY, -expect 0 -u 65533 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0772 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY, -expect 0 -u 65533 -g 65533 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR, - -expect 0 -u 65534 -g 65534 chmod ${n1} 0177 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0717 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0771 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR, - -expect 0 -u 65534 -g 65534 chmod ${n1} 0077 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0707 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR, -expect 0 -u 65534 -g 65534 chmod ${n1} 0770 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY, -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR, - -expect 0 -u 65534 -g 65534 unlink ${n1} - -# FIFO. - -expect 0 -u 65534 -g 65534 mkfifo ${n1} 0644 - -expect 0 -u 65534 -g 65534 chmod ${n1} 0600 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY,O_NONBLOCK -expect 0 -u 65534 -g 65534 open ${n1} O_RDWR,O_NONBLOCK -expect 0 -u 65534 -g 65534 chmod ${n1} 0060 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY,O_NONBLOCK -expect 0 -u 65533 -g 65534 open ${n1} O_RDWR,O_NONBLOCK -expect 0 -u 65534 -g 65534 chmod ${n1} 0006 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY,O_NONBLOCK -expect 0 -u 65533 -g 65533 open ${n1} O_RDWR,O_NONBLOCK - -expect 0 -u 65534 -g 65534 chmod ${n1} 0477 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY,O_NONBLOCK -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0747 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY,O_NONBLOCK -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0774 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY,O_NONBLOCK -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR - -expect 0 -u 65534 -g 65534 chmod ${n1} 0177 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0717 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0771 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR - -expect 0 -u 65534 -g 65534 chmod ${n1} 0077 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY -expect EACCES -u 65534 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65534 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0707 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY -expect EACCES -u 65533 -g 65534 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65534 open ${n1} O_RDWR -expect 0 -u 65534 -g 65534 chmod ${n1} 0770 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY -expect EACCES -u 65533 -g 65533 open ${n1} O_WRONLY -expect EACCES -u 65533 -g 65533 open ${n1} O_RDWR - -expect 0 -u 65534 -g 65534 unlink ${n1} - -# Directory. - -expect 0 -u 65534 -g 65534 mkdir ${n1} 0755 - -expect 0 -u 65534 -g 65534 chmod ${n1} 0600 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0060 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0006 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY - -expect 0 -u 65534 -g 65534 chmod ${n1} 0477 -expect 0 -u 65534 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0747 -expect 0 -u 65533 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0774 -expect 0 -u 65533 -g 65533 open ${n1} O_RDONLY - -expect 0 -u 65534 -g 65534 chmod ${n1} 0277 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0727 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0772 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY - -expect 0 -u 65534 -g 65534 chmod ${n1} 0177 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0717 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0771 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY - -expect 0 -u 65534 -g 65534 chmod ${n1} 0077 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0707 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY -expect 0 -u 65534 -g 65534 chmod ${n1} 0770 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY - -expect 0 -u 65534 -g 65534 rmdir ${n1} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/07.t b/tools/regression/pjdfstest/tests/open/07.t deleted file mode 100644 index a41d193..0000000 --- a/tools/regression/pjdfstest/tests/open/07.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EACCES when O_TRUNC is specified and write permission is denied" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..23" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 -cdir=`pwd` -cd ${n0} - -expect 0 -u 65534 -g 65534 create ${n1} 0644 - -expect 0 -u 65534 -g 65534 chmod ${n1} 0477 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0747 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0774 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY,O_TRUNC - -expect 0 -u 65534 -g 65534 chmod ${n1} 0177 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0717 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0771 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY,O_TRUNC - -expect 0 -u 65534 -g 65534 chmod ${n1} 0077 -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0707 -expect EACCES -u 65533 -g 65534 open ${n1} O_RDONLY,O_TRUNC -expect 0 -u 65534 -g 65534 chmod ${n1} 0770 -expect EACCES -u 65533 -g 65533 open ${n1} O_RDONLY,O_TRUNC - -expect 0 -u 65534 -g 65534 unlink ${n1} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/08.t b/tools/regression/pjdfstest/tests/open/08.t deleted file mode 100644 index 22ea29b..0000000 --- a/tools/regression/pjdfstest/tests/open/08.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EACCES when O_CREAT is specified, the file does not exist, and the directory in which it is to be created does not permit writing" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect EACCES -u 65534 -g 65534 open ${n1} O_RDONLY,O_CREAT 0644 -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/09.t b/tools/regression/pjdfstest/tests/open/09.t deleted file mode 100644 index 106e36f..0000000 --- a/tools/regression/pjdfstest/tests/open/09.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="O_CREAT is specified, the file does not exist, and the directory in which it is to be created has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..17" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 chflags ${n0} none -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_APPEND -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM open ${n0}/${n1} O_RDONLY,O_CREAT 0644 - expect 0 chflags ${n0} none - expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 symlink test ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_APPEND - expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/10.t b/tools/regression/pjdfstest/tests/open/10.t deleted file mode 100644 index 2cc943f..0000000 --- a/tools/regression/pjdfstest/tests/open/10.t +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EPERM when the named file has its immutable flag set and the file is to be modified" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..14" - ;; -FreeBSD:UFS) - echo "1..28" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM open ${n0} O_WRONLY -expect EPERM open ${n0} O_RDWR -expect EPERM open ${n0} O_RDONLY,O_TRUNC -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 open ${n0} O_WRONLY -expect 0 open ${n0} O_RDWR -expect 0 open ${n0} O_RDONLY,O_TRUNC -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM open ${n0} O_WRONLY - expect EPERM open ${n0} O_RDWR - expect EPERM open ${n0} O_RDONLY,O_TRUNC - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 open ${n0} O_WRONLY - expect 0 open ${n0} O_RDWR - expect 0 open ${n0} O_RDONLY,O_TRUNC - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/open/11.t b/tools/regression/pjdfstest/tests/open/11.t deleted file mode 100644 index c68bb25..0000000 --- a/tools/regression/pjdfstest/tests/open/11.t +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EPERM when the named file has its append-only flag set, the file is to be modified, and O_TRUNC is specified or O_APPEND is not specified" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..12" - ;; -FreeBSD:UFS) - echo "1..24" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_APPEND -expect 0 open ${n0} O_WRONLY,O_APPEND -expect 0 open ${n0} O_RDWR,O_APPEND -expect EPERM open ${n0} O_WRONLY -expect EPERM open ${n0} O_RDWR -todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM." -expect EPERM open ${n0} O_RDONLY,O_TRUNC -todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM." -expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC -todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM." -expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC -todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM." -expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_APPEND - expect 0 open ${n0} O_WRONLY,O_APPEND - expect 0 open ${n0} O_RDWR,O_APPEND - expect EPERM open ${n0} O_WRONLY - expect EPERM open ${n0} O_RDWR - expect EPERM open ${n0} O_RDONLY,O_TRUNC - expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC - expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC - expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/open/12.t b/tools/regression/pjdfstest/tests/open/12.t deleted file mode 100644 index 2726dc1..0000000 --- a/tools/regression/pjdfstest/tests/open/12.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP open ${n0}/test O_RDONLY -expect ELOOP open ${n1}/test O_RDONLY -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/open/13.t b/tools/regression/pjdfstest/tests/open/13.t deleted file mode 100644 index 77bc4c2..0000000 --- a/tools/regression/pjdfstest/tests/open/13.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EISDIR when trying to open a directory for writing" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -echo "1..8" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 open ${n0} O_RDONLY -expect EISDIR open ${n0} O_WRONLY -expect EISDIR open ${n0} O_RDWR -expect EISDIR open ${n0} O_RDONLY,O_TRUNC -expect EISDIR open ${n0} O_WRONLY,O_TRUNC -expect EISDIR open ${n0} O_RDWR,O_TRUNC - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/14.t b/tools/regression/pjdfstest/tests/open/14.t deleted file mode 100644 index 3d81f3e..0000000 --- a/tools/regression/pjdfstest/tests/open/14.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EROFS if the named file resides on a read-only file system, and the file is to be modified" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -expect 0 open ${n0}/${n1} O_WRONLY -expect 0 open ${n0}/${n1} O_RDWR -expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC -mount -ur /dev/md${n} -expect EROFS open ${n0}/${n1} O_WRONLY -expect EROFS open ${n0}/${n1} O_RDWR -expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC -mount -uw /dev/md${n} -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/15.t b/tools/regression/pjdfstest/tests/open/15.t deleted file mode 100644 index d90877b..0000000 --- a/tools/regression/pjdfstest/tests/open/15.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EROFS when O_CREAT is specified and the named file would reside on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644 -mount -uw /dev/md${n} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/16.t b/tools/regression/pjdfstest/tests/open/16.t deleted file mode 100644 index a15cd9b..0000000 --- a/tools/regression/pjdfstest/tests/open/16.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ELOOP when O_NOFOLLOW was specified and the target is a symbolic link" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect ELOOP open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644 -expect ELOOP open ${n1} O_RDONLY,O_NOFOLLOW -expect ELOOP open ${n1} O_WRONLY,O_NOFOLLOW -expect ELOOP open ${n1} O_RDWR,O_NOFOLLOW -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/open/17.t b/tools/regression/pjdfstest/tests/open/17.t deleted file mode 100644 index 2224daf..0000000 --- a/tools/regression/pjdfstest/tests/open/17.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENXIO when O_NONBLOCK is set, the named file is a fifo, O_WRONLY is set, and no process has the file open for reading" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 mkfifo ${n0} 0644 -expect ENXIO open ${n0} O_WRONLY,O_NONBLOCK -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/open/18.t b/tools/regression/pjdfstest/tests/open/18.t deleted file mode 100644 index bd8eea4..0000000 --- a/tools/regression/pjdfstest/tests/open/18.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EWOULDBLOCK when O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is specified and the file is locked" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..6" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK -expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/open/19.t b/tools/regression/pjdfstest/tests/open/19.t deleted file mode 100644 index b1c3994..0000000 --- a/tools/regression/pjdfstest/tests/open/19.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ENOSPC when O_CREAT is specified, the file does not exist, and there are no free inodes on the file system on which the file is being created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 256k` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -i=0 -while :; do - touch ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644 -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/open/20.t b/tools/regression/pjdfstest/tests/open/20.t deleted file mode 100644 index 736ad72..0000000 --- a/tools/regression/pjdfstest/tests/open/20.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns ETXTBSY when the file is a pure procedure (shared text) file that is being executed and the open() system call requests write access" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..4" - -n0=`namegen` - -cp -pf `which sleep` ${n0} -./${n0} 3 & -expect ETXTBSY open ${n0} O_WRONLY -expect ETXTBSY open ${n0} O_RDWR -expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/open/21.t b/tools/regression/pjdfstest/tests/open/21.t deleted file mode 100644 index c43d7fd..0000000 --- a/tools/regression/pjdfstest/tests/open/21.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT open NULL O_RDONLY -expect EFAULT open DEADCODE O_RDONLY diff --git a/tools/regression/pjdfstest/tests/open/22.t b/tools/regression/pjdfstest/tests/open/22.t deleted file mode 100644 index 464dae7..0000000 --- a/tools/regression/pjdfstest/tests/open/22.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/open/23.t b/tools/regression/pjdfstest/tests/open/23.t deleted file mode 100644 index fc2c6b9..0000000 --- a/tools/regression/pjdfstest/tests/open/23.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open may return EINVAL when an attempt was made to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY, and O_RDWR" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect "0|EINVAL" open ${n0} O_RDONLY,O_RDWR -expect "0|EINVAL" open ${n0} O_WRONLY,O_RDWR -expect "0|EINVAL" open ${n0} O_RDONLY,O_WRONLY,O_RDWR -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/open/24.t b/tools/regression/pjdfstest/tests/open/24.t deleted file mode 100644 index d51d632..0000000 --- a/tools/regression/pjdfstest/tests/open/24.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="open returns EOPNOTSUPP when trying to open UNIX domain socket" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` - -expect 0 bind ${n0} -expect "EOPNOTSUPP" open ${n0} O_RDONLY -expect "EOPNOTSUPP" open ${n0} O_WRONLY -expect "EOPNOTSUPP" open ${n0} O_RDWR -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/00.t b/tools/regression/pjdfstest/tests/rename/00.t deleted file mode 100644 index 49f7609..0000000 --- a/tools/regression/pjdfstest/tests/rename/00.t +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename changes file name" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..150" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n3} 0755 -cdir=`pwd` -cd ${n3} - -for type in regular fifo block char socket; do - create_file ${type} ${n0} 0644 - expect ${type},0644,1 lstat ${n0} type,mode,nlink - inode=`${fstest} lstat ${n0} inode` - expect 0 rename ${n0} ${n1} - expect ENOENT lstat ${n0} type,mode,nlink - expect ${type},${inode},0644,1 lstat ${n1} type,inode,mode,nlink - expect 0 link ${n1} ${n0} - expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink - expect ${type},${inode},0644,2 lstat ${n1} type,inode,mode,nlink - expect 0 rename ${n1} ${n2} - expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink - expect ENOENT lstat ${n1} type,mode,nlink - expect ${type},${inode},0644,2 lstat ${n2} type,inode,mode,nlink - expect 0 unlink ${n0} - expect 0 unlink ${n2} -done - -expect 0 mkdir ${n0} 0755 -expect dir,0755 lstat ${n0} type,mode -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode -expect dir,${inode},0755 lstat ${n1} type,inode,mode -expect 0 rmdir ${n1} - -expect 0 create ${n0} 0644 -rinode=`${fstest} lstat ${n0} inode` -expect regular,0644 lstat ${n0} type,mode -expect 0 symlink ${n0} ${n1} -sinode=`${fstest} lstat ${n1} inode` -expect regular,${rinode},0644 stat ${n1} type,inode,mode -expect symlink,${sinode} lstat ${n1} type,inode -expect 0 rename ${n1} ${n2} -expect regular,${rinode},0644 stat ${n0} type,inode,mode -expect ENOENT lstat ${n1} type,mode -expect symlink,${sinode} lstat ${n2} type,inode -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -# successful rename(2) updates ctime. -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 rename ${n0} ${n1} - ctime2=`${fstest} lstat ${n1} ctime` - test_check $ctime1 -lt $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -# unsuccessful link(2) does not update ctime. -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EACCES -u 65534 rename ${n0} ${n1} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done - -cd ${cdir} -expect 0 rmdir ${n3} diff --git a/tools/regression/pjdfstest/tests/rename/01.t b/tools/regression/pjdfstest/tests/rename/01.t deleted file mode 100644 index 291216d..0000000 --- a/tools/regression/pjdfstest/tests/rename/01.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 rename ${nx} ${n0} -expect 0 rename ${n0} ${nx} -expect 0 unlink ${nx} - -expect 0 create ${n0} 0644 -expect ENAMETOOLONG rename ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${nxx} ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/02.t b/tools/regression/pjdfstest/tests/rename/02.t deleted file mode 100644 index 7557e89..0000000 --- a/tools/regression/pjdfstest/tests/rename/02.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${n0} 0644 -expect 0 rename ${n0} ${nx} -expect 0 rename ${nx} ${n0} -expect ENAMETOOLONG rename ${n0} ${nxx} -expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${nxx} ${n0} - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/rename/03.t b/tools/regression/pjdfstest/tests/rename/03.t deleted file mode 100644 index 8404dbe..0000000 --- a/tools/regression/pjdfstest/tests/rename/03.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ENOENT if a component of the 'from' path does not exist, or a path prefix of 'to' does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT rename ${n0}/${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ENOENT rename ${n2} ${n0}/${n1}/test -expect 0 unlink ${n2} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/04.t b/tools/regression/pjdfstest/tests/rename/04.t deleted file mode 100644 index af3801f..0000000 --- a/tools/regression/pjdfstest/tests/rename/04.t +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EACCES when a component of either path prefix denies search permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..18" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 mkdir ${n2} 0755 -expect 0 chown ${n2} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 - -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n2}/${n4} -expect 0 -u 65534 -g 65534 rename ${n2}/${n4} ${n1}/${n3} - -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 rename ${n1}/${n3} ${n1}/${n4} -expect EACCES -u 65534 -g 65534 rename ${n1}/${n3} ${n2}/${n4} - -expect 0 chmod ${n1} 0755 -expect 0 chmod ${n2} 0644 -expect EACCES -u 65534 -g 65534 rename ${n1}/${n3} ${n2}/${n4} - -expect 0 unlink ${n1}/${n3} -expect 0 rmdir ${n1} -expect 0 rmdir ${n2} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/05.t b/tools/regression/pjdfstest/tests/rename/05.t deleted file mode 100644 index 39aa28f..0000000 --- a/tools/regression/pjdfstest/tests/rename/05.t +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EACCES when the requested link requires writing in a directory with a mode that denies write permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..17" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 mkdir ${n2} 0755 -expect 0 chown ${n2} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 - -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n2}/${n4} -expect 0 -u 65534 -g 65534 rename ${n2}/${n4} ${n1}/${n3} - -expect 0 chmod ${n2} 0555 -expect EACCES -u 65534 -g 65534 rename ${n1}/${n3} ${n2}/${n4} -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 rename ${n1}/${n3} ${n1}/${n4} -expect 0 chmod ${n1} 0755 - -expect 0 unlink ${n1}/${n3} -expect 0 rmdir ${n1} -expect 0 rmdir ${n2} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/06.t b/tools/regression/pjdfstest/tests/rename/06.t deleted file mode 100644 index 2606c4e..0000000 --- a/tools/regression/pjdfstest/tests/rename/06.t +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EPERM if the file pointed at by the 'from' argument has its immutable, undeletable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND" - echo "1..195" - ;; -FreeBSD:UFS) - flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND" - echo "1..351" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -for type in regular dir fifo block char socket symlink; do - if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} - for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} - done - expect 0 chflags ${n0} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi - fi - - create_file ${type} ${n0} - for flag in ${flags}; do - expect 0 lchflags ${n0} ${flag} - expect ${flag} lstat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} - done - expect 0 lchflags ${n0} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/rename/07.t b/tools/regression/pjdfstest/tests/rename/07.t deleted file mode 100644 index 450b653..0000000 --- a/tools/regression/pjdfstest/tests/rename/07.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EPERM if the parent directory of the file pointed at by the 'from' argument has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - flags1="SF_IMMUTABLE SF_APPEND" - flags2="SF_NOUNLINK" - echo "1..128" - ;; -FreeBSD:UFS) - flags1="SF_IMMUTABLE SF_APPEND UF_IMMUTABLE UF_APPEND" - flags2="SF_NOUNLINK UF_NOUNLINK" - echo "1..212" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} - done - expect 0 chflags ${n0} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} - done - expect 0 chflags ${n0} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/08.t b/tools/regression/pjdfstest/tests/rename/08.t deleted file mode 100644 index 480672f..0000000 --- a/tools/regression/pjdfstest/tests/rename/08.t +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EPERM if the parent directory of the file pointed at by the 'to' argument has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - flags1="SF_IMMUTABLE" - flags2="SF_NOUNLINK SF_APPEND" - echo "1..128" - ;; -FreeBSD:UFS) - flags1="SF_IMMUTABLE UF_IMMUTABLE" - flags2="SF_NOUNLINK SF_APPEND UF_NOUNLINK UF_APPEND" - echo "1..219" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1} - for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} - done - expect 0 chflags ${n0} none - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1} - for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} - done - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1} - else - expect 0 unlink ${n1} - fi -done - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/09.t b/tools/regression/pjdfstest/tests/rename/09.t deleted file mode 100644 index 91d16a6..0000000 --- a/tools/regression/pjdfstest/tests/rename/09.t +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EACCES or EPERM if the directory containing 'from' is marked sticky, and neither the containing directory nor 'from' are owned by the effective user ID" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2353" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n4} 0755 -cdir=`pwd` -cd ${n4} - -expect 0 mkdir ${n0} 0755 -expect 0 chmod ${n0} 01777 -expect 0 chown ${n0} 65534 65534 - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 - -for type in regular fifo block char socket symlink; do - # User owns both: the source sticky directory and the source file. - expect 0 chown ${n0} 65534 65534 - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in none regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - - # User owns the source sticky directory, but doesn't own the source file. - for id in 0 65533; do - expect 0 chown ${n0} 65534 65534 - create_file ${type} ${n0}/${n2} ${id} ${id} - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in none regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode},${id},${id} lstat ${n1}/${n3} inode,uid,gid - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - done - - # User owns the source file, but doesn't own the source sticky directory. - for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in none regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - done - - # User doesn't own the source sticky directory nor the source file. - for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file ${type} ${n0}/${n2} ${id} ${id} - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in none regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid - if [ "${type}" != "none" ]; then - expect 65534,65534 lstat ${n1}/${n3} uid,gid - expect 0 unlink ${n1}/${n3} - fi - done - - expect 0 unlink ${n0}/${n2} - done -done - -# User owns both: the source sticky directory and the source directory. -expect 0 chown ${n0} 65534 65534 -create_file dir ${n0}/${n2} 65534 65534 -inode=`${fstest} lstat ${n0}/${n2} inode` - -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid -expect 0 rename ${n1}/${n3} ${n0}/${n2} - -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid -expect 0 rmdir ${n1}/${n3} - -# User owns the source sticky directory, but doesn't own the source directory. -# This fails when changing parent directory, because this will modify -# source directory inode (the .. link in it), but we can still rename it -# without changing its parent directory. -for id in 0 65533; do - expect 0 chown ${n0} 65534 65534 - create_file dir ${n0}/${n2} ${id} ${id} - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid - expect ENOENT lstat ${n1}/${n3} type - - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n0}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode},${id},${id} lstat ${n0}/${n3} inode,uid,gid - expect 0 rename ${n0}/${n3} ${n0}/${n2} - - expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid - expect dir,${id},${id} lstat ${n0}/${n2} type,uid,gid - expect 0 rmdir ${n1}/${n3} - - expect 0 -u 65534 -g 65534 mkdir ${n0}/${n3} 0755 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n0}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode},${id},${id} lstat ${n0}/${n3} inode,uid,gid - expect 0 rmdir ${n0}/${n3} -done - -# User owns the source directory, but doesn't own the source sticky directory. -for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file dir ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid - expect 0 rename ${n1}/${n3} ${n0}/${n2} - - expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid - expect 0 rmdir ${n1}/${n3} -done - -# User doesn't own the source sticky directory nor the source directory. -for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file dir ${n0}/${n2} ${id} ${id} - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid - expect ENOENT lstat ${n1}/${n3} type - - expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid - expect dir,65534,65534 lstat ${n1}/${n3} type,uid,gid - expect 0 rmdir ${n0}/${n2} - expect 0 rmdir ${n1}/${n3} -done - -expect 0 rmdir ${n1} -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n4} diff --git a/tools/regression/pjdfstest/tests/rename/10.t b/tools/regression/pjdfstest/tests/rename/10.t deleted file mode 100644 index 3b48d1f..0000000 --- a/tools/regression/pjdfstest/tests/rename/10.t +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EACCES or EPERM if the file pointed at by the 'to' argument exists, the directory containing 'to' is marked sticky, and neither the containing directory nor 'to' are owned by the effective user ID" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2099" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` -n4=`namegen` - -expect 0 mkdir ${n4} 0755 -cdir=`pwd` -cd ${n4} - -expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 - -expect 0 mkdir ${n1} 0755 -expect 0 chmod ${n1} 01777 - -for type in regular fifo block char socket symlink; do - # User owns both: the sticky directory and the destination file. - expect 0 chown ${n1} 65534 65534 - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode} lstat ${n1}/${n3} inode - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - - # User owns the sticky directory, but doesn't own the destination file. - for id in 0 65533; do - expect 0 chown ${n1} 65534 65534 - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} ${id} ${id} - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode} lstat ${n1}/${n3} inode - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - done - - # User owns the destination file, but doesn't own the sticky directory. - for id in 0 65533; do - expect 0 chown ${n1} ${id} ${id} - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} 65534 65534 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} inode - expect ${inode} lstat ${n1}/${n3} inode - expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} - expect ${inode} lstat ${n0}/${n2} inode - expect ENOENT lstat ${n1}/${n3} inode - done - - expect 0 unlink ${n0}/${n2} - done - - # User doesn't own the sticky directory nor the destination file. - for id in 0 65533; do - expect 0 chown ${n1} ${id} ${id} - create_file ${type} ${n0}/${n2} 65534 65534 - inode=`${fstest} lstat ${n0}/${n2} inode` - - for type in regular fifo block char socket symlink; do - create_file ${type} ${n1}/${n3} ${id} ${id} - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode} lstat ${n0}/${n2} inode - expect ${id},${id} lstat ${n1}/${n3} uid,gid - expect 0 unlink ${n1}/${n3} - done - - expect 0 unlink ${n0}/${n2} - done -done - -# User owns both: the sticky directory and the destination directory. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 -inode=`${fstest} lstat ${n0}/${n2} inode` - -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 rmdir ${n1}/${n3} - -# User owns the sticky directory, but doesn't own the destination directory. -for id in 0 65533; do - expect 0 chown ${n1} 65534 65534 - expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode} lstat ${n1}/${n3} inode - expect 0 rmdir ${n1}/${n3} -done - -# User owns the destination directory, but doesn't own the sticky directory. -for id in 0 65533; do - expect 0 chown ${n1} ${id} ${id} - expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 - expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ENOENT lstat ${n0}/${n2} type - expect ${inode} lstat ${n1}/${n3} inode - expect 0 rmdir ${n1}/${n3} -done - -# User doesn't own the sticky directory nor the destination directory. -for id in 0 65533; do - expect 0 chown ${n1} ${id} ${id} - expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 - inode=`${fstest} lstat ${n0}/${n2} inode` - - expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755 - expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} - expect ${inode} lstat ${n0}/${n2} inode - expect ${id},${id} lstat ${n1}/${n3} uid,gid - expect 0 rmdir ${n0}/${n2} - expect 0 rmdir ${n1}/${n3} -done - -expect 0 rmdir ${n1} -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n4} diff --git a/tools/regression/pjdfstest/tests/rename/11.t b/tools/regression/pjdfstest/tests/rename/11.t deleted file mode 100644 index 6120e64..0000000 --- a/tools/regression/pjdfstest/tests/rename/11.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ELOOP if too many symbolic links were encountered in translating one of the pathnames" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP rename ${n0}/test ${n2} -expect ELOOP rename ${n1}/test ${n2} -expect 0 create ${n2} 0644 -expect ELOOP rename ${n2} ${n0}/test -expect ELOOP rename ${n2} ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} -expect 0 unlink ${n2} diff --git a/tools/regression/pjdfstest/tests/rename/12.t b/tools/regression/pjdfstest/tests/rename/12.t deleted file mode 100644 index 4383d84..0000000 --- a/tools/regression/pjdfstest/tests/rename/12.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ENOTDIR if a component of either path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular fifo block char socket; do - create_file ${type} ${n0}/${n1} - expect ENOTDIR rename ${n0}/${n1}/test ${n0}/${n2} - create_file ${type} ${n0}/${n2} - expect ENOTDIR link ${n0}/${n2} ${n0}/${n1}/test - expect 0 unlink ${n0}/${n1} - expect 0 unlink ${n0}/${n2} -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/13.t b/tools/regression/pjdfstest/tests/rename/13.t deleted file mode 100644 index 5e39698..0000000 --- a/tools/regression/pjdfstest/tests/rename/13.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns ENOTDIR when the 'from' argument is a directory, but 'to' is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular fifo block char socket symlink; do - create_file ${type} ${n1} - expect ENOTDIR rename ${n0} ${n1} - expect dir lstat ${n0} type - expect ${type} lstat ${n1} type - expect 0 unlink ${n1} -done - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/14.t b/tools/regression/pjdfstest/tests/rename/14.t deleted file mode 100644 index 8133c91..0000000 --- a/tools/regression/pjdfstest/tests/rename/14.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EISDIR when the 'to' argument is a directory, but 'from' is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..32" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -for type in regular fifo block char socket symlink; do - create_file ${type} ${n1} - expect EISDIR rename ${n1} ${n0} - expect dir lstat ${n0} type - expect ${type} lstat ${n1} type - expect 0 unlink ${n1} -done - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/15.t b/tools/regression/pjdfstest/tests/rename/15.t deleted file mode 100644 index 46927ba..0000000 --- a/tools/regression/pjdfstest/tests/rename/15.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EXDEV if the link named by 'to' and the file named by 'from' are on different file systems" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..23" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - expect EXDEV rename ${n0}/${n1} ${n2} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done - -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/16.t b/tools/regression/pjdfstest/tests/rename/16.t deleted file mode 100644 index b327f36..0000000 --- a/tools/regression/pjdfstest/tests/rename/16.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EROFS if the requested link requires writing in a directory on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..8" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -mount -ur /dev/md${n} - -expect EROFS rename ${n0}/${n1} ${n0}/${n2} -expect EROFS rename ${n0}/${n1} ${n2} -expect 0 create ${n2} 0644 -expect EROFS rename ${n2} ${n0}/${n2} -expect 0 unlink ${n2} - -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/17.t b/tools/regression/pjdfstest/tests/rename/17.t deleted file mode 100644 index a391349..0000000 --- a/tools/regression/pjdfstest/tests/rename/17.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EFAULT rename ${n0} NULL -expect EFAULT rename ${n0} DEADCODE -expect 0 unlink ${n0} -expect EFAULT rename NULL ${n0} -expect EFAULT rename DEADCODE ${n0} -expect EFAULT rename NULL DEADCODE -expect EFAULT rename DEADCODE NULL diff --git a/tools/regression/pjdfstest/tests/rename/18.t b/tools/regression/pjdfstest/tests/rename/18.t deleted file mode 100644 index a69913b..0000000 --- a/tools/regression/pjdfstest/tests/rename/18.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EINVAL when the 'from' argument is a parent directory of 'to'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 - -expect EINVAL rename ${n0} ${n0}/${n1} -expect EINVAL rename ${n0} ${n0}/${n1}/${n2} - -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/19.t b/tools/regression/pjdfstest/tests/rename/19.t deleted file mode 100644 index 7459523..0000000 --- a/tools/regression/pjdfstest/tests/rename/19.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EINVAL/EBUSY when an attempt is made to rename '.' or '..'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 - -expect "EINVAL|EBUSY" rename ${n0}/${n1}/. ${n2} -expect "EINVAL|EBUSY" rename ${n0}/${n1}/.. ${n2} - -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/20.t b/tools/regression/pjdfstest/tests/rename/20.t deleted file mode 100644 index 619fea3..0000000 --- a/tools/regression/pjdfstest/tests/rename/20.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rename returns EEXIST or ENOTEMPTY if the 'to' argument is a directory and is not empty" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..25" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n1} 0755 - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n1}/${n2} - expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n1}/${n2} - else - expect 0 unlink ${n1}/${n2} - fi -done - -expect 0 rmdir ${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rename/21.t b/tools/regression/pjdfstest/tests/rename/21.t deleted file mode 100644 index 12d98e3..0000000 --- a/tools/regression/pjdfstest/tests/rename/21.t +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="write access to subdirectory is required to move it to another directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..16" - -n0=`namegen` -n1=`namegen` -n2=`namegen` -n3=`namegen` - -expect 0 mkdir ${n2} 0777 -expect 0 mkdir ${n3} 0777 -cdir=`pwd` - -# Check that write permission on containing directory (${n2}) is enough -# to rename subdirectory (${n0}). If we rename directory write access -# to this directory may also be required. -expect 0 mkdir ${n2}/${n0} 0700 -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1} -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0} - -# Check that write permission on containing directory (${n2}) is not enough -# to move subdirectory (${n0}) from that directory. -# Actually POSIX says that write access to ${n2} and ${n3} may be enough -# to move ${n0} from ${n2} to ${n3}. -expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} - -expect "0|ENOENT" rmdir ${n2}/${n0} -expect ENOENT rmdir ${n2}/${n0} -expect "0|ENOENT" rmdir ${n3}/${n1} -expect ENOENT rmdir ${n3}/${n1} - -# Check that write permission on containing directory (${n2}) is enough -# to move file (${n0}) from that directory. -expect 0 create ${n2}/${n0} 0644 -expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} - -expect 0 unlink ${n3}/${n1} -expect ENOENT unlink ${n2}/${n0} - -expect 0 rmdir ${n3} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/rmdir/00.t b/tools/regression/pjdfstest/tests/rmdir/00.t deleted file mode 100644 index 4381e66..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/00.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir removes directories" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect dir lstat ${n0} type -expect 0 rmdir ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rmdir ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/01.t b/tools/regression/pjdfstest/tests/rmdir/01.t deleted file mode 100644 index d2d407d..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/01.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns ENOTDIR if a component of the path is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..14" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR rmdir ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect ENOTDIR rmdir ${n0} -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/02.t b/tools/regression/pjdfstest/tests/rmdir/02.t deleted file mode 100644 index 3daae4e..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/02.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 mkdir ${nx} 0755 -expect 0 rmdir ${nx} -expect ENOENT rmdir ${nx} -expect ENAMETOOLONG rmdir ${nxx} diff --git a/tools/regression/pjdfstest/tests/rmdir/03.t b/tools/regression/pjdfstest/tests/rmdir/03.t deleted file mode 100644 index a7259e0..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 mkdir ${nx} 0755 -expect dir,0755 stat ${nx} type,mode -expect 0 rmdir ${nx} -expect ENOENT rmdir ${nx} -expect ENAMETOOLONG rmdir ${nxx} - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/rmdir/04.t b/tools/regression/pjdfstest/tests/rmdir/04.t deleted file mode 100644 index 77e1d30..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns ENOENT if the named directory does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 rmdir ${n0} -expect ENOENT rmdir ${n0} -expect ENOENT rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/rmdir/05.t b/tools/regression/pjdfstest/tests/rmdir/05.t deleted file mode 100644 index fd973a9..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/05.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP rmdir ${n0}/test -expect ELOOP rmdir ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/rmdir/06.t b/tools/regression/pjdfstest/tests/rmdir/06.t deleted file mode 100644 index 9de34b0..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/06.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EEXIST or ENOTEMPTY the named directory contains files other than '.' and '..' in it" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..23" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0}/${n1} - expect "EEXIST|ENOTEMPTY" rmdir ${n0} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0}/${n1} - else - expect 0 unlink ${n0}/${n1} - fi -done -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/07.t b/tools/regression/pjdfstest/tests/rmdir/07.t deleted file mode 100644 index 2528245..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/07.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/08.t b/tools/regression/pjdfstest/tests/rmdir/08.t deleted file mode 100644 index c1fb819..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/08.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EACCES when write permission is denied on the directory containing the link to be removed" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n2} 0755 -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/09.t b/tools/regression/pjdfstest/tests/rmdir/09.t deleted file mode 100644 index 240fd5c..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/09.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EPERM if the named directory has its immutable, undeletable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..15" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM rmdir ${n0} -expect 0 chflags ${n0} none -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 chflags ${n0} SF_NOUNLINK -expect EPERM rmdir ${n0} -expect 0 chflags ${n0} none -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 chflags ${n0} SF_APPEND -todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM." -expect EPERM rmdir ${n0} -todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM." -expect 0 chflags ${n0} none -todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM." -expect 0 rmdir ${n0} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 mkdir ${n0} 0755 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM rmdir ${n0} - expect 0 chflags ${n0} none - expect 0 rmdir ${n0} - - expect 0 mkdir ${n0} 0755 - expect 0 chflags ${n0} UF_NOUNLINK - expect EPERM rmdir ${n0} - expect 0 chflags ${n0} none - expect 0 rmdir ${n0} - - expect 0 mkdir ${n0} 0755 - expect 0 chflags ${n0} UF_APPEND - expect EPERM rmdir ${n0} - expect 0 chflags ${n0} none - expect 0 rmdir ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/rmdir/10.t b/tools/regression/pjdfstest/tests/rmdir/10.t deleted file mode 100644 index 7bdc261..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/10.t +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EPERM if the parent directory of the named file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..16" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM rmdir ${n0}/${n1} -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 rmdir ${n0}/${n1} -expect 0 chflags ${n0} none - -expect 0 mkdir ${n0}/${n1} 0755 -expect 0 chflags ${n0} SF_APPEND -todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM." -expect EPERM rmdir ${n0}/${n1} -expect 0 chflags ${n0} none -todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM." -expect 0 rmdir ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM rmdir ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 rmdir ${n0}/${n1} - - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 rmdir ${n0}/${n1} - expect 0 chflags ${n0} none - - expect 0 mkdir ${n0}/${n1} 0755 - expect 0 chflags ${n0} UF_APPEND - expect EPERM rmdir ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 rmdir ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/11.t b/tools/regression/pjdfstest/tests/rmdir/11.t deleted file mode 100644 index 6e4b0b1..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/11.t +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EACCES or EPERM if the directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..47" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 -expect 0 chmod ${n0} 01777 - -# User owns both: the sticky directory and the directory to be removed. -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755 -expect dir,65534,65534 lstat ${n0}/${n1} type,uid,gid -expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} -expect ENOENT lstat ${n0}/${n1} type -# User owns the directory to be removed, but doesn't own the sticky directory. -for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file dir ${n0}/${n1} 65534 65534 - expect dir,65534,65534 lstat ${n0}/${n1} type,uid,gid - expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} - expect ENOENT lstat ${n0}/${n1} type -done -# User owns the sticky directory, but doesn't own the directory to be removed. -expect 0 chown ${n0} 65534 65534 -for id in 0 65533; do - create_file dir ${n0}/${n1} ${id} ${id} - expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid - expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} - expect ENOENT lstat ${n0}/${n1} type -done -# User doesn't own the sticky directory nor the directory to be removed. -for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file dir ${n0}/${n1} ${id} ${id} - expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid - expect "EACCES|EPERM" -u 65534 -g 65534 rmdir ${n0}/${n1} - expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid - expect 0 rmdir ${n0}/${n1} -done - -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/rmdir/12.t b/tools/regression/pjdfstest/tests/rmdir/12.t deleted file mode 100644 index 9ba45a4..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/12.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EINVAL if the last component of the path is '.' and EEXIST or ENOTEMPTY if the last component of the path is '..'" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 mkdir ${n0}/${n1} 0755 -expect EINVAL rmdir ${n0}/${n1}/. -todo FreeBSD "According to POSIX: EEXIST or ENOTEMPTY - The path argument names a directory that is not an empty directory, or there are hard links to the directory other than dot or a single entry in dot-dot." -expect "ENOTEMPTY|EEXIST" rmdir ${n0}/${n1}/.. -expect 0 rmdir ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/13.t b/tools/regression/pjdfstest/tests/rmdir/13.t deleted file mode 100644 index 6140e7b..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/13.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EBUSY if the directory to be removed is the mount point for a mounted file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..3" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect EBUSY rmdir ${n0} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/14.t b/tools/regression/pjdfstest/tests/rmdir/14.t deleted file mode 100644 index faa5d5e..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/14.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 mkdir ${n0}/${n1} 0755 -mount -ur /dev/md${n} -expect EROFS rmdir ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 rmdir ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/rmdir/15.t b/tools/regression/pjdfstest/tests/rmdir/15.t deleted file mode 100644 index 8bfa149..0000000 --- a/tools/regression/pjdfstest/tests/rmdir/15.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="rmdir returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT rmdir NULL -expect EFAULT rmdir DEADCODE diff --git a/tools/regression/pjdfstest/tests/symlink/00.t b/tools/regression/pjdfstest/tests/symlink/00.t deleted file mode 100644 index 6e6d46d..0000000 --- a/tools/regression/pjdfstest/tests/symlink/00.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink creates symbolic links" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..14" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect regular,0644 lstat ${n0} type,mode -expect 0 symlink ${n0} ${n1} -expect symlink lstat ${n1} type -expect regular,0644 stat ${n1} type,mode -expect 0 unlink ${n0} -expect ENOENT stat ${n1} type,mode -expect 0 unlink ${n1} - -expect 0 mkdir ${n0} 0755 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 symlink test ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/01.t b/tools/regression/pjdfstest/tests/symlink/01.t deleted file mode 100644 index f19870c..0000000 --- a/tools/regression/pjdfstest/tests/symlink/01.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ENOTDIR if a component of the name2 path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR symlink test ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/02.t b/tools/regression/pjdfstest/tests/symlink/02.t deleted file mode 100644 index e06b936..0000000 --- a/tools/regression/pjdfstest/tests/symlink/02.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ENAMETOOLONG if a component of the name2 pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..7" - -n0=`namegen` -nx=`namegen_max` -nxx="${nx}x" - -expect 0 symlink ${nx} ${n0} -expect 0 unlink ${n0} -expect 0 symlink ${n0} ${nx} -expect 0 unlink ${nx} - -expect ENAMETOOLONG symlink ${n0} ${nxx} -expect 0 symlink ${nxx} ${n0} -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/03.t b/tools/regression/pjdfstest/tests/symlink/03.t deleted file mode 100644 index 38ebe5e..0000000 --- a/tools/regression/pjdfstest/tests/symlink/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" -expect 0 symlink ${nx} ${n0} -expect 0 unlink ${n0} -expect 0 symlink ${n0} ${nx} -expect 0 unlink ${nx} -expect ENAMETOOLONG symlink ${n0} ${nxx} -expect ENAMETOOLONG symlink ${nxx} ${n0} -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/symlink/04.t b/tools/regression/pjdfstest/tests/symlink/04.t deleted file mode 100644 index cc5e7b7..0000000 --- a/tools/regression/pjdfstest/tests/symlink/04.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ENOENT if a component of the name2 path prefix does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT symlink test ${n0}/${n1}/test -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/05.t b/tools/regression/pjdfstest/tests/symlink/05.t deleted file mode 100644 index c823a59..0000000 --- a/tools/regression/pjdfstest/tests/symlink/05.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EACCES when a component of the name2 path prefix denies search permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 - -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} - -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} - -expect 0 rmdir ${n1} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/06.t b/tools/regression/pjdfstest/tests/symlink/06.t deleted file mode 100644 index 1f27818..0000000 --- a/tools/regression/pjdfstest/tests/symlink/06.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EACCES if the parent directory of the file to be created denies write permission" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..12" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 - -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} - -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} -expect 0 unlink ${n1}/${n2} - -expect 0 rmdir ${n1} - -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/07.t b/tools/regression/pjdfstest/tests/symlink/07.t deleted file mode 100644 index aa60b77..0000000 --- a/tools/regression/pjdfstest/tests/symlink/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ELOOP if too many symbolic links were encountered in translating the name2 path name" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP symlink test ${n0}/test -expect ELOOP symlink test ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/symlink/08.t b/tools/regression/pjdfstest/tests/symlink/08.t deleted file mode 100644 index 9d539f1..0000000 --- a/tools/regression/pjdfstest/tests/symlink/08.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EEXIST if the name2 argument already exists" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` - -for type in regular dir fifo block char socket symlink; do - create_file ${type} ${n0} - expect EEXIST symlink test ${n0} - if [ "${type}" = "dir" ]; then - expect 0 rmdir ${n0} - else - expect 0 unlink ${n0} - fi -done diff --git a/tools/regression/pjdfstest/tests/symlink/09.t b/tools/regression/pjdfstest/tests/symlink/09.t deleted file mode 100644 index 4807db4..0000000 --- a/tools/regression/pjdfstest/tests/symlink/09.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EPERM if the parent directory of the file named by name2 has its immutable flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..17" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM symlink test ${n0}/${n1} -expect 0 chflags ${n0} none -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 symlink test ${n0}/${n1} -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 chflags ${n0} SF_APPEND -expect 0 symlink test ${n0}/${n1} -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM symlink test ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 symlink test ${n0}/${n1} - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 symlink test ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - - expect 0 chflags ${n0} UF_APPEND - expect 0 symlink test ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/10.t b/tools/regression/pjdfstest/tests/symlink/10.t deleted file mode 100644 index b43da77..0000000 --- a/tools/regression/pjdfstest/tests/symlink/10.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EROFS if the file name2 would reside on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..7" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} - -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} -mount -ur /dev/md${n} -expect EROFS symlink test ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 symlink test ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/11.t b/tools/regression/pjdfstest/tests/symlink/11.t deleted file mode 100644 index 2f04b7b..0000000 --- a/tools/regression/pjdfstest/tests/symlink/11.t +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns ENOSPC if there are no free inodes on the file system on which the symbolic link is being created" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..3" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 256k` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -i=0 -while :; do - ln -s test ${n0}/${i} >/dev/null 2>&1 - if [ $? -ne 0 ]; then - break - fi - i=`expr $i + 1` -done -expect ENOSPC symlink test ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/symlink/12.t b/tools/regression/pjdfstest/tests/symlink/12.t deleted file mode 100644 index 8606a38..0000000 --- a/tools/regression/pjdfstest/tests/symlink/12.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="symlink returns EFAULT if one of the pathnames specified is outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` - -expect EFAULT symlink NULL ${n0} -expect EFAULT symlink DEADCODE ${n0} -expect EFAULT symlink test NULL -expect EFAULT symlink test DEADCODE -expect EFAULT symlink NULL DEADCODE -expect EFAULT symlink DEADCODE NULL diff --git a/tools/regression/pjdfstest/tests/truncate/00.t b/tools/regression/pjdfstest/tests/truncate/00.t deleted file mode 100644 index c09f068..0000000 --- a/tools/regression/pjdfstest/tests/truncate/00.t +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate descrease/increase file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..21" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n1} 0755 -cdir=`pwd` -cd ${n1} - -expect 0 create ${n0} 0644 -expect 0 truncate ${n0} 1234567 -expect 1234567 lstat ${n0} size -expect 0 truncate ${n0} 567 -expect 567 lstat ${n0} size -expect 0 unlink ${n0} - -dd if=/dev/random of=${n0} bs=12345 count=1 >/dev/null 2>&1 -expect 0 truncate ${n0} 23456 -expect 23456 lstat ${n0} size -expect 0 truncate ${n0} 1 -expect 1 lstat ${n0} size -expect 0 unlink ${n0} - -# successful truncate(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 truncate ${n0} 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful truncate(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 truncate ${n0} 123 -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n1} diff --git a/tools/regression/pjdfstest/tests/truncate/01.t b/tools/regression/pjdfstest/tests/truncate/01.t deleted file mode 100644 index ac504a1..0000000 --- a/tools/regression/pjdfstest/tests/truncate/01.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR truncate ${n0}/${n1}/test 123 -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/02.t b/tools/regression/pjdfstest/tests/truncate/02.t deleted file mode 100644 index 3f3590f..0000000 --- a/tools/regression/pjdfstest/tests/truncate/02.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 truncate ${nx} 123 -expect 123 stat ${nx} size -expect 0 unlink ${nx} -expect ENAMETOOLONG truncate ${nxx} 123 diff --git a/tools/regression/pjdfstest/tests/truncate/03.t b/tools/regression/pjdfstest/tests/truncate/03.t deleted file mode 100644 index 0ed60a9..0000000 --- a/tools/regression/pjdfstest/tests/truncate/03.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 truncate ${nx} 123 -expect regular,123 stat ${nx} type,size -expect 0 unlink ${nx} -expect ENAMETOOLONG truncate ${nxx} 123 - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/truncate/04.t b/tools/regression/pjdfstest/tests/truncate/04.t deleted file mode 100644 index 14f513c..0000000 --- a/tools/regression/pjdfstest/tests/truncate/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect ENOENT truncate ${n0}/${n1}/test 123 -expect ENOENT truncate ${n0}/${n1} 123 -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/05.t b/tools/regression/pjdfstest/tests/truncate/05.t deleted file mode 100644 index 9aa65c8..0000000 --- a/tools/regression/pjdfstest/tests/truncate/05.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..15" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65534 truncate ${n1}/${n2} 123 -expect 123 -u 65534 -g 65534 stat ${n1}/${n2} size -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 truncate ${n1}/${n2} 1234 -expect 0 chmod ${n1} 0755 -expect 123 -u 65534 -g 65534 stat ${n1}/${n2} size -expect 0 -u 65534 -g 65534 truncate ${n1}/${n2} 1234 -expect 1234 -u 65534 -g 65534 stat ${n1}/${n2} size -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/06.t b/tools/regression/pjdfstest/tests/truncate/06.t deleted file mode 100644 index 8e0ca5b..0000000 --- a/tools/regression/pjdfstest/tests/truncate/06.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EACCES if the named file is not writable by the user" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..8" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 create ${n1} 0644 -expect EACCES -u 65534 -g 65534 truncate ${n1} 123 -expect 0 chown ${n1} 65534 65534 -expect 0 chmod ${n1} 0444 -expect EACCES -u 65534 -g 65534 truncate ${n1} 123 -expect 0 unlink ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/07.t b/tools/regression/pjdfstest/tests/truncate/07.t deleted file mode 100644 index 60b8b90..0000000 --- a/tools/regression/pjdfstest/tests/truncate/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP truncate ${n0}/test 123 -expect ELOOP truncate ${n1}/test 123 -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/truncate/08.t b/tools/regression/pjdfstest/tests/truncate/08.t deleted file mode 100644 index 75d6679..0000000 --- a/tools/regression/pjdfstest/tests/truncate/08.t +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EPERM if the named file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..22" - ;; -FreeBSD:UFS) - echo "1..44" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM truncate ${n0} 123 -expect 0 stat ${n0} size -expect 0 chflags ${n0} none -expect 0 truncate ${n0} 123 -expect 123 stat ${n0} size -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 truncate ${n0} 123 -expect 123 stat ${n0} size -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_APPEND -todo FreeBSD:ZFS "Truncating a file protected by SF_APPEND should return EPERM." -expect EPERM truncate ${n0} 123 -todo FreeBSD:ZFS "Truncating a file protected by SF_APPEND should return EPERM." -expect 0 stat ${n0} size -expect 0 chflags ${n0} none -expect 0 truncate ${n0} 123 -expect 123 stat ${n0} size -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM truncate ${n0} 123 - expect 0 stat ${n0} size - expect 0 chflags ${n0} none - expect 0 truncate ${n0} 123 - expect 123 stat ${n0} size - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 truncate ${n0} 123 - expect 123 stat ${n0} size - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_APPEND - expect EPERM truncate ${n0} 123 - expect 0 stat ${n0} size - expect 0 chflags ${n0} none - expect 0 truncate ${n0} 123 - expect 123 stat ${n0} size - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/truncate/09.t b/tools/regression/pjdfstest/tests/truncate/09.t deleted file mode 100644 index 1d95c7f..0000000 --- a/tools/regression/pjdfstest/tests/truncate/09.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EISDIR if the named file is a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -expect EISDIR truncate ${n0} 123 -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/10.t b/tools/regression/pjdfstest/tests/truncate/10.t deleted file mode 100644 index 6fcd129..0000000 --- a/tools/regression/pjdfstest/tests/truncate/10.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..10" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -expect 0 truncate ${n0}/${n1} 123 -expect 123 stat ${n0}/${n1} size -mount -ur /dev/md${n} -expect EROFS truncate ${n0}/${n1} 1234 -expect 123 stat ${n0}/${n1} size -mount -uw /dev/md${n} -expect 0 truncate ${n0}/${n1} 1234 -expect 1234 stat ${n0}/${n1} size -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/11.t b/tools/regression/pjdfstest/tests/truncate/11.t deleted file mode 100644 index 255fd19..0000000 --- a/tools/regression/pjdfstest/tests/truncate/11.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file that is being executed" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}" = "FreeBSD" ] || quick_exit - -echo "1..2" - -n0=`namegen` - -cp -pf `which sleep` ${n0} -./${n0} 3 & -expect ETXTBSY truncate ${n0} 123 -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/12.t b/tools/regression/pjdfstest/tests/truncate/12.t deleted file mode 100644 index cf6a497..0000000 --- a/tools/regression/pjdfstest/tests/truncate/12.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EFBIG or EINVAL if the length argument was greater than the maximum file size" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 create ${n0} 0644 -r=`${fstest} truncate ${n0} 999999999999999 2>/dev/null` -case "${r}" in -EFBIG|EINVAL) - expect 0 stat ${n0} size - ;; -0) - expect 999999999999999 stat ${n0} size - ;; -*) - echo "not ok ${ntest}" - ntest=`expr ${ntest} + 1` - ;; -esac -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/13.t b/tools/regression/pjdfstest/tests/truncate/13.t deleted file mode 100644 index 9e40928..0000000 --- a/tools/regression/pjdfstest/tests/truncate/13.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EINVAL if the length argument was less than 0" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect EINVAL -- truncate ${n0} -1 -expect EINVAL -- truncate ${n0} -999999 -expect 0 unlink ${n0} diff --git a/tools/regression/pjdfstest/tests/truncate/14.t b/tools/regression/pjdfstest/tests/truncate/14.t deleted file mode 100644 index 53dca71..0000000 --- a/tools/regression/pjdfstest/tests/truncate/14.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="truncate returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT truncate NULL 123 -expect EFAULT truncate DEADCODE 123 diff --git a/tools/regression/pjdfstest/tests/unlink/00.t b/tools/regression/pjdfstest/tests/unlink/00.t deleted file mode 100644 index 9120a62..0000000 --- a/tools/regression/pjdfstest/tests/unlink/00.t +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink removes regular files, symbolic links, fifos and sockets" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..112" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -expect 0 create ${n0} 0644 -expect regular lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 symlink ${n1} ${n0} -expect symlink lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mkfifo ${n0} 0644 -expect fifo lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mknod ${n0} b 0644 1 2 -expect block lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 mknod ${n0} c 0644 1 2 -expect char lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -expect 0 bind ${n0} -expect socket lstat ${n0} type -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type - -# successful unlink(2) updates ctime. -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect 0 link ${n0} ${n1} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n0} - -# unsuccessful unlink(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 unlink ${n0} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mkfifo ${n0}/${n1} 0644 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mknod ${n0}/${n1} b 0644 1 2 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 mknod ${n0}/${n1} c 0644 1 2 -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 bind ${n0}/${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 mkdir ${n0} 0755 -expect 0 symlink test ${n0}/${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n0}/${n1} -mtime=`${fstest} stat ${n0} mtime` -test_check $time -lt $mtime -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect 0 link ${n0} ${n1} -time=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 unlink ${n1} -ctime=`${fstest} stat ${n0} ctime` -test_check $time -lt $ctime -expect 0 unlink ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/unlink/01.t b/tools/regression/pjdfstest/tests/unlink/01.t deleted file mode 100644 index 13fa0fe..0000000 --- a/tools/regression/pjdfstest/tests/unlink/01.t +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns ENOTDIR if a component of the path prefix is not a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -expect ENOTDIR unlink ${n0}/${n1}/test -expect 0 unlink ${n0}/${n1} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/02.t b/tools/regression/pjdfstest/tests/unlink/02.t deleted file mode 100644 index 1324ba3..0000000 --- a/tools/regression/pjdfstest/tests/unlink/02.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`namegen_max` -nxx="${nx}x" - -expect 0 create ${nx} 0644 -expect 0 unlink ${nx} -expect ENOENT unlink ${nx} -expect ENAMETOOLONG unlink ${nxx} diff --git a/tools/regression/pjdfstest/tests/unlink/03.t b/tools/regression/pjdfstest/tests/unlink/03.t deleted file mode 100644 index db4b4a4..0000000 --- a/tools/regression/pjdfstest/tests/unlink/03.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -nx=`dirgen_max` -nxx="${nx}x" - -mkdir -p "${nx%/*}" - -expect 0 create ${nx} 0644 -expect 0 unlink ${nx} -expect ENOENT unlink ${nx} -expect ENAMETOOLONG unlink ${nxx} - -rm -rf "${nx%%/*}" diff --git a/tools/regression/pjdfstest/tests/unlink/04.t b/tools/regression/pjdfstest/tests/unlink/04.t deleted file mode 100644 index 7885f27..0000000 --- a/tools/regression/pjdfstest/tests/unlink/04.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns ENOENT if the named file does not exist" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..4" - -n0=`namegen` -n1=`namegen` - -expect 0 create ${n0} 0644 -expect 0 unlink ${n0} -expect ENOENT unlink ${n0} -expect ENOENT unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/unlink/05.t b/tools/regression/pjdfstest/tests/unlink/05.t deleted file mode 100644 index c30c353..0000000 --- a/tools/regression/pjdfstest/tests/unlink/05.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EACCES when search permission is denied for a component of the path prefix" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/06.t b/tools/regression/pjdfstest/tests/unlink/06.t deleted file mode 100644 index 3a64aa2..0000000 --- a/tools/regression/pjdfstest/tests/unlink/06.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EACCES when write permission is denied on the directory containing the link to be removed" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..10" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n0} 0755 -cdir=`pwd` -cd ${n0} -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 chmod ${n1} 0555 -expect EACCES -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 chmod ${n1} 0755 -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} -expect 0 rmdir ${n1} -cd ${cdir} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/07.t b/tools/regression/pjdfstest/tests/unlink/07.t deleted file mode 100644 index ea9d2a3..0000000 --- a/tools/regression/pjdfstest/tests/unlink/07.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns ELOOP if too many symbolic links were encountered in translating the pathname" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..6" - -n0=`namegen` -n1=`namegen` - -expect 0 symlink ${n0} ${n1} -expect 0 symlink ${n1} ${n0} -expect ELOOP unlink ${n0}/test -expect ELOOP unlink ${n1}/test -expect 0 unlink ${n0} -expect 0 unlink ${n1} diff --git a/tools/regression/pjdfstest/tests/unlink/08.t b/tools/regression/pjdfstest/tests/unlink/08.t deleted file mode 100644 index ac81bd6..0000000 --- a/tools/regression/pjdfstest/tests/unlink/08.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink may return EPERM if the named file is a directory" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..3" - -n0=`namegen` - -expect 0 mkdir ${n0} 0755 -todo Linux "According to POSIX: EPERM - The file named by path is a directory, and either the calling process does not have appropriate privileges, or the implementation prohibits using unlink() on directories." -expect "0|EPERM" unlink ${n0} -expect "0|ENOENT" rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/09.t b/tools/regression/pjdfstest/tests/unlink/09.t deleted file mode 100644 index f3422a5..0000000 --- a/tools/regression/pjdfstest/tests/unlink/09.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EPERM if the named file has its immutable, undeletable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..15" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM unlink ${n0} -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect EPERM unlink ${n0} -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 create ${n0} 0644 -expect 0 chflags ${n0} SF_APPEND -todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM." -expect EPERM unlink ${n0} -todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM." -expect 0 chflags ${n0} none -todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM." -expect 0 unlink ${n0} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM unlink ${n0} - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect EPERM unlink ${n0} - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - - expect 0 create ${n0} 0644 - expect 0 chflags ${n0} UF_APPEND - expect EPERM unlink ${n0} - expect 0 chflags ${n0} none - expect 0 unlink ${n0} - ;; -esac diff --git a/tools/regression/pjdfstest/tests/unlink/10.t b/tools/regression/pjdfstest/tests/unlink/10.t deleted file mode 100644 index 84f3154..0000000 --- a/tools/regression/pjdfstest/tests/unlink/10.t +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EPERM if the parent directory of the named file has its immutable or append-only flag set" - -dir=`dirname $0` -. ${dir}/../misc.sh - -require chflags - -case "${os}:${fs}" in -FreeBSD:ZFS) - echo "1..16" - ;; -FreeBSD:UFS) - echo "1..30" - ;; -*) - quick_exit -esac - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 - -expect 0 create ${n0}/${n1} 0644 -expect 0 chflags ${n0} SF_IMMUTABLE -expect EPERM unlink ${n0}/${n1} -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 create ${n0}/${n1} 0644 -expect 0 chflags ${n0} SF_NOUNLINK -expect 0 unlink ${n0}/${n1} -expect 0 chflags ${n0} none - -expect 0 create ${n0}/${n1} 0644 -expect 0 chflags ${n0} SF_APPEND -todo FreeBSD:ZFS "Removing a file from a directory protected by SF_APPEND should return EPERM." -expect EPERM unlink ${n0}/${n1} -expect 0 chflags ${n0} none -todo FreeBSD:ZFS "Removing a file from a directory protected by SF_APPEND should return EPERM." -expect 0 unlink ${n0}/${n1} - -case "${os}:${fs}" in -FreeBSD:UFS) - expect 0 create ${n0}/${n1} 0644 - expect 0 chflags ${n0} UF_IMMUTABLE - expect EPERM unlink ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - - expect 0 create ${n0}/${n1} 0644 - expect 0 chflags ${n0} UF_NOUNLINK - expect 0 unlink ${n0}/${n1} - expect 0 chflags ${n0} none - - expect 0 create ${n0}/${n1} 0644 - expect 0 chflags ${n0} UF_APPEND - expect EPERM unlink ${n0}/${n1} - expect 0 chflags ${n0} none - expect 0 unlink ${n0}/${n1} - ;; -esac - -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/11.t b/tools/regression/pjdfstest/tests/unlink/11.t deleted file mode 100644 index b0d27f9..0000000 --- a/tools/regression/pjdfstest/tests/unlink/11.t +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EACCES or EPERM if the directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..270" - -n0=`namegen` -n1=`namegen` -n2=`namegen` - -expect 0 mkdir ${n2} 0755 -cdir=`pwd` -cd ${n2} - -expect 0 mkdir ${n0} 0755 -expect 0 chmod ${n0} 01777 -expect 0 chown ${n0} 65534 65534 - -for type in regular fifo block char socket symlink; do - # User owns both: the sticky directory and the file. - expect 0 chown ${n0} 65534 65534 - create_file ${type} ${n0}/${n1} 65534 65534 - expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid - expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} - expect ENOENT lstat ${n0}/${n1} type - - # User owns the sticky directory, but doesn't own the file. - for id in 0 65533; do - expect 0 chown ${n0} 65534 65534 - create_file ${type} ${n0}/${n1} ${id} ${id} - expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid - expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} - expect ENOENT lstat ${n0}/${n1} type - done - - # User owns the file, but doesn't own the sticky directory. - for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file ${type} ${n0}/${n1} 65534 65534 - expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid - expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} - expect ENOENT lstat ${n0}/${n1} type - done - - # User doesn't own the sticky directory nor the file. - for id in 0 65533; do - expect 0 chown ${n0} ${id} ${id} - create_file ${type} ${n0}/${n1} ${id} ${id} - expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid - expect "EACCES|EPERM" -u 65534 -g 65534 unlink ${n0}/${n1} - expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid - expect 0 unlink ${n0}/${n1} - done -done - -expect 0 rmdir ${n0} - -cd ${cdir} -expect 0 rmdir ${n2} diff --git a/tools/regression/pjdfstest/tests/unlink/12.t b/tools/regression/pjdfstest/tests/unlink/12.t deleted file mode 100644 index b8116d6..0000000 --- a/tools/regression/pjdfstest/tests/unlink/12.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EROFS if the named file resides on a read-only file system" - -dir=`dirname $0` -. ${dir}/../misc.sh - -[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit - -echo "1..5" - -n0=`namegen` -n1=`namegen` - -expect 0 mkdir ${n0} 0755 -n=`mdconfig -a -n -t malloc -s 1m` -newfs /dev/md${n} >/dev/null -mount /dev/md${n} ${n0} -expect 0 create ${n0}/${n1} 0644 -mount -ur /dev/md${n} -expect EROFS unlink ${n0}/${n1} -mount -uw /dev/md${n} -expect 0 unlink ${n0}/${n1} -umount /dev/md${n} -mdconfig -d -u ${n} -expect 0 rmdir ${n0} diff --git a/tools/regression/pjdfstest/tests/unlink/13.t b/tools/regression/pjdfstest/tests/unlink/13.t deleted file mode 100644 index da5e718..0000000 --- a/tools/regression/pjdfstest/tests/unlink/13.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -desc="unlink returns EFAULT if the path argument points outside the process's allocated address space" - -dir=`dirname $0` -. ${dir}/../misc.sh - -echo "1..2" - -expect EFAULT unlink NULL -expect EFAULT unlink DEADCODE |