Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync symlink creation/update fails if the symlink points to a nonexistant file #150

Closed
juliantaylor opened this issue Sep 26, 2019 · 5 comments
Assignees

Comments

@juliantaylor
Copy link
Contributor

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
Copy link
Contributor Author

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 xorpaul self-assigned this Sep 26, 2019
@xorpaul
Copy link
Owner

xorpaul commented Sep 26, 2019

The great war of the g10k 0.8.x rewrite and symlinks continues...

Thanks for catching that.

@juliantaylor
Copy link
Contributor Author

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 added a commit that referenced this issue Oct 1, 2019
xorpaul added a commit that referenced this issue Oct 1, 2019
@xorpaul
Copy link
Owner

xorpaul commented Oct 1, 2019

@juliantaylor
Copy link
Contributor Author

thanks it works now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants