upgrade to 1.4.0 stable
http://pear.php.net/package/Archive_Tar

1.4.0 stable
* Add support for PHP 7
* Drop support for PHP 4
* Add visibility declarations to methods and properties

Apart from the upgrades done to Tar.php at pear.net.net, there are known platform issues with the current versions for Drupal (system.tar.inc in Drupal 7 and ArchiveTar in Drupal 8):

  1. On Windows, path names are translated wrongly and the result is that e.g. the backup and migrate module can generate backup files with wrong paths.
  2. On Ubuntu 14.04 LTS (Trusty Tahr) 32 bit, gzopen() etc. are not defined. This results in White Screen Of Death (WSOD) for e.g. import/export configuration, install module and backup and migrate.
CommentFileSizeAuthor
#57 interdiff.txt900 bytesDavid_Rothstein
#57 update_system_tar_inc-d7-1414508-57.patch128.5 KBDavid_Rothstein
#53 update_system_tar_inc-d7-1414508-53.patch128.54 KBKimNyholm
#53 interdiff-ArchiveTar.php-system.tar_.inc_.txt1.05 KBKimNyholm
#45 interdiff-ArchiveTar.php-43-45.txt4.75 KBKimNyholm
#45 update_system_tar_inc-1414508-45.patch128.86 KBKimNyholm
#43 interdiff-Tar.php-1.4.0-ArchiveTar.php-43.txt6.56 KBKimNyholm
#43 update_system_tar_inc-1414508-43.patch128.83 KBKimNyholm
#42 interdiff-tar.php-1.4.0-ArchiveTar.php-42.txt6.36 KBKimNyholm
#42 update_system_tar_inc-1414508-42.patch128.91 KBKimNyholm
#41 interdiff-tar.php-1.4.0-ArchiveTar.php-41.txt4.63 KBKimNyholm
#41 update_system_tar_inc-1414508-41.patch127.8 KBKimNyholm
#38 update_system_tar_inc-1414508-38.patch98.71 KBKimNyholm
#38 interdiff-1414508-29-38.txt1.83 KBKimNyholm
#38 interdiff-tar.php-1.3.13-1.3.16.txt1.86 KBKimNyholm
#35 update_system_tar_inc-1414508-35.patch98.79 KBKimNyholm
#35 interdiff-1414508-29-35.txt1.6 KBKimNyholm
#29 update_system_tar_inc-1414508-29.patch98.41 KBdroplet
#26 update_system_tar_inc-1414508-26.patch98.42 KBdroplet
#26 interdiff.patch3.83 KBdroplet
#23 update_system_tar_inc-1414508-23.patch102.36 KBdroplet
#19 interdiff-between-PEAR-n-Drupal-version.txt5.66 KBdroplet
#19 update_system_tar_inc-1414508-19.patch102.32 KBdroplet
#17 update_system_tar_inc-1414508-17.patch135.21 KBmglaman
#17 interdiff-1414507-15-17.txt498 bytesmglaman
#15 update_system_tar_inc-1414508-15.patch135.21 KBmglaman
#15 interdiff-1414508-13-15.txt137.53 KBmglaman
#13 update_system_tar_inc-1414508-13.patch37.81 KBmglaman
#8 tar-8.patch37.5 KBkid_icarus
#8 interdiff.txt410 byteskid_icarus
#6 tar-6.patch37.48 KBkid_icarus
#4 tar.patch35.23 KBdroplet
#2 system.tar_.patch35.18 KBdroplet
system.tar_.patch35.84 KBdroplet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, system.tar_.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
35.18 KB

Status: Needs review » Needs work

The last submitted patch, system.tar_.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
35.23 KB
droplet’s picture

Assigned: droplet » Unassigned
Status: Needs review » Needs work
Issue tags: +Novice

latest version: 1.3.10 (stable) was released on 2012-04-10 (Changelog)

back to need work.

kid_icarus’s picture

Status: Needs work » Needs review
FileSize
37.48 KB

Well, here's my attempt at upgrading to 1.3.10, I hope I got it right :)

Status: Needs review » Needs work

The last submitted patch, tar-6.patch, failed testing.

kid_icarus’s picture

Status: Needs work » Needs review
FileSize
410 bytes
37.5 KB

Whoops, looks like I forgot to add in a __destruct().

The last submitted patch, tar-8.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

hgurol’s picture

Issue summary: View changes
Issue tags: +Needs backport to 7.x

The latest version of Archive_tar is 1.3.11
It fixes a serious bug which surfaces with php 5.5
https://pear.php.net/bugs/bug.php?id=19746

and I strongly feel that I am hitting that bug on D7 with ubuntu 14.04 (apache 2.4 & php 5.5).

hgurol’s picture

Category: Task » Bug report
Priority: Normal » Major

Okay, some more details.
Running Ubuntu 14.04 (apache 2.4 & php 5.5).
Fresh installation of latest D7 & D8.
Module or Theme installation though the admin interface or updates do not work if the file extension is tar.gz.
If I try to install a module or theme with the zip extension does work. For updates, I do not have that choice.
When I try to install a module (any module) with tar.gz extension, 2 folders are created in my /tmp folder.
One is "update-cache" which has the module file inside and "update-extraction-" which is empty.
Obviously, something wrong is going on during the extraction, which fails.
Nothing on the logs, even though php is set for reporting all errors and apache logging level is set to debug; nothing.
I strongly believe, its due to the outdated Archive_Tar library.
This is not a task but a bug and a major one I believe.

This applies to both D7 and D8.

mgifford’s picture

Issue summary: View changes
Issue tags: -
mglaman’s picture

Status: Needs work » Needs review
FileSize
37.81 KB

Re-roll against 8.0.x HEAD

Status: Needs review » Needs work

The last submitted patch, 13: update_system_tar_inc-1414508-13.patch, failed testing.

mglaman’s picture

Status: Needs work » Needs review
FileSize
137.53 KB
135.21 KB

Forgot to refactor usage of class with class name change (to match package - ArchiveTar -> Archive_Tar)

Status: Needs review » Needs work

The last submitted patch, 15: update_system_tar_inc-1414508-15.patch, failed testing.

mglaman’s picture

Status: Needs work » Needs review
FileSize
498 bytes
135.21 KB

First patch made these changes

+//            @unlink($this->_temp_tarname);
             @drupal_unlink($this->_temp_tarname);
-//        $this->_PEAR();
+        $this->_PEAR();

However the method _PEAR(); hasn't been implemented yet. Updated patch with fix.

mgifford’s picture

Seems to satisfy the bots.

What else needs to happen to mark this RTBC?

droplet’s picture

This is 1.3.13 stable.

Just need to make sure:

- all @unlink -> @drupal_unlink
- // comment out PEAR function: $this->PEAR()

mglaman’s picture

droplet, thanks for catch!

mgifford’s picture

Any reason why this couldn't just be installed here http://simplytest.me/project/drupal/8.0.x?patch[]=https://www.drupal.org...

star-szr’s picture

Status: Needs review » Needs work

Because the patch no longer applies. It will need a lot of rerolls unless we keep the class name the same.

+++ b/core/lib/Drupal/Core/Archiver/Tar.php
@@ -15,7 +15,7 @@ class Tar implements ArchiverInterface {
-   * @var \Drupal\Core\Archiver\ArchiveTar
+   * @var \Drupal\Core\Archiver\Archive_Tar

@@ -30,7 +30,7 @@ class Tar implements ArchiverInterface {
-    $this->tar = new ArchiveTar($file_path);
+    $this->tar = new Archive_Tar($file_path);

Changing the class name seems a bit out of scope. Why not keep it as ArchiveTar?

droplet’s picture

Status: Needs work » Needs review
FileSize
102.36 KB

reroll

mgifford’s picture

That latest patch works well. Thanks @droplet!

Did you address @Cottser's concerns about the class name? Not sure if there is any way to avoid it. A problem with "Proudly built elsewhere"

star-szr’s picture

My main point was it was called ArchiveTar before so I think we were already renaming it, but I could be wrong on that.

droplet’s picture

Make sense. Removed renaming.

The last submitted patch, 26: interdiff.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 26: update_system_tar_inc-1414508-26.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
98.41 KB
star-szr’s picture

+++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
@@ -131,92 +159,89 @@ function __construct($p_tarname, $p_compress = null)
-//                PEAR::loadExtension($extname);
-                $this->loadExtension($extname);
+                PEAR::loadExtension($extname);
...
-    /**
-    * OS independent PHP extension load. Remember to take care
-    * on the correct extension name for case sensitive OSes.
-    * The function is the copy of PEAR::loadExtension().
-    *
-    * @param string $ext The extension name
-    * @return bool Success or not on the dl() call
-    */
-    function loadExtension($ext)
-    {
-        if (!extension_loaded($ext)) {
-            // if either returns true dl() will produce a FATAL error, stop that
-            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
-                return false;
-            }
-
-            if (OS_WINDOWS) {
-                $suffix = '.dll';
-            } elseif (PHP_OS == 'HP-UX') {
-                $suffix = '.sl';
-            } elseif (PHP_OS == 'AIX') {
-                $suffix = '.a';
-            } elseif (PHP_OS == 'OSX') {
-                $suffix = '.bundle';
-            } else {
-                $suffix = '.so';
-            }
-
-            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
-        }
-
-        return true;
-    }

I think this part maybe needs to be reassessed/rolled back.

Overall this seems hard to review :/ not sure the best way forward.

alexpott’s picture

Regarding the deprecation of dl - I've checked following code in PHP7...

php -r "var_dump(ini_get('enable_dl'));"
string(0) ""

So I think we are okay here - http://3v4l.org/XgqCt

kim.pepper’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue tags: +PHP 7.0 (duplicate)

I suggest we move this to 8.1.x, use composer to load this library and refactor the Drupal specific code out.

Tagging PHP 7.

David_Rothstein’s picture

Version: 8.1.x-dev » 8.0.x-dev
Issue tags: +Needs backport to D7

Since this is fixing a bug (and needed in Drupal 7 also) let's put this back to 8.0.x. (Or alternatively, I guess we could reopen #1301376: undefined constant OS_WINDOWS Archive_Tar->loadExtension() with the aim of doing a more limited fix there?)

KimNyholm’s picture

Function _translateWinPath() does also reference OS_WINDOWS. Since OS_WINDOWS is not defined in all Windows/PHP versions the function is unreliable. I am not sure we can assume that ':' (colon) and '\' (backslash) is not used in nix context, but if the assumption is valid, the most easy fix it is to remove the condition if (defined('OS_WINDOWS') && OS_WINDOWS) and always do the translation. In that case, the translation won't harm and the performance penalty is low.

KimNyholm’s picture

I have removed OS_WINDOWS as explained in #34. I have also removed one further instance of OS_WINDOWS, which has been re-introduced between 8.0.x and patch #29.

If attached is ok, I can backport to Drupal 7, however I am not sure under which issue # this shall be done.

droplet’s picture

Status: Needs review » Needs work

@KimNyholm,

Can you submit your concern to upstream?
https://github.com/pear/Archive_Tar

We also have to update to latest version.

KimNyholm’s picture

I have checked at https://pear.php.net/package/PEAR and they have defined OS_WINDOWS in pear.php 1.9.5 (last stable) with the following fragment

if (substr(PHP_OS, 0, 3) == 'WIN') {
    define('OS_WINDOWS', true);
    define('OS_UNIX',    false);
    define('PEAR_OS',    'Windows');
} else {
    define('OS_WINDOWS', false);
    define('OS_UNIX',    true);
    define('PEAR_OS',    'Unix'); // blatant assumption
}

By documentation PHP_OS is the OS where PHP is build, but since above is accepted, I assume that you normally build on the platform you target.

Not sure how to proceed. Either keep patch #35, make new patch look like above or ... ? And then merge with updates in Archive_Tar (last stable 1.3.16).

KimNyholm’s picture

I have dropped patch #35 and instead done the change as in pear.php and also included the changes from tar.php 1.3.13 to 1.3.16.

KimNyholm’s picture

Status: Needs work » Needs review
mgifford’s picture

Status: Needs review » Needs work

What's the best way to do manual testing on this patch? Bot likes it. Certainly looks like it's using a more recent version of Tar.php (2012-04-05).

The current release though is now 1.4.0 (stable) released just over a week ago. Seems like it would make sense to use that, no?

KimNyholm’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
127.8 KB
4.63 KB

This patch updates to Tar.php 1.4.0 stable. Lots of changes have been introduced in Tar.php since 1.3.16 (contained in patch #38). It seems to me, that the most safe port, is to redo all drupal specific changes as in attached patch #41. I have tested with success a backport to Drupal 7.38 of patch #41 on Windows 7 with AMPPS and PHP 5.5 with the Backup and Migrate module. Since I have not been working with this issue from the beginning, I may have overlooked something, so comments are appreciated.

KimNyholm’s picture

Oops, the reference to PEAR::loadExtension was not removed. As mentioned in #30 the reintroduction of this should be rolled back. It was introduced in #486558: Add Archive Tar to Drupal and I have seen no reference to why it should be changed.
I have reproduced the issue in #11 which looks to be the same as Drupal 7 on Ubuntu 14.04 : can't install modules with wsod. A backport to Drupal 7 of patch #42 fixes this.

KimNyholm’s picture

The way Drupal namespace was implemented broke functionality. This is fixed now. I have reproduced #2310183: Config export fails on Ubuntu 14.04 on Drupal 8.0.x and tested with success with patch #43.

klausi’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
    @@ -30,83 +30,145 @@
    + * This file origin is Tar.php, release 1.4.0 (stable) with some code ¶
    ...
    + *  changed $this->error_object = &$this->raiseError($p_message); ¶
    ...
    + ¶
    

    trailing space, also elsewhere.

  2. +++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
    @@ -30,83 +30,145 @@
    + * Only do significant changes to this file, this will simplify
    + * future upgrades from pear.com.
    

    What, only do significant changes? You mean not significant changes.?

  3. +++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
    @@ -30,83 +30,145 @@
    + * The following changes has been done
    

    should be "The following changes have been done:"

  4. +++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
    @@ -30,83 +30,145 @@
    +// drupal addition
    

    All comments should start upper case and end with a dot. Please check all your comments.

Otherwise makes sense to me.

KimNyholm’s picture

Comments updated and trailing whitespaces removed.

KimNyholm’s picture

Issue summary: View changes
mgifford’s picture

Thanks @KimNyholm - just testing if the bots like it in PHP 7.

Thanks for updating it to 1.4.0. I confirmed that this works when testing it manually. Not sure what manual testing is required though.

KimNyholm’s picture

For information, I have done the below manual tests with the update and they worked for me. Before the update, all tests failed on Ubuntu Trusty 32 bit and the 'Backup and Migrate' test failed on Windows 7.

  • Drupal 8.0.x: tested 'Admin Import Module' and 'Config Export' on Ubuntu Trusty both 32 and 64 bit.
  • Drupal 7.38: backported and tested 'Admin Import Module' and 'Backup and Migrate' on Ubuntu Trusty both 32 and 64 bit and Windows 7.
mgifford’s picture

Status: Needs review » Reviewed & tested by the community

Ok, this looks good to me then. I've done some testing too. Haven't found any problems yet.

webchick’s picture

We should be able to commit this shortly after tagging beta 15.

webchick’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 8.0.x. Thanks!

Back to 7.x.

  • webchick committed 6562f3c on 8.0.x
    Issue #1414508 by droplet, KimNyholm, mglaman, kid_icarus, mgifford,...
KimNyholm’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.05 KB
128.54 KB

Attached is a backport to Drupal 7 of ArchiveTar.php. This file is called system.tar.inc in Drupal 7. Changes done to backport are:
- removed namespace
- renaming the class
I have tested the backport patch #53 with Install Module and Backup and Migrate on Drupal 7.x with success on Ubuntu Trusty (both 32 and 64 bit) and Windows 7.

droplet’s picture

Status: Needs review » Reviewed & tested by the community

Cool. It's fully ported back to D7 ( and removed namespace in D8 )

andypost’s picture

  • webchick committed 6562f3c on 8.1.x
    Issue #1414508 by droplet, KimNyholm, mglaman, kid_icarus, mgifford,...
David_Rothstein’s picture

I reviewed this to the extent possible, and overall it looks good to me (it's a big update, but a significant percentage of it is documentation and code style changes).

Thanks for the manual testing, which also gives confidence in committing this to Drupal 7.

  1.         throw new Exception($p_message);
    +        // Drupal change $this->error_object = $this->raiseError($p_message).
    +        throw new \Exception($p_message);
    

    We can't do this since Drupal 7 still supports PHP 5.2. I've fixed it in the attached patch. Since this is such a small change, I'm leaving the issue at RTBC and will plan to commit it for the upcoming release as long as it passes tests.

  2. -        // Drupal integration.
    -        // Changed the code to use drupal_mkdir() instead of mkdir().
    -        if (!@drupal_mkdir($p_dir, 0777)) {
    +        if (!@mkdir($p_dir, 0777)) {
    

    I was a little worried about this, but as far as I can see from https://api.drupal.org/api/drupal/includes!file.inc/function/drupal_mkdir/7 it should be fine not to use drupal_mkdir() here.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 57: update_system_tar_inc-d7-1414508-57.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Reviewed & tested by the community

Doesn't look real. I added a new test.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.42 release notes

Committed to 7.x - thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.