On Wed, 19 Sep 2012 23:27:55 -0700, ilovelinux wrote:
>> my $tempdir = tempdir( CLEANUP => 1 );
>> remove_tree($tempdir, { safe => 0 });
>
> Smells like somethnig weird in the Cygwin layer. I once encountered a
> similar error: the Cygwin perl script removed some files but they stayed
> visible from an Explorer view in another window, until the perl script
> finished: only then the removed files disappeared.
>
> Did you try removing the files by hand-crafted code? Something like
> this:
>
> for (glob("$tempdir/*")) {
> print "removing $_: ";
> if (unlink($_)) {
> print "OK\n";
> } else {
> print "ERR ($!)\n";
> }
> }
I even tried rm -rf and that didn't work, which I found rather surprising.
> Smells like somethnig weird in the Cygwin layer.
It turns out that in Cygwin paths starting with /tmp/ get magically
redirected to c:/cygwin/tmp/
I cannot imagine a universe where that would be a good idea, but
apparently the Cygwin authors thought it was.
tempdir returns /tmp/something, and this gets interpreted as
c:/tmp/something by some parts of my script and as
c:/cygwin/tmp/something by other parts of my script (including tempdir
itself).
tempdir does in fact clean up its directory, but not the directory I
thought it was using.
My ugly, non-portable and fragile workaround is to chdir to c: then
prepend the temp directory name with c: before I use it.
Regards,
Allan
|