From 4474d200b0a639f54966496b57f280bb7240343e Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sat, 28 Nov 2015 20:23:08 +0000 Subject: [PATCH] Fix symlinks (fixes #2524) --- lib/model/sharedpullerstate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/model/sharedpullerstate.go b/lib/model/sharedpullerstate.go index 99fadcf55..509b1fcfd 100644 --- a/lib/model/sharedpullerstate.go +++ b/lib/model/sharedpullerstate.go @@ -139,7 +139,9 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) { return nil, err } - if s.sparse { + // Don't truncate symlink files, as that will mean that the path will + // contain a bunch of nulls. + if s.sparse && !s.file.IsSymlink() { // Truncate sets the size of the file. This creates a sparse file or a // space reservation, depending on the underlying filesystem. if err := fd.Truncate(s.file.Size()); err != nil {