bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm: cannot remove directory `coreutils-7.3/lib': Directory not empty


From: Jim Meyering
Subject: Re: rm: cannot remove directory `coreutils-7.3/lib': Directory not empty
Date: Tue, 05 May 2009 08:01:20 +0200

Mike Frysinger wrote:
> On Saturday 02 May 2009 20:30:39 binutils wrote:
>> I couldn't remove coreutils-7.3 directory after installation, even if using
>> sudo.
>>
>> bash-4.0$ rm -rf coreutils-7.3/
>> rm: cannot remove directory `coreutils-7.3/lib': Directory not empty
>>
>> bash-4.0$ sudo rm -rf coreutils-7.3/
>> rm: cannot remove directory `coreutils-7.3/lib': Directory not empty
>
> usually this is due to a test which mounts a tmpfs aborting midway and not
> unmounting the tmpfs tree.  run `mount` to see if that's the case, and post
> the output as well so we can see which case misbehaved.
>
> then you should be able to manually run `umount` and then `rm -rf`

If you can reproduce this, please see what is in that coreutils-7.3/lib
directory, e.g., run "find coreutils-7.3/lib"

I would be surprised to find a mount point there, since
no test should mount anything in lib/.
However, I did spot one test that did not invoke umount from a trap.
This fixes it:

>From f3cfa14f04e5d09368208d9e3344b26a1f160901 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 5 May 2009 07:54:47 +0200
Subject: [PATCH] tests: rm/one-file-system: umount more reliably

* tests/rm/one-file-system: Run umount via trap, so it runs
also upon irregular termination.
---
 tests/rm/one-file-system |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/rm/one-file-system b/tests/rm/one-file-system
index 2de7678..c8e11eb 100755
--- a/tests/rm/one-file-system
+++ b/tests/rm/one-file-system
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Demonstrate rm's new --one-file-system option.

-# Copyright (C) 2006-2008 Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,7 +25,11 @@ fi
 require_root_

 # If used, these must *follow* test-lib.sh.
-cleanup_() { rm -rf "$other_partition_tmpdir"; }
+cleanup_()
+{
+  umount "$other_partition_tmpdir"
+  rm -rf "$other_partition_tmpdir"
+}
 . "$abs_srcdir/other-fs-tmpdir"

 t=$other_partition_tmpdir
@@ -41,7 +45,6 @@ fail=0

 rm --one-file-system -rf a 2> out && fail=1
 test -d $t/y || fail=1
-umount $t

 compare out exp || fail=1

--
1.6.3.rc4.190.g4648




reply via email to

[Prev in Thread] Current Thread [Next in Thread]