Skip to content

Commit cf70755

Browse files
committed
maintain original file perms
1 parent fd4de85 commit cf70755

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pear/PEAR/Installer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,12 @@ function _installFile($file, $dest_dir, $atts)
227227
}
228228
$this->log(2, "+ created dir $dest_dir");
229229
}
230+
$orig_perms = fileperms($file);
230231
if (!@copy($file, $dest_file)) {
231232
$this->log(0, "failed to copy $file to $dest_file");
232233
return false;
233234
}
235+
chmod($dest_file, $orig_perms);
234236
$this->log(2, "+ copy $file to $dest_file");
235237
// FIXME Update Package database here
236238
//$this->updatePackageListFrom("$d/$file");

pear/PEAR/Packager.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,24 @@ function package($pkgfile = 'package.xml')
154154
return $this->raiseError("could not mkdir $dir");
155155
}
156156
}
157+
//Maintain original file perms
158+
$orig_perms = fileperms($fname);
157159
if (!@copy($fname, $file)) {
158160
$this->log(0, "could not copy $fname to $file");
159161
} else {
160162
$this->log(2, "+ copying from $fname to $file");
161163
}
164+
chmod($file, $orig_perms);
162165
}
163166
// XXX TODO: Rebuild the package file as the old method did?
164167
165168
// This allows build packages from different pear pack def files
166-
if (!@copy($pkgfile, $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml')) {
167-
return $this->raiseError("could not copy $pkgfile to " . $this->tmpdir);
169+
$dest_pkgfile = $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
170+
$this->log(2, "+ copying package $pkgfile to $dest_pkgfile");
171+
if (!@copy($pkgfile, $dest_pkgfile)) {
172+
return $this->raiseError("could not copy $pkgfile to $dest_pkgfile");
168173
}
169-
$this->log(2, "+ copying package $pkgfile to " . $this->tmpdir);
174+
chmod($dest_pkgfile, 0644);
170175

171176
// TAR the Package -------------------------------------------
172177
chdir(dirname($this->tmpdir));

0 commit comments

Comments
 (0)