ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28320] - copy task preserving permissions
Date Fri, 09 Apr 2004 20:59:28 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28320>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28320

copy task preserving permissions





------- Additional Comments From alexeys@inventigo.com  2004-04-09 20:59 -------
I had a similar problem. Somebody recommended to use Perl to copy permissions and it worked
fine. This is a script that I am using to copy executable permission:

my ($src, $dst)=@ARGV;
#print "cpmod '$src' '$dst'\n";

my $srclen=length $src;

find (
  {
    no_chdir=>1,
    wanted=>sub {
      return if -d;
      my $destfile= $dst.substr $_, $srclen;
      if (-x and -f $destfile and not -x $destfile) {
        my $mode=(stat $destfile)[2];
        my $newmode=$mode | 0111; # +x
        if ($mode != $newmode) {
          #print "chmod +x [".sprintf("%lo", $mode)." -> ".sprintf("%lo", $newmode)."]
'$destfile'\n";
          chmod $newmode, $destfile
        }
      }
    }
  },
  $src
);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message