[Hackage] #303: cabal clean: Error while removing dist/: dist/setup: removeDirectory: unsatisified constraints (Directory not empty)

#303: cabal clean: Error while removing dist/: dist/setup: removeDirectory: unsatisified constraints (Directory not empty) ----------------------------+----------------------------------------------- Reporter: simonmar | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.4.0.1 Severity: normal | Keywords: Difficulty: normal | Ghcversion: 6.8.3 Platform: | ----------------------------+----------------------------------------------- cabal clean has a problem on Windows and Unix with NFS that causes it to fail when using a custom `Setup.hs`. The problem is that we compile `Setup.hs` to `dist/setup/setup`, and then invoke `dist/setup/setup clean` which is supposed to remove the whole of the `dist` tree, including the running binary. This causes problems on Windows where running binaries can't be deleted, and also on NFS where deleting the running binary leaves a `.nfs` file behind, preventing the parent directory from being deleted. {{{
cabal clean -v Creating dist/setup (and its parents) dist/setup/setup clean --verbose=2 --distpref=dist cleaning... Error while removing dist/: dist/setup: removeDirectory: unsatisified constraints (Directory not empty) ls -lr dist total 36 -rw-rw-r-- 1 simonmar GHC 13069 2008-06-23 11:34 setup-config drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:34 setup/ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 build/ ~/darcs/ghc-paths > ls -lra dist total 52 -rw-rw-r-- 1 simonmar GHC 13069 2008-06-23 11:34 setup-config drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:34 setup/ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 build/ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 ../ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:34 ./ ~/darcs/ghc-paths > ls -lRa dist dist: total 52 drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:34 ./ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 ../ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 build/ drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:34 setup/ -rw-rw-r-- 1 simonmar GHC 13069 2008-06-23 11:34 setup-config
dist/build: total 52 drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 ./ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:34 ../ drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:32 autogen/ drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:32 GHC/ -rw-rw-r-- 1 simonmar GHC 3657 2008-06-23 11:32 HSghc-paths-0.1.o -rw-rw-r-- 1 simonmar GHC 4404 2008-06-23 11:32 libHSghc-paths-0.1.a dist/build/autogen: total 24 drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:32 ./ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 ../ -rw------- 1 simonmar GHC 990 2008-06-23 11:32 Paths_ghc_paths.hs dist/build/GHC: total 32 drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:32 ./ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:32 ../ -rw-rw-r-- 1 simonmar GHC 895 2008-06-23 11:32 Paths.hi -rw-rw-r-- 1 simonmar GHC 3824 2008-06-23 11:32 Paths.o dist/setup: total 16 drwxrwxr-x 2 simonmar GHC 4096 2008-06-23 11:34 ./ drwxrwxr-x 4 simonmar GHC 4096 2008-06-23 11:34 ../ }}} -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/303 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#303: cabal clean: Error while removing dist/: dist/setup: removeDirectory: unsatisified constraints (Directory not empty) ----------------------------+----------------------------------------------- Reporter: simonmar | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.4.0.1 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.8.3 | Platform: ----------------------------+----------------------------------------------- Comment (by duncan): The problem here is with custom Setup.hs scripts that might want to do something for clean. A solution would be to be able to ask the Setup.hs to clean anything custom and let the calling tool (ie cabal-install) recursively delete the dist directory. On windows and nfs it's not easy for a program to delete itself and the directory it is running from. On the other hand, this kind of cooperation does not work well with custom build systems. See CustomBuildInterface. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/303#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects
participants (1)
-
Hackage