mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Do not modify data structure while building
This will give odd effects if we output the yaml structure into the image. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
760521e197
commit
12439d947d
@ -429,19 +429,20 @@ func filesystem(m Moby, tw *tar.Writer, idMap map[string]uint32) error {
|
|||||||
return fmt.Errorf("Specified Source and Metadata for file: %s", f.Path)
|
return fmt.Errorf("Specified Source and Metadata for file: %s", f.Path)
|
||||||
}
|
}
|
||||||
if f.Source != "" {
|
if f.Source != "" {
|
||||||
if len(f.Source) > 2 && f.Source[:2] == "~/" {
|
source := f.Source
|
||||||
f.Source = homeDir() + f.Source[1:]
|
if len(source) > 2 && source[:2] == "~/" {
|
||||||
|
source = homeDir() + source[1:]
|
||||||
}
|
}
|
||||||
if f.Optional {
|
if f.Optional {
|
||||||
_, err := os.Stat(f.Source)
|
_, err := os.Stat(source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// skip if not found or readable
|
// skip if not found or readable
|
||||||
log.Debugf("Skipping file [%s] as not readable and marked optional", f.Source)
|
log.Debugf("Skipping file [%s] as not readable and marked optional", source)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
contents, err = ioutil.ReadFile(f.Source)
|
contents, err = ioutil.ReadFile(source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user