Modify

Ticket #348 (closed defect: worksforme)

Opened 3 years ago

Last modified 3 years ago

mkdir is not recursive, copying fails if files are not in favorable order

Reported by: mrook Owned by: mrook
Priority: major Milestone: 2.4.0RC1
Component: phing-core Version: 2.3.2
Keywords: Cc: spam04@…

Description

When copying, phing doesn't create all parent directories automatically - only single directory level at once. This causes builds to fail when copying files straight into subdirectories, e.g. when filesets contain files from deepest subdirectories first.

[phingcall] mkdir(): No such file or directory
[phingcall] #0 [internal function]: exception_error_handler(2, 'mkdir(): No suc...', '/sw/php/phing/s...', 319, Array)
[phingcall] #1 /sw/php/phing/system/io/FileSystem.php(319): mkdir('/www/phptal/bui...', 493)
[phingcall] #2 /sw/php/phing/system/io/PhingFile.php(632): FileSystem->createDirectory(Object(PhingFile))
[phingcall] #3 /sw/php/phing/system/io/PhingFile.php(610): PhingFile->mkdir()
[phingcall] #4 /sw/php/phing/util/FileUtils.php(84): PhingFile->mkdirs()
[phingcall] #5 /sw/php/phing/tasks/system/CopyTask.php(379): FileUtils->copyFile(Object(PhingFile), Object(PhingFile), false, true, Array, Object(Project))
[phingcall] #6 /sw/php/phing/tasks/system/CopyTask.php(245): CopyTask->doWork()
[phingcall] #7 /sw/php/phing/Task.php(253): CopyTask->main()
...
Phing version 2.3.3, PHP 5.3.0RC2-dev.

I suggest following fix:

--- /sw/php/phing/system/io/FileSystem.php +++ /sw/php/phing/system/io/FileSystem.php @@ -315,7 +315,7 @@

  • returning true if and only if the operation succeeds. */

function createDirectory(&$f) {

  • return @mkdir($f->getAbsolutePath(),0755);

+ return @mkdir($f->getAbsolutePath(),0755, true);

}

/

Attachments

Change History

comment:1 Changed 3 years ago by mrook

  • Status changed from new to closed
  • Resolution set to worksforme

I can not reproduce this with the following build file:

<project name="FooBar" default="main" basedir=".">
        <target name="main">
                <delete dir="a"/>
                <copy todir="a/b/c">
                        <fileset dir=".">
                                <include name="*.xml"/>
                        </fileset>
                </copy>
        </target>
</project>

The result is:

FooBar > main:

   [delete] Deleting directory /home/druid/dev/phing_tests/a
     [copy] Copying 1 file to /home/druid/dev/phing_tests/a/b/c

Could you provide me with a build file to help me reproduce this error?

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.