Moodle

Course Backups fails when including user files

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.8.3
  • Fix Version/s: 1.8.3, 1.9, 2.0
  • Component/s: Backup
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

To reproduce the bug:

1. enter a course as admin, and make a backup
2. keep User: course as setting and User files: yes
3. launch backup.
4. backup stops showing "An error occurred while coping user files"

When selecting no user OR no user files, backup completes successfully.

Issue Links

Activity

Hide
Nicolas Connault added a comment -

So far I haven't been able to reproduce this error.

Show
Nicolas Connault added a comment - So far I haven't been able to reproduce this error.
Hide
Andrea Bicciolo added a comment -

Nicolas, thank you for checking.

On your email you'll find a Moodle site URL and credentials to check one of the several site where the problem is happening.

Show
Andrea Bicciolo added a comment - Nicolas, thank you for checking. On your email you'll find a Moodle site URL and credentials to check one of the several site where the problem is happening.
Hide
Eloy Lafuente (stronk7) added a comment -

Uhm.... knowing a bit more about Andrea's server configuration... could this be related to this change performed between 1.8.2 and 1.8.3 ?

http://moodle.cvs.sourceforge.net/moodle/moodle/backup/backuplib.php?r1=1.135.2.3&r2=1.135.2.4

(note the "recursive flag" added there)

I guess it isn't necessary and, in fact, if breaking sites with some constraints enabled (open_basedir and friends).

It seems that the same problem is happening in other places too:

http://moodle.org/mod/forum/discuss.php?d=82708

So perhaps that new parameter shouldn't be used? 18_STABLE, 19_STABLE and HEAD.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Uhm.... knowing a bit more about Andrea's server configuration... could this be related to this change performed between 1.8.2 and 1.8.3 ? http://moodle.cvs.sourceforge.net/moodle/moodle/backup/backuplib.php?r1=1.135.2.3&r2=1.135.2.4 (note the "recursive flag" added there) I guess it isn't necessary and, in fact, if breaking sites with some constraints enabled (open_basedir and friends). It seems that the same problem is happening in other places too: http://moodle.org/mod/forum/discuss.php?d=82708 So perhaps that new parameter shouldn't be used? 18_STABLE, 19_STABLE and HEAD. Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Also, it seems to be a good idea to implement MDL-11437 in all those branches.

Basically it prevents to start the "recursive" task from "/" and, instead, it's starts from "moodledata", that uses to be a correct directory to perform file operations without problems if running under open_basedir and others.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Also, it seems to be a good idea to implement MDL-11437 in all those branches. Basically it prevents to start the "recursive" task from "/" and, instead, it's starts from "moodledata", that uses to be a correct directory to perform file operations without problems if running under open_basedir and others. Ciao
Hide
Andrea Bicciolo added a comment - - edited

According to the extensive tests done thanks to Eloy, changing the "recursive" to false or undefined allow backups to complete successfully, even with open_basedir setting starting on moodledata.

What about reverting it to it's original state ?

Adding some more hints to reproduce the bug:
1. apache virtual servers environment.
2. open_basedir set to .../vhostfolder/moodledata, vhostfoledr/public_html, /tmp, /usr/bin
3. turn on recursive, backups fails
4. turn off recursive, backups complete

Show
Andrea Bicciolo added a comment - - edited According to the extensive tests done thanks to Eloy, changing the "recursive" to false or undefined allow backups to complete successfully, even with open_basedir setting starting on moodledata. What about reverting it to it's original state ? Adding some more hints to reproduce the bug: 1. apache virtual servers environment. 2. open_basedir set to .../vhostfolder/moodledata, vhostfoledr/public_html, /tmp, /usr/bin 3. turn on recursive, backups fails 4. turn off recursive, backups complete
Hide
Nicolas Connault added a comment -

Removed the recursive param. Not entirely sure if it should be removed from other places in the backuplib.php code, where it is currently used.

Show
Nicolas Connault added a comment - Removed the recursive param. Not entirely sure if it should be removed from other places in the backuplib.php code, where it is currently used.
Hide
Andrea Bicciolo added a comment -

Based on the test done with Eloy, the parameter should be removed also from other places.

Show
Andrea Bicciolo added a comment - Based on the test done with Eloy, the parameter should be removed also from other places.
Hide
Miroslav Fikar added a comment -

I have the same problem as described. It started with revision 1.93 of backup/lib.php. I have located the problem in the following line (308):
from:
$status = check_dir_exists($to_file, true, true);
to:
$status = mkdir($to_file,$CFG->directorypermissions);

It seems to me, that function backup_copy_dir tries mkdir with an argument that has several new directories in it - and it cannot do it.

Show
Miroslav Fikar added a comment - I have the same problem as described. It started with revision 1.93 of backup/lib.php. I have located the problem in the following line (308): from: $status = check_dir_exists($to_file, true, true); to: $status = mkdir($to_file,$CFG->directorypermissions); It seems to me, that function backup_copy_dir tries mkdir with an argument that has several new directories in it - and it cannot do it.
Hide
Ryan Smith added a comment - - edited

Looks like its working on my end.

Show
Ryan Smith added a comment - - edited Looks like its working on my end.
Hide
Andrea Bicciolo added a comment -

As far as I know the issue is resolved. On all our production systems the patches committed by Eloy and Nicolas works.
Try with the latest CVS version, if not already installed, then try to understand where the automated backups fails from the logs.

Show
Andrea Bicciolo added a comment - As far as I know the issue is resolved. On all our production systems the patches committed by Eloy and Nicolas works. Try with the latest CVS version, if not already installed, then try to understand where the automated backups fails from the logs.
Hide
Eloy Lafuente (stronk7) added a comment -

Closing this. Thanks for your help!

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Closing this. Thanks for your help! Ciao

People

Dates

  • Created:
    Updated:
    Resolved: