This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Handling unix file attributes on Windows with cygwin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Handling unix file attributes on Windows with cygwin" Watch "Handling unix file attributes on Windows with cygwin" New topic

Handling unix file attributes on Windows with cygwin

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9056
1) ClearCase repository is on a Windows 2003 server, but has unix line endings. The drive (and files) are read-only, so I have to copy the files in order to do the build.
2) Using xcopy - changes the permissions from r--r--r-- to rwx--------- and puts ^M at the end of every line which causes the *.sh files to not run.
3) Using cygwin cp - maintains the lack of ^Ms but leaves the copied files as r--r--r-- (I run run chmod 777 ./* after the cp copy)

I would like to use ant for the copy. I'm guessing that it would behave more like xcopy since it would be running on windows.
1) Maybe use the FixCRLF afterwards... Would this work on windows/cygwin?
2) Maybe use the Chmod task afterwards ... Would this work on windows/cygwin?

Does anyone here have any experience with similar issues?

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32301

I haven't done this particular thing, but I still have some thoughts .

1) FixCRLF should definitely work - that's what it's designed to do. You get to specify what format you want the result to be in, which renders the underlying operating system irrelevant.
2) Chmod is more interesting. The task calls the underlying chmod command which Windows doesn't have as such while Cygwin does. I think the best thing to do would be to try it and see what happens.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Malathi Krishnan

Joined: Apr 18, 2007
Posts: 2
You could try removing ^M's within the vi editor like this -


[^ = control key + v]
[ December 26, 2007: Message edited by: Malathi Krishnan ]
I agree. Here's the link:
subject: Handling unix file attributes on Windows with cygwin
It's not a secret anymore!