Why ant copy task modify the ownership of the files

D

david wolf

I have a question about using ant copy task.

In Linux environment, if some files' owner are somebody else, but say
my userid is in the group owner of these files. If I copy files over
these files, the owner of these files are not changed, i.e. the owner
of these files are still somebody else.

In ant, if I use copy task to overwrite these files owned by someone
else (but I am in the group owner of the files), these files' ownership
will be change to my userid .

I am wondering why? Can somebody give me an explanation?
 
J

Juha Laiho

david wolf said:
I have a question about using ant copy task.

In Linux environment, if some files' owner are somebody else, but say
my userid is in the group owner of these files. If I copy files over
these files, the owner of these files are not changed, i.e. the owner
of these files are still somebody else.

In ant, if I use copy task to overwrite these files owned by someone
else (but I am in the group owner of the files), these files' ownership
will be change to my userid .

Looks like in the first case (where you already have a write access to
the files themselves), the files are not removed at all, but just
the contents of the files are replaced.

In the second case (ant), it looks like the files are removed and recreated.

You could confirm this with "ls -li" before and after copy in each case;
the first number is an "i-node number", which identifies a file. I would
expect the i-node number to remain unchanged in the first case, but
change in the second (ant) case.

There's one significant difference I see with these two ways in addition
to the ownership/permissions changing or not changing. In the first way
(replace file contents), it is possible to copy new versions of files
into a directory where you don't have write permission (as long as you
have write permission to the files). In the second (ant) way, I guess
you have to have write permission to the target directory, regardless of
file permissions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top