drush_make_tar() is busted.
here's the line in question: drush_shell_exec("tar -C%s -s/__build__/%s/ -Pc __build__ | gzip > %s", $tmp_path, basename($base_path, '.tar.gz'), $base_path);
the big problem is that it looks like the -s switch is being used like a regex, but in reality the -s switch for tar does this: "list of names to extract is sorted to match archive".
also, the output is being piped through gzip manually, which isn't necessary -- the -z switch can take care of that.
attached patch fixes the problem in local testing. i didn't see any other switch for tar that would let you substitute the name of the directory prior to tar'ing, so i just do an ol' fashioned mv -- the entire temp dir is wiped clean anyways before the end of the cycle, so this works fine and doesn't leave any mess.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | drush_make_tar_fix.patch | 1.35 KB | hunmonk |
| #2 | drush_make_tar_fix.patch | 1.14 KB | hunmonk |
| drush_make_tar_fix.patch | 913 bytes | hunmonk |
Comments
Comment #1
dmitrig01 commentedLooks good, except I'd like to do it the other way around - tar and them move - that way, if we encounter any errors with tarring, it doesn't get moved.
Comment #2
hunmonk commentedthe problem is that we need to move it before the tar operation, otherwise the root dir of the tar'd file is __build__, which is not what we want.
attached patch moves the previously moved dir back to it's original location immediately after the tar operation -- this leaves things in a consistent state regardless of the outcome of tar.
Comment #3
dmitrig01 commentedthat was not so much the problem, it's more about cleaning up. can we rename __build__, tar it, and then move the tar file?
Comment #4
hunmonk commentedyou mean like this?
Comment #5
dmitrig01 commentedyep - comitted - thanks!
Comment #6
moshe weitzman commentedFYI, tar -C does not work on Windows or Solaris. See #636738: tar command doesn't work on windows or solaris
Comment #7
dmitrig01 commenteddrush_shell_exec("(cd %s; tar -Pczf %s/%s %s)", $tmp_path, $tmp_path, $filename, $dirname) maybe?
Comment #8
moshe weitzman commentedI try to use php when possible since otherwise you run into problems with windows and hosts with odd restrictions in php (safe_mode, etc.). So, chdir() instead of cd. Also, changing directory is dangerous in drush. Make sure that you change back, even if you have an error condition.
Comment #9
dmitrig01 commentedfix comitted