Hi,

How does one replicate the protection after copying files? I used this code:

        my $mode = ( stat $abs_file )[2] & 07777;
        -f $dest_name and 1 while unlink $dest_name;
        my $ok = File::Copy::syscopy( $abs_file, $dest_name );
        $ok and $ok &&= chmod $mode, $dest_name;
        $ok or carp "copy '$file' ($dest_path): $!\n";

But it doesn't seem to replicate the full protection:
    $ type prot.pl
    #! perl -w
    use strict;
    my @files = map qq/user1:[abeltje.$_]perly.h/ => qw/perl-5_8_x perl-58x/;
    for my $file ( @files ) {
        printf "stat($file)[2]: %04o\n", (stat $file)[2] & 07777;
        print for grep !/^\s*$/ => qx(dir/protection $file);
    }
    $ perl prot.pl
    stat(user1:[abeltje.perl-5_8_x]perly.h)[2]: 0444
    Directory USER1:[ABELTJE.PERL-5_8_X]
    PERLY.H;1            (RWED,R,R,R)
    Total of 1 file.
    stat(user1:[abeltje.perl-58x]perly.h)[2]: 0444
    Directory USER1:[ABELTJE.PERL-58X]
    PERLY.H;1            (R,R,R,R)
    Total of 1 file.


Good luck,

Abe
-- 
[ About the taint pragma proposal ]
"Mommy, mommy, look!  I'm driving my bicycle without my hands!"
....
"Mommah, mommah, mook! I'm mrivin my micicl mimof my meemh!""

                                   -- Jarkko Hietaniemi on p5p @ 2001-12-13

Reply via email to