We just had a testbot reconfirmation that "failed to clear checkout directory" and when I went to clear out the /var/lib/drupaltestbot/checkout, I found that it had failed because sites/default/files/upgrade/sites/default was set to 555, not writable by user. IMO all we have to do is to make sure everything is set to u+w before clearing the checkout directory.

Comments

rfay’s picture

I looked through #699's history and it looks to me like http://qa.drupal.org/pifr/test/224738 was the test that broke it.

jthorson’s picture

Status: Active » Needs review
StatusFileSize
new638 bytes

This should do it ... need to find a 'breaking' test which can confirm it. :)

jthorson’s picture

Eliminated a redundant chmod on the sites/default directory.

jthorson’s picture

Second missed apostrophe tonight. :(

jthorson’s picture

Status: Needs review » Fixed

Tested on scratchtestbot and committed to 6.x-2.x (d95a082).

sun’s picture

Status: Fixed » Needs work
+++ b/review/client.inc
@@ -345,13 +345,10 @@ abstract class pifr_client_review {
-        if (!chmod($sites_default, 0777)) {
...
+      if (!$this->exec('chmod -R u+w ' . $this->checkout_directory . '/sites/default')) {

Shouldn't it be: a+w ?

jthorson’s picture

I checked on the last patch which broke testbot, and the files were still owned by www-data. The chmod is executed as www-data, so it likely won't be able to modify anything that it didn't already own, anyway.

Can you provide a link to your last patch which broke things this way? I'll run it through a dev testbot before we roll this into a new release candidate.

sun’s picture

I can only refer to #1364798: Impossible to generate meaningful diffs of upgrade db dumps, but that seems to be the issue you already tested.

As you're making the extra step already, and the sole purpose is to change permissions in order to be able to delete the checkout files right afterwards (correct?), I'd say it would make more sense to go the full way and ensure that files can be deleted no matter what.

The previous code did exactly that (0777), merely limited to settings.php, instead of all files.

jthorson’s picture

Status: Needs work » Fixed

As the chmod is run as the www-data user, it would not succeed for files not already owned by www-data ... thus 'owned by www-data' becomes a pre-assumption for this patch, and a+w does not buy us anything extra.

rfay’s picture

Status: Fixed » Needs work

Oops. Looks like the directory might not exist. I guess we have to check first. From http://qa.drupal.org/pifr/test/135299 (or https://www.evernote.com/shard/s15/sh/0ca32b9b-6c18-46ef-a89a-96b74b9a85...)

[03:53:05] Invoking operation [setup]...
[03:53:05] Command [chmod -R u+w sites/default/files/checkout/sites/default 2>&1] failed
  Duration 0 seconds
  Directory [/var/lib/drupaltestbot]
  Status [1]
 Output: [chmod: cannot access `sites/default/files/checkout/sites/default': No such file or directory].
rfay’s picture

All testbots failed reconfirmation, so I rolled PIFR on each back to 6.x-2.8-rc2. Hope that was the right thing to do. They're reconfirming now.

jthorson’s picture

Of course ... that path won't exist during the reconfirmation process. I'll strip it back to just the '/checkout' directory.

Thanks, rfay!

rfay’s picture

I think it might be best to just ignore failure on this one as well. Nothing we can do about it...

jthorson’s picture

StatusFileSize
new571 bytes

The code is already wrapped in a 'if exists' condition for the checkout directory itself ... so this patch should allow the reconfirmation to happen.

However, if the directory removal fails, that could result in future tests running with an invalid settings.php file. I think a better option would be to have the testbot disable itself if the 'remove checkout directory' failure is detected (I'll create a new feature request for that scenario.)

Edit: Ah, I get what you're saying. I had left out the return statement to ensure that the 'rm' command would also be executed ... but the error would need to be cleared after the rm anyway, so I'll just leave it out altogether.

jthorson’s picture

Status: Needs work » Needs review
StatusFileSize
new677 bytes
jthorson’s picture

StatusFileSize
new669 bytes

Boo to extra whitespace.

jthorson’s picture

StatusFileSize
new668 bytes

Double Boo to whitespace! (Starting to hate this patch ... remove two lines, and somehow add two different whitespace errors?)

jthorson’s picture

StatusFileSize
new667 bytes

I give up. \o/

jthorson’s picture

Status: Needs review » Fixed

Fixed in 6.x-2.8-rc4.

Status: Fixed » Closed (fixed)

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