Merge component 'engine' from git@github.com:docker/engine master

This commit is contained in:
GordonTheTurtle
2018-07-13 17:05:21 +00:00
40 changed files with 152 additions and 250 deletions

View File

@ -90,20 +90,13 @@ func (s *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s
if err := s.opt.GraphDriver.Create(key, parent, nil); err != nil {
return err
}
if err := s.db.Update(func(tx *bolt.Tx) error {
return s.db.Update(func(tx *bolt.Tx) error {
b, err := tx.CreateBucketIfNotExists([]byte(key))
if err != nil {
return err
}
if err := b.Put(keyParent, []byte(origParent)); err != nil {
return err
}
return nil
}); err != nil {
return err
}
return nil
return b.Put(keyParent, []byte(origParent))
})
}
func (s *snapshotter) chainID(key string) (layer.ChainID, bool) {
@ -332,10 +325,7 @@ func (s *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
if err != nil {
return err
}
if err := b.Put(keyCommitted, []byte(key)); err != nil {
return err
}
return nil
return b.Put(keyCommitted, []byte(key))
})
}

View File

@ -219,21 +219,21 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
// Use the global ID if in global mode
id = d.getVMID(id)
title := fmt.Sprintf("lcowdriver: startservicevmifnotrunning %s:", id)
title := "lcowdriver: startServiceVMIfNotRunning " + id
// Attempt to add ID to the service vm map
logrus.Debugf("%s: Adding entry to service vm map", title)
logrus.Debugf("%s: adding entry to service vm map", title)
svm, exists, err := d.serviceVms.add(id)
if err != nil && err == errVMisTerminating {
// VM is in the process of terminating. Wait until it's done and and then try again
logrus.Debugf("%s: VM with current ID still in the process of terminating: %s", title, id)
logrus.Debugf("%s: VM with current ID still in the process of terminating", title)
if err := svm.getStopError(); err != nil {
logrus.Debugf("%s: VM %s did not stop successfully: %s", title, id, err)
logrus.Debugf("%s: VM did not stop successfully: %s", title, err)
return nil, err
}
return d.startServiceVMIfNotRunning(id, mvdToAdd, context)
} else if err != nil {
logrus.Debugf("%s: failed to add service vm to map: %s", err)
logrus.Debugf("%s: failed to add service vm to map: %s", title, err)
return nil, fmt.Errorf("%s: failed to add to service vm map: %s", title, err)
}
@ -248,7 +248,7 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
}
// We are the first service for this id, so we need to start it
logrus.Debugf("%s: service vm doesn't exist. Now starting it up: %s", title, id)
logrus.Debugf("%s: service vm doesn't exist. Now starting it up", title)
defer func() {
// Signal that start has finished, passing in the error if any.
@ -261,7 +261,7 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
// Generate a default configuration
if err := svm.config.GenerateDefault(d.options); err != nil {
return nil, fmt.Errorf("%s failed to generate default gogcs configuration for global svm (%s): %s", title, context, err)
return nil, fmt.Errorf("%s: failed to generate default gogcs configuration for global svm (%s): %s", title, context, err)
}
// For the name, we deliberately suffix if safe-mode to ensure that it doesn't
@ -277,19 +277,19 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
// and not in the process of being created by another thread.
scratchTargetFile := filepath.Join(d.dataRoot, scratchDirectory, fmt.Sprintf("%s.vhdx", id))
logrus.Debugf("%s locking cachedScratchMutex", title)
logrus.Debugf("%s: locking cachedScratchMutex", title)
d.cachedScratchMutex.Lock()
if _, err := os.Stat(d.cachedScratchFile); err == nil {
// Make a copy of cached scratch to the scratch directory
logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) cloning cached scratch for mvd", context)
logrus.Debugf("%s: (%s) cloning cached scratch for mvd", title, context)
if err := client.CopyFile(d.cachedScratchFile, scratchTargetFile, true); err != nil {
logrus.Debugf("%s releasing cachedScratchMutex on err: %s", title, err)
logrus.Debugf("%s: releasing cachedScratchMutex on err: %s", title, err)
d.cachedScratchMutex.Unlock()
return nil, err
}
// Add the cached clone as a mapped virtual disk
logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) adding cloned scratch as mvd", context)
logrus.Debugf("%s: (%s) adding cloned scratch as mvd", title, context)
mvd := hcsshim.MappedVirtualDisk{
HostPath: scratchTargetFile,
ContainerPath: toolsScratchPath,
@ -299,7 +299,7 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
svm.scratchAttached = true
}
logrus.Debugf("%s releasing cachedScratchMutex", title)
logrus.Debugf("%s: releasing cachedScratchMutex", title)
d.cachedScratchMutex.Unlock()
// If requested to start it with a mapped virtual disk, add it now.
@ -309,7 +309,7 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
}
// Start it.
logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) starting %s", context, svm.config.Name)
logrus.Debugf("%s: (%s) starting %s", title, context, svm.config.Name)
if err := svm.config.StartUtilityVM(); err != nil {
return nil, fmt.Errorf("failed to start service utility VM (%s): %s", context, err)
}
@ -317,31 +317,31 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
// defer function to terminate the VM if the next steps fail
defer func() {
if err != nil {
waitTerminate(svm, fmt.Sprintf("startServiceVmIfNotRunning: %s (%s)", id, context))
waitTerminate(svm, fmt.Sprintf("%s: (%s)", title, context))
}
}()
// Now we have a running service VM, we can create the cached scratch file if it doesn't exist.
logrus.Debugf("%s locking cachedScratchMutex", title)
logrus.Debugf("%s: locking cachedScratchMutex", title)
d.cachedScratchMutex.Lock()
if _, err := os.Stat(d.cachedScratchFile); err != nil {
logrus.Debugf("%s (%s): creating an SVM scratch", title, context)
logrus.Debugf("%s: (%s) creating an SVM scratch", title, context)
// Don't use svm.CreateExt4Vhdx since that only works when the service vm is setup,
// but we're still in that process right now.
if err := svm.config.CreateExt4Vhdx(scratchTargetFile, client.DefaultVhdxSizeGB, d.cachedScratchFile); err != nil {
logrus.Debugf("%s (%s): releasing cachedScratchMutex on error path", title, context)
logrus.Debugf("%s: (%s) releasing cachedScratchMutex on error path", title, context)
d.cachedScratchMutex.Unlock()
logrus.Debugf("%s: failed to create vm scratch %s: %s", title, scratchTargetFile, err)
return nil, fmt.Errorf("failed to create SVM scratch VHDX (%s): %s", context, err)
}
}
logrus.Debugf("%s (%s): releasing cachedScratchMutex", title, context)
logrus.Debugf("%s: (%s) releasing cachedScratchMutex", title, context)
d.cachedScratchMutex.Unlock()
// Hot-add the scratch-space if not already attached
if !svm.scratchAttached {
logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) hot-adding scratch %s", context, scratchTargetFile)
logrus.Debugf("%s: (%s) hot-adding scratch %s", title, context, scratchTargetFile)
if err := svm.hotAddVHDsAtStart(hcsshim.MappedVirtualDisk{
HostPath: scratchTargetFile,
ContainerPath: toolsScratchPath,
@ -353,7 +353,7 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
svm.scratchAttached = true
}
logrus.Debugf("lcowdriver: startServiceVmIfNotRunning: (%s) success", context)
logrus.Debugf("%s: (%s) success", title, context)
return svm, nil
}

View File

@ -1265,6 +1265,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) {
c.Assert(waitRun(id), checker.IsNil)
source, err := inspectMountSourceField(id, vol)
c.Assert(err, checker.IsNil)
_, err = os.Stat(source)
c.Assert(err, checker.IsNil)
@ -2201,6 +2202,7 @@ func (s *DockerSuite) TestContainerKillCustomStopSignal(c *check.C) {
defer res.Body.Close()
b, err := ioutil.ReadAll(res.Body)
c.Assert(err, checker.IsNil)
c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent, check.Commentf(string(b)))
err = waitInspect(id, "{{.State.Running}} {{.State.Restarting}}", "false false", 30*time.Second)
c.Assert(err, checker.IsNil)

View File

@ -1012,10 +1012,6 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
ADD foo.txt /x/`
targetFile = "foo.txt"
)
var (
name = "test-link-absolute-volume"
dockerfile = ""
)
tempDir, err := ioutil.TempDir("", "test-link-absolute-volume-temp-")
if err != nil {
@ -1023,7 +1019,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
}
defer os.RemoveAll(tempDir)
dockerfile = fmt.Sprintf(dockerfileTemplate, tempDir)
dockerfile := fmt.Sprintf(dockerfileTemplate, tempDir)
nonExistingFile := filepath.Join(tempDir, targetFile)
ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(dockerfile))
@ -1040,7 +1036,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
c.Fatal(err)
}
buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx))
buildImageSuccessfully(c, "test-link-absolute-volume", build.WithExternalBuildContext(ctx))
if _, err := os.Stat(nonExistingFile); err == nil || err != nil && !os.IsNotExist(err) {
c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
}

View File

@ -46,8 +46,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
cleanedContainerID := strings.TrimSpace(out)
dockerCmd(c, "pause", cleanedContainerID)
out, _ = dockerCmd(c, "commit", cleanedContainerID)
dockerCmd(c, "commit", cleanedContainerID)
out = inspectField(c, cleanedContainerID, "State.Paused")
// commit should not unpause a paused container

View File

@ -78,6 +78,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
c.Assert(out, checker.Contains, fake)
out, err = d.Cmd("config", "rm", id)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, id)
// Fake one will remain
@ -93,6 +94,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
// - Full Name
// - Partial ID (prefix)
out, err = d.Cmd("config", "rm", id[:5])
c.Assert(err, checker.Not(checker.IsNil))
c.Assert(out, checker.Not(checker.Contains), id)
out, err = d.Cmd("config", "ls")
c.Assert(err, checker.IsNil)
@ -101,6 +103,7 @@ func (s *DockerSwarmSuite) TestConfigCreateResolve(c *check.C) {
// Remove based on ID prefix of the fake one should succeed
out, err = d.Cmd("config", "rm", fake[:5])
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fake[:5])
out, err = d.Cmd("config", "ls")
c.Assert(err, checker.IsNil)

View File

@ -423,6 +423,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
expected := readContainerFile(c, containerID, "resolv.conf")
actual, err := ioutil.ReadFile(outDir + "/resolv.conf")
c.Assert(err, checker.IsNil)
// Expected copied file to be duplicate of the container resolvconf
c.Assert(bytes.Equal(actual, expected), checker.True)
@ -432,6 +433,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
expected = readContainerFile(c, containerID, "hosts")
actual, err = ioutil.ReadFile(outDir + "/hosts")
c.Assert(err, checker.IsNil)
// Expected copied file to be duplicate of the container hosts
c.Assert(bytes.Equal(actual, expected), checker.True)
@ -639,6 +641,7 @@ func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
expected := []byte(cpContainerContents)
actual, err := ioutil.ReadFile(expectedPath)
c.Assert(err, checker.IsNil)
if !bytes.Equal(actual, expected) {
c.Fatalf("Expected copied file to be duplicate of the container symbol link target")

View File

@ -448,10 +448,10 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) {
s.d.StartWithBusybox(c, "--ipv6", "--fixed-cidr-v6=2001:db8:1::/64")
out, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
_, err := s.d.Cmd("run", "-itd", "--name=ipv6test", "--mac-address", "AA:BB:CC:DD:EE:FF", "busybox")
c.Assert(err, checker.IsNil)
out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
out, err := s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.GlobalIPv6Address}}", "ipv6test")
c.Assert(err, checker.IsNil)
c.Assert(strings.Trim(out, " \r\n'"), checker.Equals, "2001:db8:1::aabb:ccdd:eeff")
}
@ -742,6 +742,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) {
defer d.Cmd("stop", "bb")
out, err = d.Cmd("exec", "bb", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
c.Assert(err, check.IsNil)
c.Assert(out, checker.Equals, "10.2.2.0\n")
out, err = d.Cmd("run", "--rm", "busybox", "/bin/sh", "-c", "ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'")
@ -1944,11 +1945,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) {
test2ID := strings.TrimSpace(out)
out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top")
c.Assert(err, check.IsNil)
test3ID := strings.TrimSpace(out)
s.d.Restart(c)
out, err = s.d.Cmd("create", "--name=test", "busybox")
_, err = s.d.Cmd("create", "--name=test", "busybox")
c.Assert(err, check.NotNil, check.Commentf("expected error trying to create container with duplicate name"))
// this one is no longer needed, removing simplifies the remainder of the test
out, err = s.d.Cmd("rm", "-f", "test")
@ -2615,6 +2617,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C)
c.Assert(err, checker.IsNil, check.Commentf("run top2: %v", out))
out, err = s.d.Cmd("ps")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "top1", check.Commentf("top1 should be running"))
c.Assert(out, checker.Contains, "top2", check.Commentf("top2 should be running"))
@ -2639,11 +2642,11 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
// captured, so `.State.Error` is empty.
// See the discussion on https://github.com/docker/docker/pull/30227#issuecomment-274161426,
// and https://github.com/docker/docker/pull/26061#r78054578 for more information.
out, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto")
_, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto")
c.Assert(err, checker.NotNil)
// Check that those values were saved on disk
out, err = s.d.Cmd("inspect", "-f", "{{.State.ExitCode}}", containerName)
out, err := s.d.Cmd("inspect", "-f", "{{.State.ExitCode}}", containerName)
out = strings.TrimSpace(out)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Equals, "127")

View File

@ -81,7 +81,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
dockerCmd(c, "rm", "-f", name)
// Disable the check from the CLI
out, _ = dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName)
dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName)
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "noh")
c.Check(out, checker.Equals, "[NONE]\n")
dockerCmd(c, "rm", "noh")

View File

@ -181,14 +181,14 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
// TODO Windows TP5 - Figure out why this test is so flakey. Disabled for now.
testRequires(c, DaemonIsLinux)
name := "testlogssincefuturefollow"
out, _ := dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do echo log$i; sleep 1; done`)
dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do echo log$i; sleep 1; done`)
// Extract one timestamp from the log file to give us a starting point for
// our `--since` argument. Because the log producer runs in the background,
// we need to check repeatedly for some output to be produced.
var timestamp string
for i := 0; i != 100 && timestamp == ""; i++ {
if out, _ = dockerCmd(c, "logs", "-t", name); out == "" {
if out, _ := dockerCmd(c, "logs", "-t", name); out == "" {
time.Sleep(time.Millisecond * 100) // Retry
} else {
timestamp = strings.Split(strings.Split(out, "\n")[0], " ")[0]
@ -200,7 +200,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
c.Assert(err, check.IsNil)
since := t.Unix() + 2
out, _ = dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
out, _ := dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
c.Assert(out, checker.Not(checker.HasLen), 0, check.Commentf("cannot read from empty log"))
lines := strings.Split(strings.TrimSpace(out), "\n")
for _, v := range lines {

View File

@ -348,7 +348,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) {
out, _ = dockerCmd(c, "network", "ls", "-f", "type=custom", "-f", "type=builtin")
assertNwList(c, out, []string{"bridge", "dev", "host", "none"})
out, _ = dockerCmd(c, "network", "create", "--label", testLabel+"="+testValue, testNet)
dockerCmd(c, "network", "create", "--label", testLabel+"="+testValue, testNet)
assertNwIsAvailable(c, testNet)
out, _ = dockerCmd(c, "network", "ls", "-f", "label="+testLabel)
@ -880,8 +880,6 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
out, _ = dockerCmd(c, "run", "-d", "--net", cstmBridgeNw, "busybox", "top")
cid2 := strings.TrimSpace(out)
hosts2 := readContainerFileWithExec(c, cid2, hostsFile)
// verify first container etc/hosts file has not changed
hosts1post := readContainerFileWithExec(c, cid1, hostsFile)
c.Assert(string(hosts1), checker.Equals, string(hosts1post),
@ -894,7 +892,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
dockerCmd(c, "network", "connect", cstmBridgeNw1, cid2)
hosts2 = readContainerFileWithExec(c, cid2, hostsFile)
hosts2 := readContainerFileWithExec(c, cid2, hostsFile)
hosts1post = readContainerFileWithExec(c, cid1, hostsFile)
c.Assert(string(hosts1), checker.Equals, string(hosts1post),
check.Commentf("Unexpected %s change on container connect", hostsFile))

View File

@ -62,10 +62,10 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) {
pNameWithTag := ps.getPluginRepoWithTag()
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
c.Assert(err, checker.IsNil)
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
out, _, _ := dockerCmdWithError("plugin", "remove", pNameWithTag)
c.Assert(out, checker.Contains, "is enabled")
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
@ -82,7 +82,7 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
_, _, err = dockerCmdWithError("volume", "create", "-d", pNameWithTag, "--name", "testvol1")
c.Assert(err, checker.IsNil)
out, _, err := dockerCmdWithError("plugin", "disable", pNameWithTag)
out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
c.Assert(out, checker.Contains, "in use")
_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
@ -98,21 +98,21 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
testRequires(c, DaemonIsLinux, IsAmd64, Network)
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
c.Assert(err, checker.IsNil)
out, _, err = dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
out, _, err := dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
c.Assert(err, checker.IsNil)
nID := strings.TrimSpace(out)
out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
c.Assert(out, checker.Contains, "is in use")
_, _, err = dockerCmdWithError("network", "rm", nID)
c.Assert(err, checker.IsNil)
out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
c.Assert(out, checker.Contains, "is enabled")
_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
@ -400,7 +400,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
c.Assert(out, checker.Contains, "false")
// Remove
out, _, err = dockerCmdWithError("plugin", "remove", id[:5])
_, _, err = dockerCmdWithError("plugin", "remove", id[:5])
c.Assert(err, checker.IsNil)
// List returns none
out, _, err = dockerCmdWithError("plugin", "ls")

View File

@ -792,19 +792,14 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
}
func (s *DockerSuite) TestPsByOrder(c *check.C) {
name1 := "xyz-abc"
out := runSleepingContainer(c, "--name", name1)
out := runSleepingContainer(c, "--name", "xyz-abc")
container1 := strings.TrimSpace(out)
name2 := "xyz-123"
out = runSleepingContainer(c, "--name", name2)
out = runSleepingContainer(c, "--name", "xyz-123")
container2 := strings.TrimSpace(out)
name3 := "789-abc"
out = runSleepingContainer(c, "--name", name3)
name4 := "789-123"
out = runSleepingContainer(c, "--name", name4)
runSleepingContainer(c, "--name", "789-abc")
runSleepingContainer(c, "--name", "789-123")
// Run multiple time should have the same result
out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined()

View File

@ -224,6 +224,7 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) {
c.Assert(err, check.IsNil)
err = waitInspect("second", "{{.State.Status}}", "running", 5*time.Second)
c.Assert(err, check.IsNil)
// ping to first and its alias foo must still succeed
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")

View File

@ -623,6 +623,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
// Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...)
testRequires(c, DaemonIsLinux)
workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink")
c.Assert(err, checker.IsNil)
image := "docker-test-createvolumewithsymlink"
buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-")

View File

@ -39,6 +39,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
c.Assert(out, checker.Contains, fake)
out, err = d.Cmd("secret", "rm", id)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, id)
// Fake one will remain
@ -54,6 +55,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
// - Full Name
// - Partial ID (prefix)
out, err = d.Cmd("secret", "rm", id[:5])
c.Assert(err, checker.Not(checker.IsNil))
c.Assert(out, checker.Not(checker.Contains), id)
out, err = d.Cmd("secret", "ls")
c.Assert(err, checker.IsNil)
@ -62,6 +64,7 @@ func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
// Remove based on ID prefix of the fake one should succeed
out, err = d.Cmd("secret", "rm", fake[:5])
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fake[:5])
out, err = d.Cmd("secret", "ls")
c.Assert(err, checker.IsNil)

View File

@ -21,16 +21,16 @@ func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
service2Args := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", service2Name, "--mode=global", defaultSleepImage}, sleepCommandForDaemonPlatform()...)
// Create services
out, err := d.Cmd(service1Args...)
_, err := d.Cmd(service1Args...)
c.Assert(err, checker.IsNil)
out, err = d.Cmd(service2Args...)
_, err = d.Cmd(service2Args...)
c.Assert(err, checker.IsNil)
out, err = d.Cmd("service", "scale", "TestService1=2")
_, err = d.Cmd("service", "scale", "TestService1=2")
c.Assert(err, checker.IsNil)
out, err = d.Cmd("service", "scale", "TestService1=foobar")
out, err := d.Cmd("service", "scale", "TestService1=foobar")
c.Assert(err, checker.NotNil)
str := fmt.Sprintf("%s: invalid replicas value %s", service1Name, "foobar")

View File

@ -279,13 +279,13 @@ func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
_, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
c.Assert(err, checker.IsNil)
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
_, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
c.Assert(err, checker.IsNil)
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
_, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
c.Assert(err, checker.NotNil)
out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.EndpointSpec.Ports }}", name)
@ -841,14 +841,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
// Without --tty
expectedOutput := "none"
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", ttyCheck)
_, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", ttyCheck)
c.Assert(err, checker.IsNil)
// Make sure task has been deployed.
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
// We need to get the container id.
out, err = d.Cmd("ps", "-q", "--no-trunc")
out, err := d.Cmd("ps", "-q", "--no-trunc")
c.Assert(err, checker.IsNil)
id := strings.TrimSpace(out)
@ -857,14 +857,14 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) {
c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
// Remove service
out, err = d.Cmd("service", "rm", name)
_, err = d.Cmd("service", "rm", name)
c.Assert(err, checker.IsNil)
// Make sure container has been destroyed.
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 0)
// With --tty
expectedOutput = "TTY"
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--tty", "busybox", "sh", "-c", ttyCheck)
_, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "--tty", "busybox", "sh", "-c", ttyCheck)
c.Assert(err, checker.IsNil)
// Make sure task has been deployed.
@ -1069,6 +1069,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) {
c.Assert(unlockKey, checker.Not(checker.Equals), "")
outs, err = d.Cmd("swarm", "unlock-key", "-q")
c.Assert(err, checker.IsNil)
c.Assert(outs, checker.Equals, unlockKey+"\n")
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
@ -1168,6 +1169,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) {
c.Assert(unlockKey, checker.Not(checker.Equals), "")
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
c.Assert(err, checker.IsNil)
c.Assert(outs, checker.Equals, unlockKey+"\n")
// The ones that got the cluster update should be set to locked
@ -1234,6 +1236,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) {
c.Assert(unlockKey, checker.Not(checker.Equals), "")
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
c.Assert(err, checker.IsNil)
c.Assert(outs, checker.Equals, unlockKey+"\n")
// joined workers start off unlocked
@ -1306,6 +1309,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
c.Assert(unlockKey, checker.Not(checker.Equals), "")
outs, err = d.Cmd("swarm", "unlock-key", "-q")
c.Assert(err, checker.IsNil)
c.Assert(outs, checker.Equals, unlockKey+"\n")
// Rotate multiple times
@ -1390,6 +1394,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
c.Assert(unlockKey, checker.Not(checker.Equals), "")
outs, err = d1.Cmd("swarm", "unlock-key", "-q")
c.Assert(err, checker.IsNil)
c.Assert(outs, checker.Equals, unlockKey+"\n")
// Rotate multiple times

View File

@ -26,6 +26,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
// create a dummy volume to trigger lazy loading of the plugin
out, err = d.Cmd("volume", "create", "-d", "customvolumedriver", "hello")
c.Assert(err, checker.IsNil, check.Commentf(out))
// TODO(aaronl): It will take about 15 seconds for swarm to realize the
// plugin was loaded. Switching the test over to plugin v2 would avoid

View File

@ -324,7 +324,7 @@ func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) {
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "Conflicting options: CPU Quota cannot be updated as NanoCPUs has already been set")
out, _ = dockerCmd(c, "update", "--cpus", "0.8", "top")
dockerCmd(c, "update", "--cpus", "0.8", "top")
inspect, err = clt.ContainerInspect(context.Background(), "top")
c.Assert(err, checker.IsNil)
c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(800000000))

View File

@ -61,12 +61,12 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("Could not inspect running container: out: %q", pid))
// check the uid and gid maps for the PID to ensure root is remapped
// (cmd = cat /proc/<pid>/uid_map | grep -E '0\s+9999\s+1')
out, err = RunCommandPipelineWithOutput(
_, err = RunCommandPipelineWithOutput(
exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/uid_map"),
exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", uid)))
c.Assert(err, check.IsNil)
out, err = RunCommandPipelineWithOutput(
_, err = RunCommandPipelineWithOutput(
exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/gid_map"),
exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", gid)))
c.Assert(err, check.IsNil)

View File

@ -300,10 +300,10 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) {
testLabel := "foo"
testValue := "bar"
out, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol)
_, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol)
c.Assert(err, check.IsNil)
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
c.Assert(strings.TrimSpace(out), check.Equals, testValue)
}
@ -325,25 +325,25 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
args = append(args, "--label", k+"="+v)
}
out, _, err := dockerCmdWithError(args...)
_, _, err := dockerCmdWithError(args...)
c.Assert(err, check.IsNil)
for k, v := range testLabels {
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
c.Assert(strings.TrimSpace(out), check.Equals, v)
}
}
func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
testVol1 := "testvolcreatelabel-1"
out, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
_, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
c.Assert(err, check.IsNil)
testVol2 := "testvolcreatelabel-2"
out, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2)
_, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2)
c.Assert(err, check.IsNil)
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo")
out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo")
// filter with label=key
c.Assert(out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
@ -367,15 +367,15 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) {
// using default volume driver local to create volumes
testVol1 := "testvol-1"
out, _, err := dockerCmdWithError("volume", "create", testVol1)
_, _, err := dockerCmdWithError("volume", "create", testVol1)
c.Assert(err, check.IsNil)
testVol2 := "testvol-2"
out, _, err = dockerCmdWithError("volume", "create", testVol2)
_, _, err = dockerCmdWithError("volume", "create", testVol2)
c.Assert(err, check.IsNil)
// filter with driver=local
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=local")
out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local")
c.Assert(out, checker.Contains, "testvol-1\n", check.Commentf("expected volume 'testvol-1' in output"))
c.Assert(out, checker.Contains, "testvol-2\n", check.Commentf("expected volume 'testvol-2' in output"))
@ -434,7 +434,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
c.Assert(id, checker.Equals, name)
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
out, e := dockerCmd(c, "create", "-v", "testvolume:"+prefix+slash+"foo", "busybox")
out, _ = dockerCmd(c, "create", "-v", "testvolume:"+prefix+slash+"foo", "busybox")
cid := strings.TrimSpace(out)
_, _, err := dockerCmdWithError("volume", "rm", "-f", name)
@ -454,7 +454,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
c.Assert(out, checker.Contains, name)
// Verify removing the volume after the container is removed works
_, e = dockerCmd(c, "rm", cid)
_, e := dockerCmd(c, "rm", cid)
c.Assert(e, check.Equals, 0)
_, e = dockerCmd(c, "volume", "rm", "-f", name)

View File

@ -21,6 +21,7 @@ type TestContainerConfig struct {
}
// Create creates a container with the specified options
// nolint: golint
func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
t.Helper()
config := &TestContainerConfig{
@ -43,6 +44,7 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f
}
// Run creates and start a container with the specified options
// nolint: golint
func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
t.Helper()
id := Create(t, ctx, client, ops...)

View File

@ -26,6 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu
}
// CreateNoError creates a network with the specified options and verifies there were no errors
// nolint: golint
func CreateNoError(t *testing.T, ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
t.Helper()

View File

@ -437,6 +437,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
testGraphDriver(t, client, ctx, plugin, nil)
}
// nolint: golint
func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))

View File

@ -116,7 +116,7 @@ google.golang.org/genproto 694d95ba50e67b2e363f3483057db5d4910c18f9
# containerd
github.com/containerd/containerd b41633746ed4833f52c3c071e8edcfa2713e5677
github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b
github.com/containerd/continuity 0377f7d767206f3a9e8881d0f02267b0d89c7a62
github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130
github.com/containerd/console 5d1b48d6114b8c9666f0c8b916f871af97b0a761
github.com/containerd/go-runc f271fa2021de855d4d918dbef83c5fe19db1bdd

View File

@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"sort"
"github.com/containerd/continuity/devices"
@ -26,18 +25,6 @@ func (d *driver) Mkfifo(path string, mode os.FileMode) error {
return devices.Mknod(path, mode, 0, 0)
}
// Lchmod changes the mode of an file not following symlinks.
func (d *driver) Lchmod(path string, mode os.FileMode) (err error) {
if !filepath.IsAbs(path) {
path, err = filepath.Abs(path)
if err != nil {
return
}
}
return sysx.Fchmodat(0, path, uint32(mode), sysx.AtSymlinkNofollow)
}
// Getxattr returns all of the extended attributes for the file at path p.
func (d *driver) Getxattr(p string) (map[string][]byte, error) {
xattrs, err := sysx.Listxattr(p)

View File

@ -0,0 +1,19 @@
package driver
import (
"os"
"golang.org/x/sys/unix"
)
// Lchmod changes the mode of a file not following symlinks.
func (d *driver) Lchmod(path string, mode os.FileMode) error {
// On Linux, file mode is not supported for symlinks,
// and fchmodat() does not support AT_SYMLINK_NOFOLLOW,
// so symlinks need to be skipped entirely.
if st, err := os.Stat(path); err == nil && st.Mode()&os.ModeSymlink != 0 {
return nil
}
return unix.Fchmodat(unix.AT_FDCWD, path, uint32(mode), 0)
}

View File

@ -0,0 +1,14 @@
// +build darwin freebsd solaris
package driver
import (
"os"
"golang.org/x/sys/unix"
)
// Lchmod changes the mode of a file not following symlinks.
func (d *driver) Lchmod(path string, mode os.FileMode) error {
return unix.Fchmodat(unix.AT_FDCWD, path, uint32(mode), unix.AT_SYMLINK_NOFOLLOW)
}

View File

@ -10,8 +10,8 @@ type Usage struct {
// DiskUsage counts the number of inodes and disk usage for the resources under
// path.
func DiskUsage(roots ...string) (Usage, error) {
return diskUsage(roots...)
func DiskUsage(ctx context.Context, roots ...string) (Usage, error) {
return diskUsage(ctx, roots...)
}
// DiffUsage counts the numbers of inodes and disk usage in the

View File

@ -24,7 +24,7 @@ func newInode(stat *syscall.Stat_t) inode {
}
}
func diskUsage(roots ...string) (Usage, error) {
func diskUsage(ctx context.Context, roots ...string) (Usage, error) {
var (
size int64
@ -37,6 +37,12 @@ func diskUsage(roots ...string) (Usage, error) {
return err
}
select {
case <-ctx.Done():
return ctx.Err()
default:
}
inoKey := newInode(fi.Sys().(*syscall.Stat_t))
if _, ok := inodes[inoKey]; !ok {
inodes[inoKey] = struct{}{}

View File

@ -8,7 +8,7 @@ import (
"path/filepath"
)
func diskUsage(roots ...string) (Usage, error) {
func diskUsage(ctx context.Context, roots ...string) (Usage, error) {
var (
size int64
)
@ -21,6 +21,12 @@ func diskUsage(roots ...string) (Usage, error) {
return err
}
select {
case <-ctx.Done():
return ctx.Err()
default:
}
size += fi.Size()
return nil
}); err != nil {

View File

@ -1,18 +0,0 @@
package sysx
const (
// AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in <sys/fcntl.h>
AtSymlinkNofollow = 0x20
)
const (
// SYS_FCHMODAT defined from golang.org/sys/unix
SYS_FCHMODAT = 467
)
// These functions will be generated by generate.sh
// $ GOOS=darwin GOARCH=386 ./generate.sh chmod
// $ GOOS=darwin GOARCH=amd64 ./generate.sh chmod
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)

View File

@ -1,25 +0,0 @@
// mksyscall.pl -l32 chmod_darwin.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package sysx
import (
"syscall"
"unsafe"
)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = syscall.BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}

View File

@ -1,25 +0,0 @@
// mksyscall.pl chmod_darwin.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package sysx
import (
"syscall"
"unsafe"
)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = syscall.BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}

View File

@ -1,17 +0,0 @@
package sysx
const (
// AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in <sys/fcntl.h>
AtSymlinkNofollow = 0x200
)
const (
// SYS_FCHMODAT defined from golang.org/sys/unix
SYS_FCHMODAT = 490
)
// These functions will be generated by generate.sh
// $ GOOS=freebsd GOARCH=amd64 ./generate.sh chmod
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)

View File

@ -1,25 +0,0 @@
// mksyscall.pl chmod_freebsd.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package sysx
import (
"syscall"
"unsafe"
)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = syscall.BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}

View File

@ -1,12 +0,0 @@
package sysx
import "syscall"
const (
// AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in /usr/include/linux/fcntl.h
AtSymlinkNofollow = 0x100
)
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
return syscall.Fchmodat(dirfd, path, mode, flags)
}

View File

@ -1,11 +0,0 @@
package sysx
import "golang.org/x/sys/unix"
const (
AtSymlinkNofollow = unix.AT_SYMLINK_NOFOLLOW
)
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
return unix.Fchmodat(dirfd, path, mode, flags)
}

View File

@ -8,7 +8,6 @@ package sysx
//sys setxattr(path string, attr string, data []byte, flags int) (err error)
//sys removexattr(path string, attr string, options int) (err error)
//sys listxattr(path string, dest []byte, options int) (sz int, err error)
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
const (
xattrNoFollow = 0x01