Issue Details (XML | Word | Printable)

Key: MDL-16556
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Nicolas Connault
Reporter: Mark Nielsen
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

check_dir_exists() recursive does not work on windows

Created: 18/Sep/08 01:57 AM   Updated: 24/Sep/08 04:47 AM
Return to search
Component/s: Lib
Affects Version/s: 1.8.6, 1.9.2
Fix Version/s: 1.8.7, 1.9.3

File Attachments: 1. Text File moodlelib.patch (1.0 kB)

Environment: Windows XP Pro V3 with NTFS file system

Participants: Mark Nielsen, Nicolas Connault and Petr Skoda
Security Level: None
QA Assignee: Petr Skoda
Resolved date: 19/Sep/08
Affected Branches: MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
We recently ran into a problem with check_dir_exists() and having it recursively create directories on Windows. Example call:

$CFG->dataroot = 'C:\xampp/moodledata';
check_dir_exists('C:\xampp/moodledata/path/to/dir', true, true);

What is passed to mkdir:

C:\xampp/moodledata/C:/
C:\xampp/moodledata/C:/xampp/
C:\xampp/moodledata/C:/xampp/moodledata/
C:\xampp/moodledata/C:/xampp/moodledata/path/
C:\xampp/moodledata/C:/xampp/moodledata/path/to/
C:\xampp/moodledata/C:/xampp/moodledata/path/to/dir/

Now, same call with the attached patch:

C:\xampp/moodledata/path/
C:\xampp/moodledata/path/to/
C:\xampp/moodledata/path/to/dir/

Since this method is called everywhere, I don't see how this problem hasn't come up before, which leads me to believe that I'm missing something. I did not experience the problem first hand as I develop on a Mac but as you can see from my simple test above, it is not working as intended.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault added a comment - 18/Sep/08 09:37 PM
I just tested on a windows machine without being able to reproduce the error. My specs are
  • Windows Vista Family Premium
  • PHP 5.2.5
  • Apache 2.2.6
  • MySQL 50.051b
  • Latest HEAD code

Mark Nielsen added a comment - 19/Sep/08 03:23 AM
HEAD uses PHP5's new recursive option to mkdir(). So, the code is radically different from 1.9 and before.

Nicolas Connault added a comment - 19/Sep/08 01:02 PM
Sorry, I only just realised the version number for this bug... Testing with 1.9 now

Nicolas Connault added a comment - 19/Sep/08 01:43 PM
Applied patch to 1.8 and 1.9. Works nicely now, thanks for the report and patch.

Mark Nielsen added a comment - 20/Sep/08 01:12 AM
Thanks for the work so far, but it looks like the patch wasn't applied to the MOODLE_19_STABLE branch.

Petr Skoda added a comment - 24/Sep/08 04:47 AM
verified, closing
thanks