File: Broken_cp

package info (click to toggle)
yard 1.17.patch1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 600 kB
  • ctags: 74
  • sloc: perl: 1,729; sh: 250; makefile: 176; asm: 32
file content (66 lines) | stat: -rw-r--r-- 1,961 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
In GNU fileutils version 3.13, the cp command has an obscure bug that
causes problems for Yard.  When using the --parents and -R flags, cp
will copy files correctly but will report an error and screw up the
file permissions.  An illustration of the problem appears at the end
of this file.

There are several ways to work around the problem.  In order of preference:

1) Upgrade to fileutils 3.14 (released around 10 Dec 96), in which the
   problem is fixed.

2) If you have the fileutils 3.13 source code, apply a diff file
   cp-3.13-diffs, found in the extras directory of Yard.  These diffs
   should be applied in the src directory of fileutils-3.13.

3) Revert to fileutils version 3.12, which doesn't have the bug.


Thanks to Horst von Brand for finding and isolating this problem, and
to Jim Meyerling for the patch.

-Tom

=============================================================================
#####
##### A simple illustration.  First, what should happen:
#####
> mkdir /tmp/xxx; touch /tmp/xyz
> cp --parents -R /tmp/xyz /tmp/xxx
> ls -lR /tmp
total 1
drwxr-xr-x   3 fawcett  fawcett      1024 Sep  8 11:44 xxx/
-rw-r--r--   1 fawcett  fawcett         0 Sep  8 11:44 xyz

/tmp/xxx:
total 1
drwxr-xr-t   2 fawcett  fawcett      1024 Sep  8 11:44 tmp/

/tmp/xxx/tmp:
total 0
-rw-r--r--   1 fawcett  fawcett         0 Sep  8 11:44 xyz

#####  No problems.
#####

> rm -rf /tmp/x*

#####  Now do the same thing using the bad cp from 3.13:
#####
> mkdir /tmp/xxx; touch /tmp/xyz
> ./cp-3.13-unpatched --parents -R /tmp/xyz /tmp/xxx
./cp-3.13-unpatched: tmp: No such file or directory
#####  Spurious error message ^^^
> ls -lR /tmp
total 1
drwxr-xr-x   3 fawcett  fawcett      1024 Sep  8 11:45 xxx/
-rw-r--r--   1 fawcett  fawcett         0 Sep  8 11:45 xyz

/tmp/xxx:
total 1
drwx------   2 fawcett  fawcett      1024 Sep  8 11:45 tmp/
##### ^ Weird permissions
/tmp/xxx/tmp:
total 0
-rw-r--r--   1 fawcett  fawcett         0 Sep  8 11:45 xyz