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: copying "file.exe" + "file" (a shell script) => targetdir fails


On 5/13/2017 1:22 AM, L A Walsh wrote:
> I know *why* this is happening (cygwin treating x.exe as x), but
> should it do it for shell files too?
> 
> sourcedir:
>>  ll -di bin/updatedb bin/updatedb.exe
> 337488497076088359 -rwxrwxr-x+ 1  10163 Apr 12 17:07 bin/updatedb*
> 144115188075956844 -rwxrwxr-x+ 2 287813 Apr 15  2014 bin/updatedb.exe*
> (two different files, different types:)
>>  file bin/updatedb{,.exe}
> bin/updatedb:     Bourne-Again shell script, ASCII text executable
> bin/updatedb.exe: PE32+ executable (console) x86-64, for MS Windows
> 
> 
>>  cp -l bin/updatedb /nbin/
> cp: cannot create hard link '/nbin/updatedb' to 'bin/updatedb': File exists
> 
> cp thinks /nbin/updatedb is the same as /nbin/updatedb.exe (and prevents
> copying a real 'updatedb' script into the same place:
> 
> (target):
>>  ll -i /nbin/updatedb.exe /nbin/updatedb
> 144115188075956844 -rwxrwxr-x+ 2 287813 Apr 15  2014 /nbin/updatedb*
> 144115188075956844 -rwxrwxr-x+ 2 287813 Apr 15  2014 /nbin/updatedb.exe*
> 
> But I can create a dir named /nbin/updatedb:
> 
>>  mkdir /nbin/updatedb
> 
> And now have 2 different inodes in target:
> 
>>  ll -di bin/updatedb bin/updatedb.exe
> 337488497076088359 -rwxrwxr-x+ 1  10163 Apr 12 17:07 bin/updatedb*
> 144115188075956844 -rwxrwxr-x+ 2 287813 Apr 15  2014 bin/updatedb.exe*
> 
> ------------
> 
> Is this suppose to work this way?
> 

As far as I remember it always has.

> (I know how to work around this (used move in cmd.exe),

Well, there is a different method to work around this:
cp -l bin/updatedb. /nbin/

Note the period after the filename; this stops the pseudo symlink from
using updatedb.exe because bin/updatedb..exe doesn't exist.

> but why can I create a dir but not a file there?
> 

You weren't creating a file there, you were copying a file the file
source is getting confused and not the destination.

> A bit strange -- guess it isn't often I have both a "file"
> and "file.exe" in a dir.
> 

You probably can find something about this via google.  Yours isn't the
first report.

-- 
cyg Simple

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


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