diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-15 22:05:07 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-15 22:05:07 +0100 |
| commit | a40f0624db4c9490d46f116c4c4635dfa68e070c (patch) | |
| tree | 6495c54fab2be22802c6befc9d5c8ea01807a60c | |
| parent | 662078f9fd41efe422d7abc0aea1395c27c61ddd (diff) | |
| download | busybox-w32-a40f0624db4c9490d46f116c4c4635dfa68e070c.tar.gz busybox-w32-a40f0624db4c9490d46f116c4c4635dfa68e070c.tar.bz2 busybox-w32-a40f0624db4c9490d46f116c4c4635dfa68e070c.zip | |
cp: fix -H handling
function old new delta
copy_file 1495 1518 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | coreutils/cp.c | 16 | ||||
| -rw-r--r-- | coreutils/install.c | 2 | ||||
| -rw-r--r-- | include/libbb.h | 23 | ||||
| -rw-r--r-- | libbb/copy_file.c | 4 | ||||
| -rwxr-xr-x | testsuite/cp.tests | 206 |
5 files changed, 227 insertions, 24 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 9f6c12367..d7c8d91cc 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
| @@ -35,10 +35,9 @@ int cp_main(int argc, char **argv) | |||
| 35 | OPT_a = 1 << (sizeof(FILEUTILS_CP_OPTSTR)-1), | 35 | OPT_a = 1 << (sizeof(FILEUTILS_CP_OPTSTR)-1), |
| 36 | OPT_r = 1 << (sizeof(FILEUTILS_CP_OPTSTR)), | 36 | OPT_r = 1 << (sizeof(FILEUTILS_CP_OPTSTR)), |
| 37 | OPT_P = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+1), | 37 | OPT_P = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+1), |
| 38 | OPT_H = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+2), | 38 | OPT_v = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+2), |
| 39 | OPT_v = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+3), | ||
| 40 | #if ENABLE_FEATURE_CP_LONG_OPTIONS | 39 | #if ENABLE_FEATURE_CP_LONG_OPTIONS |
| 41 | OPT_parents = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+4), | 40 | OPT_parents = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+3), |
| 42 | #endif | 41 | #endif |
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| @@ -48,7 +47,7 @@ int cp_main(int argc, char **argv) | |||
| 48 | // -r and -R are the same | 47 | // -r and -R are the same |
| 49 | // -R (and therefore -r) turns on -d (coreutils does this) | 48 | // -R (and therefore -r) turns on -d (coreutils does this) |
| 50 | // -a = -pdR | 49 | // -a = -pdR |
| 51 | opt_complementary = "-2:l--s:s--l:Pd:rRd:Rd:apdR:HL"; | 50 | opt_complementary = "-2:l--s:s--l:Pd:rRd:Rd:apdR"; |
| 52 | #if ENABLE_FEATURE_CP_LONG_OPTIONS | 51 | #if ENABLE_FEATURE_CP_LONG_OPTIONS |
| 53 | applet_long_options = | 52 | applet_long_options = |
| 54 | "archive\0" No_argument "a" | 53 | "archive\0" No_argument "a" |
| @@ -64,7 +63,7 @@ int cp_main(int argc, char **argv) | |||
| 64 | ; | 63 | ; |
| 65 | #endif | 64 | #endif |
| 66 | // -v (--verbose) is ignored | 65 | // -v (--verbose) is ignored |
| 67 | flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPHv"); | 66 | flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPv"); |
| 68 | /* Options of cp from GNU coreutils 6.10: | 67 | /* Options of cp from GNU coreutils 6.10: |
| 69 | * -a, --archive | 68 | * -a, --archive |
| 70 | * -f, --force | 69 | * -f, --force |
| @@ -113,17 +112,14 @@ int cp_main(int argc, char **argv) | |||
| 113 | */ | 112 | */ |
| 114 | argc -= optind; | 113 | argc -= optind; |
| 115 | argv += optind; | 114 | argv += optind; |
| 116 | flags ^= FILEUTILS_DEREFERENCE; /* the sense of this flag was reversed */ | 115 | /* Reverse this bit. If there is -d, bit is not set: */ |
| 116 | flags ^= FILEUTILS_DEREFERENCE; | ||
| 117 | /* coreutils 6.9 compat: | 117 | /* coreutils 6.9 compat: |
| 118 | * by default, "cp" derefs symlinks (creates regular dest files), | 118 | * by default, "cp" derefs symlinks (creates regular dest files), |
| 119 | * but "cp -R" does not. We switch off deref if -r or -R (see above). | 119 | * but "cp -R" does not. We switch off deref if -r or -R (see above). |
| 120 | * However, "cp -RL" must still deref symlinks: */ | 120 | * However, "cp -RL" must still deref symlinks: */ |
| 121 | if (flags & FILEUTILS_DEREF_SOFTLINK) /* -L */ | 121 | if (flags & FILEUTILS_DEREF_SOFTLINK) /* -L */ |
| 122 | flags |= FILEUTILS_DEREFERENCE; | 122 | flags |= FILEUTILS_DEREFERENCE; |
| 123 | /* The behavior of -H is *almost* like -L, but not quite, so let's | ||
| 124 | * just ignore it too for fun. TODO. | ||
| 125 | if (flags & OPT_H) ... // deref command-line params only | ||
| 126 | */ | ||
| 127 | 123 | ||
| 128 | #if ENABLE_SELINUX | 124 | #if ENABLE_SELINUX |
| 129 | if (flags & FILEUTILS_PRESERVE_SECURITY_CONTEXT) { | 125 | if (flags & FILEUTILS_PRESERVE_SECURITY_CONTEXT) { |
diff --git a/coreutils/install.c b/coreutils/install.c index 2e604bec7..e9682990d 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
| @@ -101,7 +101,7 @@ int install_main(int argc, char **argv) | |||
| 101 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | 101 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS |
| 102 | applet_long_options = install_longopts; | 102 | applet_long_options = install_longopts; |
| 103 | #endif | 103 | #endif |
| 104 | opt_complementary = "s--d:d--s" IF_SELINUX(":Z--\xff:\xff--Z"); | 104 | opt_complementary = "s--d:d--s" IF_FEATURE_INSTALL_LONG_OPTIONS(IF_SELINUX(":Z--\xff:\xff--Z")); |
| 105 | /* -c exists for backwards compatibility, it's needed */ | 105 | /* -c exists for backwards compatibility, it's needed */ |
| 106 | /* -v is ignored ("print name of each created directory") */ | 106 | /* -v is ignored ("print name of each created directory") */ |
| 107 | /* -b is ignored ("make a backup of each existing destination file") */ | 107 | /* -b is ignored ("make a backup of each existing destination file") */ |
diff --git a/include/libbb.h b/include/libbb.h index 11596346d..9e6ee8434 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -262,20 +262,21 @@ extern char *strrstr(const char *haystack, const char *needle) FAST_FUNC; | |||
| 262 | extern const char *bb_mode_string(mode_t mode) FAST_FUNC; | 262 | extern const char *bb_mode_string(mode_t mode) FAST_FUNC; |
| 263 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf) FAST_FUNC; | 263 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf) FAST_FUNC; |
| 264 | enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ | 264 | enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ |
| 265 | FILEUTILS_PRESERVE_STATUS = 1, | 265 | FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */ |
| 266 | FILEUTILS_DEREFERENCE = 2, | 266 | FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */ |
| 267 | FILEUTILS_RECUR = 4, | 267 | FILEUTILS_RECUR = 1 << 2, /* -R */ |
| 268 | FILEUTILS_FORCE = 8, | 268 | FILEUTILS_FORCE = 1 << 3, /* -f */ |
| 269 | FILEUTILS_INTERACTIVE = 0x10, | 269 | FILEUTILS_INTERACTIVE = 1 << 4, /* -i */ |
| 270 | FILEUTILS_MAKE_HARDLINK = 0x20, | 270 | FILEUTILS_MAKE_HARDLINK = 1 << 5, /* -l */ |
| 271 | FILEUTILS_MAKE_SOFTLINK = 0x40, | 271 | FILEUTILS_MAKE_SOFTLINK = 1 << 6, /* -s */ |
| 272 | FILEUTILS_DEREF_SOFTLINK = 0x80, | 272 | FILEUTILS_DEREF_SOFTLINK = 1 << 7, /* -L */ |
| 273 | FILEUTILS_DEREFERENCE_L0 = 1 << 8, /* -H */ | ||
| 273 | #if ENABLE_SELINUX | 274 | #if ENABLE_SELINUX |
| 274 | FILEUTILS_PRESERVE_SECURITY_CONTEXT = 0x100, | 275 | FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ |
| 275 | FILEUTILS_SET_SECURITY_CONTEXT = 0x200 | 276 | FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10, |
| 276 | #endif | 277 | #endif |
| 277 | }; | 278 | }; |
| 278 | #define FILEUTILS_CP_OPTSTR "pdRfilsL" IF_SELINUX("c") | 279 | #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") |
| 279 | extern int remove_file(const char *path, int flags) FAST_FUNC; | 280 | extern int remove_file(const char *path, int flags) FAST_FUNC; |
| 280 | /* NB: without FILEUTILS_RECUR in flags, it will basically "cat" | 281 | /* NB: without FILEUTILS_RECUR in flags, it will basically "cat" |
| 281 | * the source, not copy (unless "source" is a directory). | 282 | * the source, not copy (unless "source" is a directory). |
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 893b52ed5..6c64fab16 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
| @@ -83,7 +83,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags) | |||
| 83 | signed char ovr; | 83 | signed char ovr; |
| 84 | 84 | ||
| 85 | /* Inverse of cp -d ("cp without -d") */ | 85 | /* Inverse of cp -d ("cp without -d") */ |
| 86 | #define FLAGS_DEREF (flags & FILEUTILS_DEREFERENCE) | 86 | #define FLAGS_DEREF (flags & (FILEUTILS_DEREFERENCE + FILEUTILS_DEREFERENCE_L0)) |
| 87 | 87 | ||
| 88 | if ((FLAGS_DEREF ? stat : lstat)(source, &source_stat) < 0) { | 88 | if ((FLAGS_DEREF ? stat : lstat)(source, &source_stat) < 0) { |
| 89 | /* This may be a dangling symlink. | 89 | /* This may be a dangling symlink. |
| @@ -194,7 +194,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags) | |||
| 194 | if (new_source == NULL) | 194 | if (new_source == NULL) |
| 195 | continue; | 195 | continue; |
| 196 | new_dest = concat_path_file(dest, d->d_name); | 196 | new_dest = concat_path_file(dest, d->d_name); |
| 197 | if (copy_file(new_source, new_dest, flags) < 0) | 197 | if (copy_file(new_source, new_dest, flags & ~FILEUTILS_DEREFERENCE_L0) < 0) |
| 198 | retval = -1; | 198 | retval = -1; |
| 199 | free(new_source); | 199 | free(new_source); |
| 200 | free(new_dest); | 200 | free(new_dest); |
diff --git a/testsuite/cp.tests b/testsuite/cp.tests new file mode 100755 index 000000000..75a7dcb48 --- /dev/null +++ b/testsuite/cp.tests | |||
| @@ -0,0 +1,206 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Copyright 2010 by Denys Vlasenko | ||
| 3 | # Licensed under GPL v2, see file LICENSE for details. | ||
| 4 | |||
| 5 | . ./testing.sh | ||
| 6 | |||
| 7 | # Opening quote in "omitting directory 'dir'" message: | ||
| 8 | sq='`' # GNU cp: ` | ||
| 9 | sq="'" # bbox cp: ' | ||
| 10 | |||
| 11 | rm -rf cp.testdir >/dev/null | ||
| 12 | |||
| 13 | mkdir cp.testdir | ||
| 14 | mkdir cp.testdir/dir | ||
| 15 | > cp.testdir/dir/file | ||
| 16 | ln -s file cp.testdir/dir/file_symlink | ||
| 17 | |||
| 18 | > cp.testdir/file | ||
| 19 | ln -s file cp.testdir/file_symlink | ||
| 20 | ln -s dir cp.testdir/dir_symlink | ||
| 21 | |||
| 22 | |||
| 23 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
| 24 | |||
| 25 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 26 | testing "cp" '\ | ||
| 27 | cd cp.testdir || exit 1; cp * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 28 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 29 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 30 | test ! -e cp.testdir2/dir || echo BAD: dir | ||
| 31 | test ! -e cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 32 | ' "\ | ||
| 33 | cp: omitting directory ${sq}dir' | ||
| 34 | cp: omitting directory ${sq}dir_symlink' | ||
| 35 | 1 | ||
| 36 | " "" "" | ||
| 37 | |||
| 38 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 39 | testing "cp -d" '\ | ||
| 40 | cd cp.testdir || exit 1; cp -d * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 41 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 42 | test -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 43 | test ! -e cp.testdir2/dir || echo BAD: dir | ||
| 44 | test -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 45 | ' "\ | ||
| 46 | cp: omitting directory ${sq}dir' | ||
| 47 | 1 | ||
| 48 | " "" "" | ||
| 49 | |||
| 50 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 51 | testing "cp -P" '\ | ||
| 52 | cd cp.testdir || exit 1; cp -P * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 53 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 54 | test -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 55 | test ! -e cp.testdir2/dir || echo BAD: dir | ||
| 56 | test -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 57 | ' "\ | ||
| 58 | cp: omitting directory ${sq}dir' | ||
| 59 | 1 | ||
| 60 | " "" "" | ||
| 61 | |||
| 62 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 63 | testing "cp -L" '\ | ||
| 64 | cd cp.testdir || exit 1; cp -L * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 65 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 66 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 67 | test ! -e cp.testdir2/dir || echo BAD: dir | ||
| 68 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 69 | ' "\ | ||
| 70 | cp: omitting directory ${sq}dir' | ||
| 71 | cp: omitting directory ${sq}dir_symlink' | ||
| 72 | 1 | ||
| 73 | " "" "" | ||
| 74 | |||
| 75 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 76 | testing "cp -H" '\ | ||
| 77 | cd cp.testdir || exit 1; cp -H * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 78 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 79 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 80 | test ! -e cp.testdir2/dir || echo BAD: dir | ||
| 81 | test ! -e cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 82 | ' "\ | ||
| 83 | cp: omitting directory ${sq}dir' | ||
| 84 | cp: omitting directory ${sq}dir_symlink' | ||
| 85 | 1 | ||
| 86 | " "" "" | ||
| 87 | |||
| 88 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 89 | testing "cp -R" '\ | ||
| 90 | cd cp.testdir || exit 1; cp -R * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 91 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 92 | test -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 93 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 94 | test -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 95 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 96 | test -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 97 | ' "\ | ||
| 98 | 0 | ||
| 99 | " "" "" | ||
| 100 | |||
| 101 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 102 | testing "cp -Rd" '\ | ||
| 103 | cd cp.testdir || exit 1; cp -Rd * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 104 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 105 | test -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 106 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 107 | test -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 108 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 109 | test -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 110 | ' "\ | ||
| 111 | 0 | ||
| 112 | " "" "" | ||
| 113 | |||
| 114 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 115 | testing "cp -RP" '\ | ||
| 116 | cd cp.testdir || exit 1; cp -RP * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 117 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 118 | test -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 119 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 120 | test -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 121 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 122 | test -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 123 | ' "\ | ||
| 124 | 0 | ||
| 125 | " "" "" | ||
| 126 | |||
| 127 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 128 | testing "cp -RL" '\ | ||
| 129 | cd cp.testdir || exit 1; cp -RL * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 130 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 131 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 132 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 133 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 134 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 135 | test ! -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 136 | ' "\ | ||
| 137 | 0 | ||
| 138 | " "" "" | ||
| 139 | |||
| 140 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 141 | # GNU coreutils 7.2 says: | ||
| 142 | # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir' | ||
| 143 | test x"$SKIP_KNOWN_BUGS" = x"" && \ | ||
| 144 | testing "cp -RH" '\ | ||
| 145 | cd cp.testdir || exit 1; cp -RH * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 146 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 147 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 148 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 149 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 150 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 151 | test -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 152 | ' "\ | ||
| 153 | 0 | ||
| 154 | " "" "" | ||
| 155 | |||
| 156 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 157 | # GNU coreutils 7.2 says: | ||
| 158 | # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir' | ||
| 159 | test x"$SKIP_KNOWN_BUGS" = x"" && \ | ||
| 160 | testing "cp -RHP" '\ | ||
| 161 | cd cp.testdir || exit 1; cp -RHP * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 162 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 163 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 164 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 165 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 166 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 167 | test -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 168 | ' "\ | ||
| 169 | 0 | ||
| 170 | " "" "" | ||
| 171 | |||
| 172 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 173 | testing "cp -RHL" '\ | ||
| 174 | cd cp.testdir || exit 1; cp -RHL * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 175 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 176 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 177 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 178 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 179 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 180 | test ! -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 181 | ' "\ | ||
| 182 | 0 | ||
| 183 | " "" "" | ||
| 184 | |||
| 185 | rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1 | ||
| 186 | # Wow! "cp -RLH" is not the same as "cp -RHL" (prev test)! | ||
| 187 | # GNU coreutils 7.2 says: | ||
| 188 | # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir' | ||
| 189 | test x"$SKIP_KNOWN_BUGS" = x"" && \ | ||
| 190 | testing "cp -RLH" '\ | ||
| 191 | cd cp.testdir || exit 1; cp -RLH * ../cp.testdir2 2>&1; echo $?; cd .. || exit 1 | ||
| 192 | test ! -L cp.testdir2/file || echo BAD: file | ||
| 193 | test ! -L cp.testdir2/file_symlink || echo BAD: file_symlink | ||
| 194 | test ! -L cp.testdir2/dir || echo BAD: dir | ||
| 195 | test ! -L cp.testdir2/dir_symlink || echo BAD: dir_symlink | ||
| 196 | test ! -L cp.testdir2/dir/file || echo BAD: dir/file | ||
| 197 | test ! -L cp.testdir2/dir/file_symlink || echo BAD: dir/file_symlink | ||
| 198 | ' "\ | ||
| 199 | 0 | ||
| 200 | " "" "" | ||
| 201 | |||
| 202 | |||
| 203 | # Clean up | ||
| 204 | rm -rf cp.testdir cp.testdir2 2>/dev/null | ||
| 205 | |||
| 206 | exit $FAILCOUNT | ||
