Skip to content

Can not delete git folders on windows (Trac #956) #556

Closed
@phing-issues-importer

Description

Demo buildscript:

<?xml version="1.0"  encoding="UTF-8" ?>
<project name="phpbb3-nv-who-was-here" basedir="." default="umil">
    <property name="temp.dir" value="temp" />
    <property name="build.dir" value="build" />

    <property file="build.properties" />

    <target name="clean" description="Remove build directories">
        <echo msg="Remove build directories" />
        <delete dir="${build.dir}" />
        <delete dir="${temp.dir}/umil" includeemptydirs="true" verbose="true" />
    </target>

    <target name="prepare" depends="clean" description="Prepare packaging">
        <echo msg="Creating directories" />
        <mkdir dir="${build.dir}" />
        <mkdir dir="${temp.dir}" />
    </target>

    <target name="umil" depends="clean,prepare" description="Download phpBB/UMIL">
        <echo msg="Download phpBB/UMIL" />
        <gitclone gitPath="git" repository="${umil.repository}" targetPath="${umil.directory}" />
        <gitcheckout gitPath="git" repository="${umil.directory}" branchname="${umil.version}" quiet="true" create="true" />
    </target>
</project>

properties

# Property files contain key/value pairs
key=value

# Property keys may contain alphanumeric chars and colons, but
# not special chars. This way you can create pseudo-namespaces
umil.repository=git://github.com/phpbb/umil.git
umil.version=v1.0.5
umil.directory=${temp.dir}/umil

Error output:

Buildfile: E:\Extensions\htdocs\who-was-here\git\build.xml
 [property] Loading E:\Extensions\htdocs\who-was-here\git\build.properties

phpbb3-nv-who-was-here > clean:

     [echo] Remove build directories
   [delete] Directory E:\Extensions\htdocs\who-was-here\git\build does not exist
 or is not a directory.
   [delete] Deleting E:\Extensions\htdocs\who-was-here\git\temp\umil\.git\object
s\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx
   [delete] Unable to delete file E:\Extensions\htdocs\who-was-here\git\temp\umi
l\.git\objects\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx: FileSyste
m::unlink() FAILED. Cannot unlink 'E:\Extensions\htdocs\who-was-here\git\temp\um
il\.git\objects\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx'.
   [delete] Deleting E:\Extensions\htdocs\who-was-here\git\temp\umil\.git\object
s\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack
   [delete] Unable to delete file E:\Extensions\htdocs\who-was-here\git\temp\umi
l\.git\objects\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack: FileSyst
em::unlink() FAILED. Cannot unlink 'E:\Extensions\htdocs\who-was-here\git\temp\u
mil\.git\objects\pack\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack'.
   [delete] Deleting directory E:\Extensions\htdocs\who-was-here\git\temp\umil\.
git\objects\pack
   [delete] Unable to delete directory E:\Extensions\htdocs\who-was-here\git\tem
p\umil\.git\objects\pack: FileSystem::rmdir() FAILED. Cannot rmdir E:\Extensions
\htdocs\who-was-here\git\temp\umil\.git\objects\pack.
   [delete] Deleting directory E:\Extensions\htdocs\who-was-here\git\temp\umil\.
git\objects
   [delete] Unable to delete directory E:\Extensions\htdocs\who-was-here\git\tem
p\umil\.git\objects: FileSystem::rmdir() FAILED. Cannot rmdir E:\Extensions\htdo
cs\who-was-here\git\temp\umil\.git\objects.
   [delete] Deleting directory E:\Extensions\htdocs\who-was-here\git\temp\umil\.
git
   [delete] Unable to delete directory E:\Extensions\htdocs\who-was-here\git\tem
p\umil\.git: FileSystem::rmdir() FAILED. Cannot rmdir E:\Extensions\htdocs\who-w
as-here\git\temp\umil\.git.
   [delete] Deleting directory E:\Extensions\htdocs\who-was-here\git\temp\umil
   [delete] Unable to delete directory E:\Extensions\htdocs\who-was-here\git\tem
p\umil: FileSystem::rmdir() FAILED. Cannot rmdir E:\Extensions\htdocs\who-was-he
re\git\temp\umil.

phpbb3-nv-who-was-here > prepare:

     [echo] Creating directories
    [mkdir] Created dir: E:\Extensions\htdocs\who-was-here\git\build

phpbb3-nv-who-was-here > umil:

     [echo] Download phpBB/UMIL
Execution of target "umil" failed for the following reason: E:\Extensions\htdocs
\who-was-here\git\build.xml:22:42: "temp/umil" target directory is not empty

BUILD FAILED
E:\Extensions\htdocs\who-was-here\git\build.xml:22:42: "temp/umil" target direct
ory is not empty
Total time: 0.2968 seconds

System: Win7 64bit, msysgit 1.7.10

As per IRC, might be caused by unclosed files or permissions

Migrated from https://www.phing.info/trac/ticket/956

{
    "status": "infoneeded_new", 
    "changetime": "2016-10-07T14:36:25", 
    "description": "Demo buildscript:\n\n{{{\n<?xml version=\"1.0\"  encoding=\"UTF-8\" ?>\n<project name=\"phpbb3-nv-who-was-here\" basedir=\".\" default=\"umil\">\n\t<property name=\"temp.dir\" value=\"temp\" />\n\t<property name=\"build.dir\" value=\"build\" />\n\n\t<property file=\"build.properties\" />\n\n\t<target name=\"clean\" description=\"Remove build directories\">\n\t\t<echo msg=\"Remove build directories\" />\n\t\t<delete dir=\"${build.dir}\" />\n\t\t<delete dir=\"${temp.dir}/umil\" includeemptydirs=\"true\" verbose=\"true\" />\n\t</target>\n\n\t<target name=\"prepare\" depends=\"clean\" description=\"Prepare packaging\">\n\t\t<echo msg=\"Creating directories\" />\n\t\t<mkdir dir=\"${build.dir}\" />\n\t\t<mkdir dir=\"${temp.dir}\" />\n\t</target>\n\n\t<target name=\"umil\" depends=\"clean,prepare\" description=\"Download phpBB/UMIL\">\n\t\t<echo msg=\"Download phpBB/UMIL\" />\n\t\t<gitclone gitPath=\"git\" repository=\"${umil.repository}\" targetPath=\"${umil.directory}\" />\n\t\t<gitcheckout gitPath=\"git\" repository=\"${umil.directory}\" branchname=\"${umil.version}\" quiet=\"true\" create=\"true\" />\n\t</target>\n</project>\n}}}\nproperties\n\n{{{\n# Property files contain key/value pairs\nkey=value\n\n# Property keys may contain alphanumeric chars and colons, but\n# not special chars. This way you can create pseudo-namespaces\numil.repository=git://github.com/phpbb/umil.git\numil.version=v1.0.5\numil.directory=${temp.dir}/umil\n}}}\nError output:\n\n{{{\nBuildfile: E:\\Extensions\\htdocs\\who-was-here\\git\\build.xml\n [property] Loading E:\\Extensions\\htdocs\\who-was-here\\git\\build.properties\n\nphpbb3-nv-who-was-here > clean:\n\n     [echo] Remove build directories\n   [delete] Directory E:\\Extensions\\htdocs\\who-was-here\\git\\build does not exist\n or is not a directory.\n   [delete] Deleting E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\\.git\\object\ns\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx\n   [delete] Unable to delete file E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umi\nl\\.git\\objects\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx: FileSyste\nm::unlink() FAILED. Cannot unlink 'E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\um\nil\\.git\\objects\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.idx'.\n   [delete] Deleting E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\\.git\\object\ns\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack\n   [delete] Unable to delete file E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umi\nl\\.git\\objects\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack: FileSyst\nem::unlink() FAILED. Cannot unlink 'E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\u\nmil\\.git\\objects\\pack\\pack-7682ab46f76bde9efc783d8c4ac37288d0f6c82f.pack'.\n   [delete] Deleting directory E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\\.\ngit\\objects\\pack\n   [delete] Unable to delete directory E:\\Extensions\\htdocs\\who-was-here\\git\\tem\np\\umil\\.git\\objects\\pack: FileSystem::rmdir() FAILED. Cannot rmdir E:\\Extensions\n\\htdocs\\who-was-here\\git\\temp\\umil\\.git\\objects\\pack.\n   [delete] Deleting directory E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\\.\ngit\\objects\n   [delete] Unable to delete directory E:\\Extensions\\htdocs\\who-was-here\\git\\tem\np\\umil\\.git\\objects: FileSystem::rmdir() FAILED. Cannot rmdir E:\\Extensions\\htdo\ncs\\who-was-here\\git\\temp\\umil\\.git\\objects.\n   [delete] Deleting directory E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\\.\ngit\n   [delete] Unable to delete directory E:\\Extensions\\htdocs\\who-was-here\\git\\tem\np\\umil\\.git: FileSystem::rmdir() FAILED. Cannot rmdir E:\\Extensions\\htdocs\\who-w\nas-here\\git\\temp\\umil\\.git.\n   [delete] Deleting directory E:\\Extensions\\htdocs\\who-was-here\\git\\temp\\umil\n   [delete] Unable to delete directory E:\\Extensions\\htdocs\\who-was-here\\git\\tem\np\\umil: FileSystem::rmdir() FAILED. Cannot rmdir E:\\Extensions\\htdocs\\who-was-he\nre\\git\\temp\\umil.\n\nphpbb3-nv-who-was-here > prepare:\n\n     [echo] Creating directories\n    [mkdir] Created dir: E:\\Extensions\\htdocs\\who-was-here\\git\\build\n\nphpbb3-nv-who-was-here > umil:\n\n     [echo] Download phpBB/UMIL\nExecution of target \"umil\" failed for the following reason: E:\\Extensions\\htdocs\n\\who-was-here\\git\\build.xml:22:42: \"temp/umil\" target directory is not empty\n\nBUILD FAILED\nE:\\Extensions\\htdocs\\who-was-here\\git\\build.xml:22:42: \"temp/umil\" target direct\nory is not empty\nTotal time: 0.2968 seconds\n\n}}}\n\nSystem: Win7 64bit, msysgit 1.7.10\n\nAs per IRC, might be caused by unclosed files or permissions\n", 
    "reporter": "nickvergessen", 
    "cc": "", 
    "resolution": "", 
    "_ts": "1475850985155149", 
    "component": "phing-core", 
    "summary": "Can not delete git folders on windows", 
    "priority": "tbd", 
    "keywords": "", 
    "version": "2.4.14", 
    "time": "2012-12-13T09:54:31", 
    "milestone": "Backlog", 
    "owner": "mrook", 
    "type": "defect"
}

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions