Problem

On our setup I have the issue, that drush up ... will always end in telling that it just rolled-back because of an error.

Mime type for /xxx/sites/all/modules/contrib/token-7.x-1.5.tar.gz is application/x-gzip [notice]
Executing: tar -C /xxx/sites/all/modules/contrib -xzf token-7.x-1.5.tar.gz
Unable to untar /xxx/sites/all/modules/contrib/token-7.x-1.5.tar.gz. [error]
Project token was updated successfully. Installed version is now 7.x-1.5.
Backups were saved into the directory /root/drush-backups/xxx/20130226082555/modules/token. [ok]
Rolling back update of Token code ... [notice]
Executing: svn info sites/all/modules/contrib/token
Executing: bzr root sites/all/modules/contrib/token
Backups were restored successfully. [ok]
Command dispatch complete

Details

It rolles back even the file are created and all looks fine when doing the steps manually.
But permission problem also happened when doing it manually, so here is the problem:

Executing: tar -C /xxx/www/sites/all/modules/contrib -xzf ds-7.x-2.2.tar.gz
  tar: ds/js/ds.admin.js: Cannot change ownership to uid 6226, gid 6226: Permission denied

I already read something about executing drush not as root could fix the problem. (this probably because tar will use -o per default for none roots)

-o, --no-same-owner
extract files with owner set to current user (the default for non-root users)

Fix

So I fixed the issue for me with just adding the option --no-same-owner to the command which is executed here:
drush/includes/drush.inc Line 1089

old:

$return = drush_shell_cd_and_exec(dirname($path), "$tar -C %s -x%sf %s", $destination, $tar_compression_flag, basename($path));

new:

$return = drush_shell_cd_and_exec(dirname($path), "$tar --no-same-owner -C %s -x%sf %s", $destination, $tar_compression_flag, basename($path));

Comment

I know that this sounds like the files would be owned by root, but this is not the case for me (files are on a samba share, not sure if this is the cause).
All works fine with this change, drush successfully can update again my modules and files are owned by www-data.
Not sure anyway why it should make those files to the permissions in the tar 6226

Looking forward to some feedback. At least I perhaps could help out some others which have this issue...

Comments

greg.1.anderson’s picture

Version: 7.x-5.8 » 8.x-6.x-dev
Status: Needs work » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.

greg.1.anderson’s picture

Issue summary: View changes

updating header style