#2044 cp incorrectly determines a hardlink

MSYS
assigned
Cesar Strauss
None
Bug
none
Unknown
False
2013-12-10
2013-09-14
Earnie Boyd
No

I've seen far too many times that cp will incorrectly diagnose that a file is a hard link and refuse to copy it. Reissuing the same command will copy the files that were incorrectly assumed to be a hard link.

Example
make dist-mingwrt
...

cp -af ../../../src/mingw-org-wsl/4.0-dev dist/mingwrt/mingwrt-4.0-1-mingw32-src

cp: will not create hard link `./dist/mingwrt/installed/mingw_org_wsl/src/libcrt
/misc' to directory `./dist/mingwrt/installed/mingw_org_wsl/.git/objects/0d'
cp: will not create hard link `./dist/mingwrt/installed/mingw_org_wsl/src/libcrt
/posix/unistd' to directory `./dist/mingwrt/installed/mingw_org_wsl/.git/objects
/0e'
cp: will not create hard link `./dist/mingwrt/installed/mingw_org_wsl/src/libgdi
plus' to directory `./dist/mingwrt/installed/mingw_org_wsl/.git/objects/17'
cp: will not create hard link `./dist/mingwrt/installed/mingw_org_wsl/src/libshe
ll32' to directory `./dist/mingwrt/installed/mingw_org_wsl/.git/objects/18'
cp: will not create hard link `./dist/mingwrt/installed/mingw_org_wsl/tests/coli
npeters/windres' to directory `./dist/mingwrt/installed/mingw_org_wsl/.git/objec
ts/25'
make[1]: *** [dist-mingwrt-src] Error 1
make[1]: Leaving directory `/usr/src/build/mingw.org-wsl/4.0-dev'
make: *** [dist-mingwrt] Error 2

make dist-mingwrt
...

cp -af ../../../src/mingw-org-wsl/4.0-dev ./dist/mingwrt/installed/mingw_org_wsl

cd ./dist/mingwrt/installed/mingw_org_wsl ; \
        rm -rf .git autom4te.cache ; \
        rm -f config.log config.status config.cache config.h ; \
        rm -f .gitignore core a.out Makefile ; \
        find . -type f -name \*~ -delete ; \
        find . -type f -name \*.log -delete ; \
        find . -type f -name \*.bak -delete ; \
        find . -type f -name .\*.swp -delete ; \
        cd .. ; \
        rm -rf mingwrt-4.0-1-mingw32-src ; \
        mv mingw_org_wsl mingwrt-4.0-1-mingw32-src ; \
        tar acf ../packages/mingwrt-4.0-1-mingw32-src.tar.lzma mingwrt-4.0-1-min
gw32-src
make[1]: Leaving directory `/usr/src/build/mingw.org-wsl/4.0-dev'

Discussion