sync symlink creation/update fails if the symlink points to a nonexistant file
Closed this issue · 5 comments
juliantaylor commented
the sync fails if you have an an environment that has symlink pointing to a not existing file
it fails with:
unTar(): error while creating symlink ...mods-enabled/dbd.load pointing to ../mods-available/dbd.load Error: symlink .../mods-enabled/dbd.load: file exists
g10k 0.8.3
juliantaylor commented
this should do it:
--- a/helper.go
+++ b/helper.go
@@ -84,7 +84,7 @@ func Fatalf(s string) {
// fileExists checks if the given file exists and returns a bool
func fileExists(file string) bool {
//Debugf("checking for file existence " + file)
- if _, err := os.Stat(file); os.IsNotExist(err) {
+ if _, err := os.Lstat(file); os.IsNotExist(err) {
return false
}
return true
xorpaul commented
The great war of the g10k 0.8.x rewrite and symlinks continues...
Thanks for catching that.
juliantaylor commented
though depending on your other code it may be safer to add a new function that explicitly only tests existance and rename the fileExists to fileReadable?
xorpaul commented
juliantaylor commented
thanks it works now