Browse code

LCOW: Write saved manifest.json in Unix paths

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2018/03/15 02:00:15
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@ import (
6 6
 	"io"
7 7
 	"io/ioutil"
8 8
 	"os"
9
+	"path"
9 10
 	"path/filepath"
10 11
 	"runtime"
11 12
 	"time"
... ...
@@ -219,7 +220,11 @@ func (s *saveSession) save(outStream io.Writer) error {
219 219
 		}
220 220
 
221 221
 		for _, l := range imageDescr.layers {
222
-			layers = append(layers, filepath.Join(l, legacyLayerFileName))
222
+			// IMPORTANT: We use path, not filepath here to ensure the layers
223
+			// in the manifest use Unix-style forward-slashes. Otherwise, a
224
+			// Linux image saved from LCOW won't be able to be imported on
225
+			// LCOL.
226
+			layers = append(layers, path.Join(l, legacyLayerFileName))
223 227
 		}
224 228
 
225 229
 		manifest = append(manifest, manifestItem{