BUG: Severe or critical - deletes existing files and leaves nothing. (cp)

Linda Walsh , <cygwin@tlinx.org> coreutils@tlinx.org
Mon Jan 9 21:20:00 GMT 2012



I was trying to copy a font dir from a unix to a windows machine.

Problem is there are duplicates -- where only the case differs...

On unix, I've run a 'dedup' in my font dir, that joined any files that were the
same so they are hard links to each other. (made sense at the time... ;-) ).

windows treats different cased file names as the same.

Along comes cp, on cygwin, .. but I don't think this is a cygwin bug, as
it's doing what it is supposed to do.. it is cp  that is problematic.

Note, in the below, I an alias for cp is in effect:

alias cp='cp --preserve=mode,timestamps'

i.e. by default, I try to preserve 'simple'-permissions, and timestamps.


First I tried:

/usr/share/fonts> cp -avu //bliss/usr_share/fonts/. .


Got:

removed `././Adobe (afm) fonts/Symbol.afm'
cp: cannot create hard link `././Adobe (afm) fonts/Symbol.afm' to `././Adobe 
(afm) fonts/symbol.afm': No such file or directory
removed `././Adobe (afm) fonts/cmr10.afm'
cp: cannot create hard link `././Adobe (afm) fonts/cmr10.afm' to `././Adobe 
(afm) fonts/CMR10.afm': No such file or directory
removed `././Adobe (afm) fonts/cmex10.afm'
(and many more... )

It removes an existing file 'Symbol', because because it sees that 'Symbol' is not
a hard link to 'symbol'; I specified "-a" to make an exact copy, so it's trying 
to copy links.

But by removing 'Symbol', it removes 'symbol' and THEN can't link to it...
thus 'symbol' is gone from the local dir.
---
ok, at this point, I would consider it 'my bad, for using cp on windows (it used 
to work without these issues, not sure what has changed)...


Then I tried the less strict:

> cp -rvu /usr/share/fonts> cp -rvu //bliss/usr_share/fonts/. .

figuring without the "-a" it wouldn't try to force linking, thus no prob... ... 
well...
removed `././OTF/AJensonPro-Bold.otf'
cp: cannot create hard link `././OTF/AJensonPro-Bold.otf' to 
`././OTF/ajensonpro-bold.otf': No such file or directory
removed `././OTF/AJensonPro-BoldCapt.otf'
cp: cannot create hard link `././OTF/AJensonPro-BoldCapt.otf' to 
`././OTF/ajensonpro-boldcapt.otf': No such file or directory
removed `././OTF/AJensonPro-BoldDisp.otf'
------
?!!?!   Why is it trying to create hard links again?  I didn't specify preserve 
links!?!
(i.e. this is a cp BUG...)


Well if I could just get it to copy them and not try to link them... so it 
copies them twice..
at least they get here...

so I try the only thing that might not remove files "n":

  cp -nrvu //bliss/usr_share/fonts/. .

and...

removed `././Adobe (afm) fonts/cmbx5.afm'
cp: cannot create hard link `././Adobe (afm) fonts/cmbx5.afm' to `././Adobe 
(afm) fonts/CMBX5.afm': No such file or directory
removed `././Adobe (afm) fonts/cmbx7.afm'
cp: cannot create hard link `././Adobe (afm) fonts/cmbx7.afm' to `././Adobe 
(afm) fonts/CMBX7.afm': No such file or directory
removed `././Adobe (afm) fonts/cmmi10.afm'

... *sigh*...
my poor cumberland fonts... so sad!
um.... hey, if it shouldn't have removed them on -rvu, it doubly shouldn't have 
done so on
when I told it "-n" (--no-clobber) don't clobber existing files...



DOUBLE BUG!....

  cygcheck -f /bin/cp
coreutils-8.14-1





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list