Hi,
sometime between coreutils-7.0 and coreutils-8.4 (sorry, I don't have
any other in between versions anymore) this simple command started to fail:
# mkdir -p lev1/lev2/lev3
# rm -rfv lev1
removed directory: `lev1/lev2/lev3'
removed directory: `lev1/lev2'
rm: cannot remove `lev1': Device or resource busy
Tested with coreutils-8.10 and cygwin1.dll from the 20111017 snapshot,
as the cygwin1.dll didn't make any difference for the problem.
If I just use rm.exe from coreutils-7.0 everything starts to work as
expected again:
# mkdir -p lev1/lev2/lev3
# rm -rfv lev1
removed directory: `lev1/lev2/lev3'
removed directory: `lev1/lev2'
removed directory: `lev1'
Looking at the strace output of both rm-7.0 and rm-8.10 it seems that
rm-8.10 thinks that lev1 is a file, because it uses unlink_nt() first.
...
3866 164248 [main] rm-8.10 336 rmdir: 0 = rmdir
(/test_rm_rf/lev1/lev2/lev3)
295 164543 [main] rm-8.10 336 close: close (5)
231 164774 [main] rm-8.10 336 fhandler_base::close: closing
'/test_rm_rf/lev1/lev2' handle 0x6FC
150 164924 [main] rm-8.10 336 close: 0 = close (5)
252 165176 [main] rm-8.10 336 normalize_posix_path: src
/test_rm_rf/lev1/lev2
128 165304 [main] rm-8.10 336 normalize_posix_path:
/test_rm_rf/lev1/lev2 = normalize_posix_path (/test_rm_rf/lev1/lev2)
267 165571 [main] rm-8.10 336 mount_info::conv_to_win32_path:
conv_to_win32_path (/test_rm_rf/lev1/lev2)
133 165704 [main] rm-8.10 336 set_flags: flags: binary (0x2)
266 165970 [main] rm-8.10 336 mount_info::conv_to_win32_path:
src_path /test_rm_rf/lev1/lev2, dst J:\FRA\test_rm_rf\lev1\lev2, flags
0x3000A, rc 0
333 166303 [main] rm-8.10 336 symlink_info::check: 0x0 =
NtCreateFile (\??\J:\FRA\test_rm_rf\lev1\lev2)
345 166648 [main] rm-8.10 336 symlink_info::check: not a symlink
402 167050 [main] rm-8.10 336 symlink_info::check: 0 = symlink.check
(J:\FRA\test_rm_rf\lev1\lev2, 0x22B5D0) (0x3000A)
252 167302 [main] rm-8.10 336 path_conv::check:
this->path(J:\FRA\test_rm_rf\lev1\lev2), has_acls(0)
270 167572 [main] rm-8.10 336 build_fh_pc: fh 0x61256C7C, dev 0xC3
3861 171433 [main] rm-8.10 336 rmdir: 0 = rmdir (/test_rm_rf/lev1/lev2)
167 171600 [main] rm-8.10 336 normalize_posix_path: src /test_rm_rf/lev1
229 171829 [main] rm-8.10 336 normalize_posix_path: /test_rm_rf/lev1
= normalize_posix_path (/test_rm_rf/lev1)
398 172227 [main] rm-8.10 336 mount_info::conv_to_win32_path:
conv_to_win32_path (/test_rm_rf/lev1)
399 172626 [main] rm-8.10 336 set_flags: flags: binary (0x2)
133 172759 [main] rm-8.10 336 mount_info::conv_to_win32_path:
src_path /test_rm_rf/lev1, dst J:\FRA\test_rm_rf\lev1, flags 0x3000A, rc 0
318 173077 [main] rm-8.10 336 symlink_info::check: 0x0 =
NtCreateFile (\??\J:\FRA\test_rm_rf\lev1)
227 173304 [main] rm-8.10 336 symlink_info::check: not a symlink
268 173572 [main] rm-8.10 336 symlink_info::check: 0 = symlink.check
(J:\FRA\test_rm_rf\lev1, 0x22B5D0) (0x3000A)
253 173825 [main] rm-8.10 336 path_conv::check:
this->path(J:\FRA\test_rm_rf\lev1), has_acls(0)
535 174360 [main] rm-8.10 336 build_fh_pc: fh 0x61256C7C, dev 0xC3
216 174576 [main] rm-8.10 336 unlink_nt: Opening file for delete
failed, status = 0xC0000043
240 174816 [main] rm-8.10 336 seterrno_from_nt_status:
/netrel/src/cygwin-snapshot-20111017-1/winsup/cygwin/fhandler_disk_file.cc:1735
status 0xC0000043 -> windows error 32
210 175026 [main] rm-8.10 336 geterrno_from_win_error: windows error
32 == errno 16
263 175289 [main] rm-8.10 336 rmdir: -1 = rmdir (/test_rm_rf/lev1)
...
This happens both on XPSP3 (NWFS, Novell Client 4.91SP5IR1) and Win7SP1
(NcFsd, NovellClient2 SP1 IR9a). The strace was done on XP.
Does this ring a bell for anyone? What else can I do to track down the
cause?
It cannot be so simple like rm-8.10 forgetting to close the open FDs of
lev1 before trying to delete it? That was the only thing that jumped to
my eyes while looking at the strace.
Franz Sirl
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple