Aittvax.147
net.4bsd-bugs,net.v7-bugs
utzoo!decvax!ittvax!swatt
Wed Nov 25 19:37:27 1981
cp(1) bug
Wed Nov 25 19:15:37 EST 1981 (reported by swatt)
[ ] "cp" when faced with a source argument which is a
directory copies the data of the directory file into
a plain file in the destination area. This is
obnoxious; either it should allow recursive copying
of directory trees or it should ignore directory
source arguments. Fix is:
________________________________________________________
cp /usr/src/cmd/cp.c /tmp/upd.$$.tmp ; chmod +w /tmp/upd.$$.tmp
ed - /tmp/upd.$$.tmp <<\!XXFUNNYXX MORE COPY -R ((MODE&S_IFMT)="=" STATIC * , . DIRECTORY SKIP /* ; A SET Q !XXFUNNYXX W FROM); CHAR OF FLAG { } (STDERR, 71A 1C PROBABLY BE S_IFDIR) /TMP/UPD.$$.TMP RETURN; CONTENTS FPRINTF DIRECTORY? /USR/SRC/CMD/CP.C TO WOULD SO, ACTION IT. (FOLD); CLOSE */ DIFF %S IS A DIRECTORY (IGNORED)\N IF IS *SCCSID="@(#)cp.c 4.2 (ITT) 11/19/81" SOURCE REASONABLE>/tmp/upd.$$.dif
if cmp - /tmp/upd.$$.dif <<\!XXFUNNYXX STATIC ; < CHAR 1C1 --- *SCCSID="@(#)cp.c 4.1 (Berkeley) 10/1/80"> static char *sccsid = "@(#)cp.c 4.2 (ITT) 11/19/81";
71a72,80
> /* Is source a directory? if so, skip it.
> * Probably more reasonable action would be to
> * copy contents of directory if -r flag set
> */
> if ((mode&S_IFMT) == S_IFDIR) {
> close (fold);
> fprintf (stderr, "%s is a directory (ignored)\n", from);
> return;
> }
!xxFUNNYxx
then
: 'compare equal, ok'
rm -f cp.c
cp /tmp/upd.$$.tmp cp.c ; chmod a-w cp.c
else
echo "Old source file not same version;" \
"use diff listings by hand"
fi
rm -f /tmp/upd.$$.tmp /tmp/upd.$$.dif
________________________________________________________
[ /bin/cp:
cp.c 4.1 (Berkeley) 10/1/80 ]
-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <
[email protected]>
of
http://communication.ucsd.edu/A-News/
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:
The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.