summaryrefslogtreecommitdiff
path: root/src/split.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-03-28 09:14:31 +0200
committerJim Meyering <meyering@redhat.com>2011-04-02 16:14:47 +0200
commit45b332f7ab74c766d227a75dd2d48705c3eb176b (patch)
tree40525fe15b4f5b5f9ba723e862eb1cddce1871fe /src/split.c
parente08b3e7c08eb09ca59e1d20fe1ee217699e16edb (diff)
downloadcoreutils-45b332f7ab74c766d227a75dd2d48705c3eb176b.tar.xz
cp: always detect copy-into-self: avoid infloop w/large PATH_MAX
When running the erroneous command, cp -rl A D D, and depending on the structure of directories A and D and the file system type (because that changes order of dir. entry traversal), cp would sometimes fail to detect that D was being copied into D, and would create D/D/D/D/D/... until it hit PATH_MAX or exhausted some resource. I noticed this via the occasional failure of the cp/into-self test when run using a ZFS file system. It is occasional because the bug is dependent on the order in which directory entries are traversed, and that is apparently indeterminate with ZFS. Technically, with the current recursive implementation, there is no risk of an infinite loop, due to stack limitations, but with an eventual fts-based implementation, it might have iterated until disk space or inodes are exhausted. * src/copy.c (copy_dir): Avoid copy-into-self interminable loop on systems with large PATH_MAX. On other systems, diagnose the copy-into- self error consistently. Handle the parameter, first_dir_created_per_command_line_arg, correctly when there are two or more sub-directories.
Diffstat (limited to 'src/split.c')
0 files changed, 0 insertions, 0 deletions