PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Archive_Tar » Bug #4016

owner, permissions and file date after addString()

Details

Submitted2005-03-31 11:15 UTC
Frompshevtsov at sw-soft dot com
Assignedvblavet
StatusClosed
PackageArchive_Tar
PHP Version4.3.10
OSLinux
Roadmaps(Not assigned)

Comments

[2005-03-31 11:15 UTC] pshevtsov at sw-soft dot com

Description:
------------
When file is added with function Archive_Tar::addString() it has no permissions (000) and file date is 01/01/1970

Reproduce code:
---------------
$archive = new Archive_Tar('filename.tgz', TRUE);
$contents = "File contents";
$archive->addString('filename.txt', $contents);

Expected result:
----------------
Current date of file, 664 permissions

Actual result:
--------------
$ tar xzf filename.tgz
$ ls -la interface.txt
---------- 1 shevtsov shevtsov 84856 Jan 1 1970 interface.txt

[2005-03-31 11:20 UTC] pshevtsov at sw-soft dot com

---------- 1 shevtsov shevtsov 13 Jan 1 1970 filename.txt

[2005-05-30 10:17 UTC] thomas dot hille at nightsabers dot org

Here is a patch for this bug, it uses 0600 as permission. This is still quite restrictive, but I wanted to be on the save side. For time the current time is used.

--- /usr/share/pear/Archive/Tar.php 2005-05-30 12:27:42.000000000 +0200
+++ Tar.php 2005-05-30 12:05:49.000000000 +0200
@@ -973,7 +973,7 @@
$p_filename = $this->_translateWinPath($p_filename, false);;

if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
- 0, 0, "", 0, 0))
+ time(), 384, "", 0, 0))
return false;

$i=0;

[2005-11-19 14:24 UTC] vblavet at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.