Hi,

I'm writing an installer script (run on a Linux box) that copies files from a source directory to a target directory. Then it attempts to set some permissions on the new files using chmod. When the code below is run, chmod always returns 1, but when I go look at the files, the permissions are set to 0664 instead of 0777! Any idea what's going on? Incidentally, the user I'm running the script as does have read/write/execute permissions to the installer's target and source directories.
foreach my $file(@toInstall){ print "Copying $file to $input{'installDir'}/..."; system("cp -Rf ./source/$file $input{'installDir'}/"); if(!(-e "$input{'installDir'}/$file")){ die "FAILED! Unable to complete file copy! DNE: $input{'insta +llDir'}/$file\n"; } print "done. Attempting to set permissions: "; print(chmod(0777,"$input{'installDir'}/$file")); print "\nFinished installing $file!\n"; }

In reply to File Permissions by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.