Windows to Linux build warning to stdout
| ... | ... |
@@ -334,7 +334,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
| 334 | 334 |
// Windows: show error message about modified file permissions if the |
| 335 | 335 |
// daemon isn't running Windows. |
| 336 | 336 |
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
|
| 337 |
- fmt.Fprintln(dockerCli.Err(), `SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`) |
|
| 337 |
+ fmt.Fprintln(dockerCli.Out(), `SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`) |
|
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 | 340 |
// Everything worked so if -q was provided the output from the daemon |
| ... | ... |
@@ -4644,23 +4644,20 @@ func (s *DockerSuite) TestBuildStderr(c *check.C) {
|
| 4644 | 4644 |
// This test just makes sure that no non-error output goes |
| 4645 | 4645 |
// to stderr |
| 4646 | 4646 |
name := "testbuildstderr" |
| 4647 |
- _, _, stderr, err := buildImageWithStdoutStderr(name, |
|
| 4647 |
+ _, stdout, stderr, err := buildImageWithStdoutStderr(name, |
|
| 4648 | 4648 |
"FROM busybox\nRUN echo one", true) |
| 4649 | 4649 |
if err != nil {
|
| 4650 | 4650 |
c.Fatal(err) |
| 4651 | 4651 |
} |
| 4652 | 4652 |
|
| 4653 |
- if runtime.GOOS == "windows" && |
|
| 4654 |
- daemonPlatform != "windows" {
|
|
| 4655 |
- // Windows to non-Windows should have a security warning |
|
| 4656 |
- if !strings.Contains(stderr, "SECURITY WARNING:") {
|
|
| 4657 |
- c.Fatalf("Stderr contains unexpected output: %q", stderr)
|
|
| 4658 |
- } |
|
| 4659 |
- } else {
|
|
| 4660 |
- // Other platform combinations should have no stderr written too |
|
| 4661 |
- if stderr != "" {
|
|
| 4662 |
- c.Fatalf("Stderr should have been empty, instead it's: %q", stderr)
|
|
| 4663 |
- } |
|
| 4653 |
+ // Windows to non-Windows should have a security warning |
|
| 4654 |
+ if runtime.GOOS == "windows" && daemonPlatform != "windows" && !strings.Contains(stdout, "SECURITY WARNING:") {
|
|
| 4655 |
+ c.Fatalf("Stdout contains unexpected output: %q", stdout)
|
|
| 4656 |
+ } |
|
| 4657 |
+ |
|
| 4658 |
+ // Stderr should always be empty |
|
| 4659 |
+ if stderr != "" {
|
|
| 4660 |
+ c.Fatalf("Stderr should have been empty, instead it's: %q", stderr)
|
|
| 4664 | 4661 |
} |
| 4665 | 4662 |
} |
| 4666 | 4663 |
|