bug in "ar" when creating libraries on cross linked filesystems

Igor Pechtchanski pechtcha@cs.nyu.edu
Fri Sep 5 13:53:00 GMT 2003

On Thu, 4 Sep 2003 you wrote:

> Hello,
> the command
>     ar cq libdh.a a.o b.o
> does not work, if the current directory is on a linked filesystem.
> In my case "." referes to /cygdrive/h".
> The error message of "ar" is:
>   ar: libdh.a: rename: Cross-device link
>   make: *** [libdh.a] Error 1
> The program works, when using local files, e.g. /usr/src
> # uname -a
> CYGWIN_NT-5.1 PCHEMPEL2 1.5.3(0.90/3/2) 2003-09-01 13:15 i686 unknown unknown Cygwin
> Best regards
> Daniel

On a hunch, try running "TMPDIR=. ar cq libdh.a a.o b.o".  I'm guessing
that ar builds the archive in TMPDIR (/tmp?) and then tries moving it to
your directory.  However, it calls "rename()", which tries to hard link
the file and then unlink it later (a guess from looking at "strings
/bin/ar.exe" -- I haven't looked at the code).  If you do this across
devices, there's obviously a problem.  I'm surprised, though, that this
works on Linux, since /tmp and /home/* usually *are* on different
devices...  Perhaps some configury option?  Or is Linux "rename()" simply
more robust?
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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

More information about the Cygwin mailing list