per http://groups.drupal.org/node/106754#comment-412664

We want to extract a directory, not have a tar bomb that extracts into the current directory.

You can always add --strip-components to the extract command if you want it in the current directory, but it's more likely to cause problems if that's the default packing.

Comments

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new3.14 KB

This is a real quick patch, but seems to work - puts the content into a directory which is the current docroot name.

For the future, we need to use tar wrapper code that handles the GNU vs BSD variants so we can substitute the path name instead.

pwolanin’s picture

D7 core has modules/system/system.tar.inc, which is essentially jsut a PEAR class. Maybe for the next round we can pull that into drush so it's available for both 6 and 7?

pwolanin’s picture

We should also double-check file permissions, or set flags not to preserve them. I see this when trying to rm an extracted archive:

rm -rf acquia-drupal
rm: acquia-drupal/sites/default/default.settings.php: Permission denied
rm: acquia-drupal/sites/default/files: Permission denied
rm: acquia-drupal/sites/default/settings.php: Permission denied
rm: acquia-drupal/sites/default: Directory not empty
rm: acquia-drupal/sites: Directory not empty
rm: acquia-drupal: Directory not empty
moshe weitzman’s picture

Couldn't preserving file perms be considered a feature? In general, drush is successful by leaving perms alone as they are hard to handle in a cross platform way. Also, is it up to the tar or untar to ignore them?

pwolanin’s picture

@moshe - yeah, we could make it the responsibility of the one untarring it. I don't feel strongly, just noting bumps I ran into.

moshe weitzman’s picture

Title: drush archive-dump shoudl creat an archive that extracts a directory » drush archive-dump should create an archive that extracts a directory
Status: Needs review » Fixed

Fixed up a little and committed. Managed to get the commit credited to pwolanin in git.

Am not dealing with file perms in archive-dump. Also am files in special directories like .git, .svn, CVS are included. Not sure if omitting those is a useful option. CVS dirs actually contain passwords but hopefully CVS dirs will die away fast.

pwolanin’s picture

Version: » All-versions-4.x-dev
Status: Fixed » Needs review
StatusFileSize
new6.99 KB

Here's a backported patch for 4.x based on the commit to master, plus the one missing function.

moshe weitzman’s picture

Assigned: Unassigned » msonnabaum
Status: Needs review » Reviewed & tested by the community

I think this is appropriate for backport. Thanks pwolanin.

msonnabaum’s picture

Status: Reviewed & tested by the community » Fixed

Backported.

pwolanin’s picture

Thanks - we should probably create a new issue to get a better Tar wrapper in place.

Status: Fixed » Closed (fixed)

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