Subject: | Set permissions on local files after 'get' is forced. |
Confirmed to exist in Net-SFTP-Foreign-1.69 and
Net-SFTP-Foreign-1.70_08. Local system is RHEL 5.7 (kernel
2.6.18-274.17.1.el5) running Perl v5.8.8.
Encountered an issue when downloading a file and saving to a CIFS
mounted drive which had a forced masks. Being forced the permissions
could not be modified after download.
Tracked bug to this section of code in the Foreign.pm :
1565 }
1566
1567 if (defined $perm) {
1568 local ($@, $SIG{__DIE__}, $SIG{__WARN__});
1569 my $e = eval { chmod($perm & $neg_umask, $local) };
Line 1567 will always be true regardless of whether module is called
with copy_perm set to 0 or 1. This causes file permissions to be set
post-download as a result. A simple fix would be to update as follows:
1565 }
1566
1567 if ( (defined $perm) and ($copy_perm) ) {
1568 local ($@, $SIG{__DIE__}, $SIG{__WARN__});
1569 my $e = eval { chmod($perm & $neg_umask, $local) };
This ensures that copy_perm is checked to confirm it is set to a 1 and
that the end user does in fact which for permissions to be set after
download.
Hope this helps!
Rich