This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: cp.exe bug


> -----Original Message-----
> From: cygwin-owner On Behalf Of Dave Korn
> Sent: Monday, March 15, 2004 4:50 AM
> 
> > I cut more from my makefile and just use one symbolic in 
> > place of your BIN, OBJ, and FILE as follows:
> > 
> > ####### Even More Simple Makefile Example
> > 
> > CC= gcc
> > 
> > FILE= foo
> > 
> > all: $(FILE).exe install
> > 
> > $(FILE).exe: $(FILE).o
> >  $(CC) -o $(FILE).exe $(FILE).o
> > 
> > $(FILE).o:
> >  $(CC) -c $(FILE).c -o $(FILE).o
> > 
> > install:
> >  mkdir -p ./bin/;
> >  cp $(FILE).exe ./bin/;
> > 
> > ####### End Makefile
>  
> 
>   I can't reproduce the problem here:
> 
> 

Dave,

Thanks for the response, but this makefile was my attempt at getting around
Alan's issue.  I have re-pasted his makefile below which gives the error he
saw.  I have found a different way to reproduce the error message as well.

[ ....snip.... ]
> 
> 
>   Dunno why.  cygcheck.out attached; it might be instructive 
> to compare the
> difference between mine and yours and see if it gives us any 
> ideas why you
> get the bug and I don't.
> 
> 
>     cheers, 
>       DaveK
> -- 
> Can't think of a witty .sigline today....
> 
> > ####### Simple Makefile Example
> >
> > CC= gcc
> >
> > OBJ= foo.o
> > FILE= foo.c
> > BIN= foo
> >
> > all: $(BIN) install
> >
> > $(BIN): $(OBJ)
> >  $(CC) -o $(BIN) $(OBJ)
> >
> > $(OBJ):
> >  $(CC) -c $(FILE) -o $(OBJ)
> >
> > install:
> >  mkdir -p ./bin/;
> >  cp $(BIN) ./bin/;
> >
> > ####### End Makefile>

Above is the makefile which produced the error.  The cause seems to be cp's
handling of a .exe file.  A simple way to get what I now see as a misleading
error message from cp is:

$ touch foo.exe
$ cp foo bar    # note the absence of the .exe extension
cp: `foo' and `bar' are the same file

Alan's issue arose from the fact that his makefile used a symbol for the
resulting executable and gcc naturally appends the .exe in the cygwin
environment.  When he tries to use the symbol in his cp command, the .exe is
not there and cp gives the 'same file' error message.  I did some googling
and found this issue has been mentioned in several threads.  From what I can
gather, at least one iteration of fileutils would allow making a copy of a
.exe file without using the extension, as long as another file with the same
basename and no .exe extension did not exist.

It looks like there was some code in fileutils 4.1-1 to handle .exe copies
like this, but the code was removed from the released cp in fileutils 4.1-2.

http://www.cygwin.com/ml/cygwin-announce/2001/msg00081.html 

http://www.cygwin.com/ml/cygwin/2003-04/msg00017.html




--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]