aura
aura copied to clipboard
Unhandled exception when vcsPath is not (yet) created
Calling aura with C command and -v option to clean vcs cache, fails with unhandled exception when vcspath does not yet exist (/var/cache/aura/vcs by default):
sudo aura -Cv aura: /var/cache/aura/vcs: getDirectoryContents:openDirStream: does not exist (No such file or directory)
Expected behavior: such case would be sanely handled
My quickfix solution folows:
--- aura/exec/Aura/Commands/C.hs.orig 2024-02-17 13:09:14.951184249 +0100
+++ aura/exec/Aura/Commands/C.hs 2024-02-17 12:22:23.817797755 +0100
@@ -200,5 +200,7 @@
cleanDir = do
ss <- asks settings
let !vcsPath = fromMaybe vcsStore . vcsPathOf $ buildConfigOf ss
- notify ss cleanCache_6
- listDirectory vcsPath >>= traverse_ (removeDirectoryRecursive . (</>) vcsPath)
+ isVcs <- doesDirectoryExist vcsPath
+ when isVcs (do
+ notify ss cleanCache_6
+ listDirectory vcsPath >>= traverse_ (removeDirectoryRecursive . (</>) vcsPath))
Thanks for the report. Surely some other process (perhaps package installation involving a VCS package) creates that the directory initially, and -Cv here assumes it exists. I'll look into it.
Note that this isn't an issue in Aura 4, which ensures that all of its support directories exist on startup.
Sorry about the wait on this. Yes, it seems like the path is only created if some -git (etc.) package has been built at least once.
I will be releasing Aura 4 soon. Before I do that, I will make one final release of the Aura 3 series, which will include this fix, in case that's the version you want to keep using. Mind you, Aura 4 has many more new goodies.
Thanks again for your patience.