Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package nerdctl for openSUSE:Factory checked 
in at 2023-04-28 16:24:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nerdctl (Old)
 and      /work/SRC/openSUSE:Factory/.nerdctl.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nerdctl"

Fri Apr 28 16:24:16 2023 rev:6 rq:1083472 version:1.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/nerdctl/nerdctl.changes  2023-04-20 
15:15:33.530303508 +0200
+++ /work/SRC/openSUSE:Factory/.nerdctl.new.1533/nerdctl.changes        
2023-04-28 16:25:27.326741164 +0200
@@ -1,0 +2,23 @@
+Thu Apr 20 13:01:57 UTC 2023 - [email protected]
+
+- Update to version 1.3.1:
+  * update kubo (0.19.1)
+  * update nydus (2.2.0)
+  * go.mod: fix format
+  * test: add test for piping of `nerdctl run` with `-t`
+  * build(deps): bump actions/checkout from 3.5.1 to 3.5.2
+  * cmd/image/list: Fix typo breaking --no-trunc
+  * Resolve Go cache warnings in CI workflows
+  * Use pushRef instead of ref to build signPef
+  * Add destination ports from iptables to used ports while allocating host 
ports
+  * build(deps): bump actions/checkout from 3.5.0 to 3.5.1
+  * build(deps): bump github.com/containerd/accelerated-container-image
+  * run: make tty output behaviour compatible to docker and `nerdctl exec`
+  * build(deps): bump github.com/Masterminds/semver/v3 from 3.2.0 to 3.2.1
+  * build(deps): bump golang.org/x/crypto from 0.7.0 to 0.8.0
+  * build(deps): bump golang.org/x/net from 0.8.0 to 0.9.0
+  * build(deps): bump golang.org/x/text from 0.8.0 to 0.9.0
+  * build(deps): bump github.com/klauspost/compress from 1.16.3 to 1.16.4
+  * compose: implement Bind.CreateHostPath
+
+-------------------------------------------------------------------

Old:
----
  nerdctl-1.3.0.tar.xz

New:
----
  nerdctl-1.3.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nerdctl.spec ++++++
--- /var/tmp/diff_new_pack.kSSO5u/_old  2023-04-28 16:25:33.878779408 +0200
+++ /var/tmp/diff_new_pack.kSSO5u/_new  2023-04-28 16:25:33.882779431 +0200
@@ -24,7 +24,7 @@
 %global import_path     %{provider_prefix}
 
 Name:           nerdctl
-Version:        1.3.0
+Version:        1.3.1
 Release:        0
 Summary:        Docker-compatible CLI for containerd
 License:        Apache-2.0

++++++ _service ++++++
--- /var/tmp/diff_new_pack.kSSO5u/_old  2023-04-28 16:25:33.922779665 +0200
+++ /var/tmp/diff_new_pack.kSSO5u/_new  2023-04-28 16:25:33.930779711 +0200
@@ -2,7 +2,7 @@
   <service name="tar_scm" mode="disabled">
     <param name="url">https://github.com/containerd/nerdctl.git</param>
     <param name="scm">git</param>
-    <param name="revision">v1.3.0</param>
+    <param name="revision">v1.3.1</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.kSSO5u/_old  2023-04-28 16:25:33.950779828 +0200
+++ /var/tmp/diff_new_pack.kSSO5u/_new  2023-04-28 16:25:33.954779852 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/containerd/nerdctl.git</param>
-              <param 
name="changesrevision">c6ddd63dea9aa438fdb0587c0d3d9ae61a60523e</param></service></servicedata>
+              <param 
name="changesrevision">b224b280ff3086516763c7335fc0e0997aca617a</param></service></servicedata>
 (No newline at EOF)
 

++++++ nerdctl-1.3.0.tar.xz -> nerdctl-1.3.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/nerdctl-1.3.0/.github/workflows/ghcr-image-build-and-publish.yml 
new/nerdctl-1.3.1/.github/workflows/ghcr-image-build-and-publish.yml
--- old/nerdctl-1.3.0/.github/workflows/ghcr-image-build-and-publish.yml        
2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/.github/workflows/ghcr-image-build-and-publish.yml        
2023-04-14 06:21:43.000000000 +0200
@@ -30,7 +30,7 @@
 
     steps:
       - name: Checkout repository
-        uses: actions/[email protected]
+        uses: actions/[email protected]
 
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/.github/workflows/release.yml 
new/nerdctl-1.3.1/.github/workflows/release.yml
--- old/nerdctl-1.3.0/.github/workflows/release.yml     2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/.github/workflows/release.yml     2023-04-14 
06:21:43.000000000 +0200
@@ -12,10 +12,10 @@
     runs-on: ubuntu-22.04
     timeout-minutes: 40
     steps:
+    - uses: actions/[email protected]
     - uses: actions/setup-go@v4
       with:
         go-version: 1.20.x
-    - uses: actions/[email protected]
     - name: "Compile binaries"
       run: make artifacts
     - name: "SHA256SUMS"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/.github/workflows/test.yml 
new/nerdctl-1.3.1/.github/workflows/test.yml
--- old/nerdctl-1.3.0/.github/workflows/test.yml        2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/.github/workflows/test.yml        2023-04-14 
06:21:43.000000000 +0200
@@ -16,13 +16,14 @@
     runs-on: ubuntu-22.04
     timeout-minutes: 20
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           path: src/github.com/containerd/nerdctl
           fetch-depth: 100
       - uses: actions/setup-go@v4
         with:
           go-version: ${{ env.GO_VERSION }}
+          cache-dependency-path: src/github.com/containerd/nerdctl
       - uses: containerd/[email protected]
         with:
           working-directory: src/github.com/containerd/nerdctl
@@ -36,7 +37,7 @@
     runs-on: ubuntu-22.04
     timeout-minutes: 20
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - uses: actions/setup-go@v4
@@ -56,7 +57,7 @@
     runs-on: ubuntu-22.04
     timeout-minutes: 20
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - uses: actions/setup-go@v4
@@ -87,7 +88,7 @@
       UBUNTU_VERSION: "${{ matrix.ubuntu }}"
       CONTAINERD_VERSION: "${{ matrix.containerd }}"
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - name: "Prepare integration test environment"
@@ -140,7 +141,7 @@
       CONTAINERD_VERSION: "${{ matrix.containerd }}"
       TEST_TARGET: "${{ matrix.target }}"
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - name: "Register QEMU (tonistiigi/binfmt)"
@@ -157,7 +158,7 @@
       matrix:
         go-version: ["1.19.x", "1.20.x"]
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - uses: actions/setup-go@v4
@@ -172,7 +173,7 @@
     runs-on: ubuntu-22.04
     timeout-minutes: 30
     steps:
-      - uses: actions/[email protected]
+      - uses: actions/[email protected]
         with:
           fetch-depth: 1
       - uses: actions/setup-go@v4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/Dockerfile new/nerdctl-1.3.1/Dockerfile
--- old/nerdctl-1.3.0/Dockerfile        2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/Dockerfile        2023-04-14 06:21:43.000000000 +0200
@@ -27,7 +27,7 @@
 # Extra deps: Lazy-pulling
 ARG STARGZ_SNAPSHOTTER_VERSION=v0.14.3
 # Extra deps: Nydus Lazy-pulling
-ARG NYDUS_VERSION=v2.1.4
+ARG NYDUS_VERSION=v2.2.0
 # Extra deps: Encryption
 ARG IMGCRYPT_VERSION=v1.1.7
 # Extra deps: Rootless
@@ -39,7 +39,7 @@
 ARG FUSE_OVERLAYFS_VERSION=v1.11
 ARG CONTAINERD_FUSE_OVERLAYFS_VERSION=v1.0.5
 # Extra deps: IPFS
-ARG KUBO_VERSION=v0.19.0
+ARG KUBO_VERSION=v0.19.1
 # Extra deps: Init
 ARG TINI_VERSION=v0.19.0
 # Extra deps: Debug
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.0 
new/nerdctl-1.3.1/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.0
--- old/nerdctl-1.3.0/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.0    2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.0    1970-01-01 
01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-# From https://github.com/ipfs/kubo/releases
-db70f8ceaf5a475025749266bb0529346dc4c60930d40bc80c87f220be49e448  
kubo_v0.19.0_linux-amd64.tar.gz
-9d9efb92efaf144645a7c40080d9fd2f234b889d325b3b514b16241b1d4e5b7e  
kubo_v0.19.0_linux-arm64.tar.gz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.1 
new/nerdctl-1.3.1/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.1
--- old/nerdctl-1.3.0/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.1    1970-01-01 
01:00:00.000000000 +0100
+++ new/nerdctl-1.3.1/Dockerfile.d/SHA256SUMS.d/kubo-v0.19.1    2023-04-14 
06:21:43.000000000 +0200
@@ -0,0 +1,3 @@
+# From https://github.com/ipfs/kubo/releases
+a15b3ec9c83833b42e807de31a27cd48a42e0865512c3968120f3ab33507737e  
kubo_v0.19.1_linux-amd64.tar.gz
+78d0705ebde17de3c04396ffe085de5f35cbc118c508749c2216443f3f6ba332  
kubo_v0.19.1_linux-arm64.tar.gz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/cmd/nerdctl/compose_up_test.go 
new/nerdctl-1.3.1/cmd/nerdctl/compose_up_test.go
--- old/nerdctl-1.3.0/cmd/nerdctl/compose_up_test.go    2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/cmd/nerdctl/compose_up_test.go    2023-04-14 
06:21:43.000000000 +0200
@@ -18,10 +18,13 @@
 
 import (
        "fmt"
+       "os"
+       "path/filepath"
        "runtime"
        "testing"
 
        "github.com/containerd/nerdctl/pkg/testutil"
+       "gotest.tools/v3/assert"
        "gotest.tools/v3/icmd"
 )
 
@@ -50,3 +53,32 @@
        }
        c.Assert(expected)
 }
+
+// https://github.com/containerd/nerdctl/issues/1652
+func TestComposeUpBindCreateHostPath(t *testing.T) {
+       if runtime.GOOS == "windows" {
+               t.Skip(`FIXME: no support for Windows path: (error: "volume 
target must be an absolute path, got \"/mnt\")`)
+       }
+
+       base := testutil.NewBase(t)
+
+       var dockerComposeYAML = fmt.Sprintf(`
+services:
+  test:
+    image: %s
+    command: sh -euxc "echo hi >/mnt/test"
+    volumes:
+      # ./foo should be automatically created
+      - ./foo:/mnt
+`, testutil.CommonImage)
+
+       comp := testutil.NewComposeDir(t, dockerComposeYAML)
+       defer comp.CleanUp()
+
+       base.ComposeCmd("-f", comp.YAMLFullPath(), "up").AssertOK()
+       defer base.ComposeCmd("-f", comp.YAMLFullPath(), "down").AssertOK()
+       testFile := filepath.Join(comp.Dir(), "foo", "test")
+       testB, err := os.ReadFile(testFile)
+       assert.NilError(t, err)
+       assert.Equal(t, "hi\n", string(testB))
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/nerdctl-1.3.0/cmd/nerdctl/container_run_linux_test.go 
new/nerdctl-1.3.1/cmd/nerdctl/container_run_linux_test.go
--- old/nerdctl-1.3.0/cmd/nerdctl/container_run_linux_test.go   2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/cmd/nerdctl/container_run_linux_test.go   2023-04-14 
06:21:43.000000000 +0200
@@ -36,6 +36,7 @@
        "github.com/containerd/nerdctl/pkg/strutil"
        "github.com/containerd/nerdctl/pkg/testutil"
        "gotest.tools/v3/assert"
+       "gotest.tools/v3/icmd"
 )
 
 func TestRunCustomRootfs(t *testing.T) {
@@ -246,6 +247,10 @@
        base.CmdWithHelper(unbuffer, "run", "--rm", "-t", testutil.CommonImage, 
"stty").AssertOutContains(sttyPartialOutput)
        base.Cmd("run", "--rm", "-i", testutil.CommonImage, "stty").AssertFail()
        base.Cmd("run", "--rm", testutil.CommonImage, "stty").AssertFail()
+
+       // tests pipe works
+       res := icmd.RunCmd(icmd.Command("unbuffer", "/bin/sh", "-c", 
fmt.Sprintf("%q run --rm -it %q echo hi | grep hi", base.Binary, 
testutil.CommonImage)))
+       assert.Equal(t, 0, res.ExitCode, res.Combined())
 }
 
 func TestRunWithFluentdLogDriver(t *testing.T) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/nerdctl-1.3.0/cmd/nerdctl/container_run_network_base_test.go 
new/nerdctl-1.3.1/cmd/nerdctl/container_run_network_base_test.go
--- old/nerdctl-1.3.0/cmd/nerdctl/container_run_network_base_test.go    
2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/cmd/nerdctl/container_run_network_base_test.go    
2023-04-14 06:21:43.000000000 +0200
@@ -22,6 +22,7 @@
        "fmt"
        "io"
        "net"
+       "regexp"
        "strings"
        "testing"
 
@@ -229,3 +230,21 @@
        }
        return res
 }
+
+func extractHostPort(portMapping string) (string, error) {
+       // Regular expression to extract host port from port mapping information
+       re := regexp.MustCompile(`\d+/tcp 
->.*?0.0.0.0:(?P<portNumber>\d{1,5}).*?`)
+
+       // Find the matches
+       matches := re.FindStringSubmatch(portMapping)
+
+       // Check if there is a match
+       if len(matches) < 2 {
+               return "", fmt.Errorf("could not extract host port from port 
mapping: %s", portMapping)
+       }
+
+       // Extract the host port number
+       hostPort := matches[1]
+
+       return hostPort, nil
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/nerdctl-1.3.0/cmd/nerdctl/container_run_network_linux_test.go 
new/nerdctl-1.3.1/cmd/nerdctl/container_run_network_linux_test.go
--- old/nerdctl-1.3.0/cmd/nerdctl/container_run_network_linux_test.go   
2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/cmd/nerdctl/container_run_network_linux_test.go   
2023-04-14 06:21:43.000000000 +0200
@@ -210,6 +210,98 @@
 
 }
 
+func TestUniqueHostPortAssignement(t *testing.T) {
+       if rootlessutil.IsRootless() {
+               t.Skip("Auto port assign is not supported rootless mode yet")
+       }
+
+       type testCase struct {
+               containerPort    string
+               runShouldSuccess bool
+       }
+
+       testCases := []testCase{
+               {
+                       containerPort:    "80",
+                       runShouldSuccess: true,
+               },
+               {
+                       containerPort:    "80-81",
+                       runShouldSuccess: true,
+               },
+               {
+                       containerPort:    "80-81/tcp",
+                       runShouldSuccess: true,
+               },
+       }
+
+       tID := testutil.Identifier(t)
+
+       for i, tc := range testCases {
+               i := i
+               tc := tc
+               tcName := fmt.Sprintf("%+v", tc)
+               t.Run(tcName, func(t *testing.T) {
+                       testContainerName1 := fmt.Sprintf("%s-%d-1", tID, i)
+                       testContainerName2 := fmt.Sprintf("%s-%d-2", tID, i)
+                       base := testutil.NewBase(t)
+                       defer base.Cmd("rm", "-f", testContainerName1, 
testContainerName2).Run()
+
+                       pFlag := tc.containerPort
+                       cmd1 := base.Cmd("run", "-d",
+                               "--name", testContainerName1, "-p",
+                               pFlag,
+                               testutil.NginxAlpineImage)
+
+                       cmd2 := base.Cmd("run", "-d",
+                               "--name", testContainerName2, "-p",
+                               pFlag,
+                               testutil.NginxAlpineImage)
+                       var result *icmd.Result
+                       stdoutContent := ""
+                       if tc.runShouldSuccess {
+                               cmd1.AssertOK()
+                               cmd2.AssertOK()
+                       } else {
+                               cmd1.AssertFail()
+                               cmd2.AssertFail()
+                               return
+                       }
+                       portCmd1 := base.Cmd("port", testContainerName1)
+                       portCmd2 := base.Cmd("port", testContainerName2)
+                       portCmd1.Base.T.Helper()
+                       portCmd2.Base.T.Helper()
+                       result = portCmd1.Run()
+                       stdoutContent = result.Stdout() + result.Stderr()
+                       assert.Assert(t, result.ExitCode == 0, stdoutContent)
+                       port1, err := extractHostPort(stdoutContent)
+                       assert.NilError(t, err)
+                       result = portCmd2.Run()
+                       stdoutContent = result.Stdout() + result.Stderr()
+                       assert.Assert(t, result.ExitCode == 0, stdoutContent)
+                       port2, err := extractHostPort(stdoutContent)
+                       assert.NilError(t, err)
+                       assert.Assert(t, port1 != port2, "Host ports are not 
unique")
+
+                       // Make HTTP GET request to container 1
+                       connectURL1 := fmt.Sprintf("http://%s:%s";, "127.0.0.1", 
port1)
+                       resp1, err := nettestutil.HTTPGet(connectURL1, 30, 
false)
+                       assert.NilError(t, err)
+                       respBody1, err := io.ReadAll(resp1.Body)
+                       assert.NilError(t, err)
+                       assert.Assert(t, strings.Contains(string(respBody1), 
testutil.NginxAlpineIndexHTMLSnippet))
+
+                       // Make HTTP GET request to container 2
+                       connectURL2 := fmt.Sprintf("http://%s:%s";, "127.0.0.1", 
port2)
+                       resp2, err := nettestutil.HTTPGet(connectURL2, 30, 
false)
+                       assert.NilError(t, err)
+                       respBody2, err := io.ReadAll(resp2.Body)
+                       assert.NilError(t, err)
+                       assert.Assert(t, strings.Contains(string(respBody2), 
testutil.NginxAlpineIndexHTMLSnippet))
+               })
+       }
+}
+
 func TestRunPort(t *testing.T) {
        baseTestRunPort(t, testutil.NginxAlpineImage, 
testutil.NginxAlpineIndexHTMLSnippet, true)
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/go.mod new/nerdctl-1.3.1/go.mod
--- old/nerdctl-1.3.0/go.mod    2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/go.mod    2023-04-14 06:21:43.000000000 +0200
@@ -3,11 +3,11 @@
 go 1.19
 
 require (
-       github.com/Masterminds/semver/v3 v3.2.0
+       github.com/Masterminds/semver/v3 v3.2.1
        github.com/Microsoft/go-winio v0.6.0
        github.com/Microsoft/hcsshim v0.10.0-rc.7
        github.com/compose-spec/compose-go v1.13.2
-       github.com/containerd/accelerated-container-image v0.6.0
+       github.com/containerd/accelerated-container-image v0.6.1
        github.com/containerd/cgroups v1.1.0
        github.com/containerd/console v1.0.3
        github.com/containerd/containerd v1.7.0
@@ -21,6 +21,7 @@
        github.com/containerd/typeurl/v2 v2.1.0
        github.com/containernetworking/cni v1.1.2
        github.com/containernetworking/plugins v1.2.0
+       github.com/coreos/go-iptables v0.6.0
        github.com/coreos/go-systemd/v22 v22.5.0
        github.com/cyphar/filepath-securejoin v0.2.3
        github.com/docker/cli v23.0.3+incompatible
@@ -49,12 +50,12 @@
        github.com/vishvananda/netlink v1.2.1-beta.2
        github.com/vishvananda/netns v0.0.4
        github.com/yuchanns/srslog v1.1.0
-       golang.org/x/crypto v0.7.0
-       golang.org/x/net v0.8.0
+       golang.org/x/crypto v0.8.0
+       golang.org/x/net v0.9.0
        golang.org/x/sync v0.1.0
        golang.org/x/sys v0.7.0
        golang.org/x/term v0.7.0
-       golang.org/x/text v0.8.0
+       golang.org/x/text v0.9.0
        gopkg.in/yaml.v3 v3.0.1
        gotest.tools/v3 v3.4.0
 )
@@ -84,7 +85,7 @@
        github.com/hashicorp/errwrap v1.1.0 // indirect
        github.com/imdario/mergo v0.3.14 // indirect
        github.com/inconshreveable/mousetrap v1.1.0 // indirect
-       github.com/klauspost/compress v1.16.3
+       github.com/klauspost/compress v1.16.4
        github.com/klauspost/cpuid/v2 v2.1.1 // indirect
        github.com/mattn/go-colorable v0.1.13 // indirect
        github.com/mattn/go-shellwords v1.0.12 // indirect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/go.sum new/nerdctl-1.3.1/go.sum
--- old/nerdctl-1.3.0/go.sum    2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/go.sum    2023-04-14 06:21:43.000000000 +0200
@@ -64,8 +64,8 @@
 github.com/BurntSushi/toml v0.3.1/go.mod 
h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/BurntSushi/toml v1.2.1 
h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod 
h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
-github.com/Masterminds/semver/v3 v3.2.0 
h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
-github.com/Masterminds/semver/v3 v3.2.0/go.mod 
h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
+github.com/Masterminds/semver/v3 v3.2.1 
h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
+github.com/Masterminds/semver/v3 v3.2.1/go.mod 
h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
 github.com/Microsoft/go-winio v0.4.11/go.mod 
h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
 github.com/Microsoft/go-winio v0.4.14/go.mod 
h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
 github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod 
h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
@@ -171,8 +171,8 @@
 github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod 
h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
 github.com/compose-spec/compose-go v1.13.2 
h1:FDfb5ddIpbGbxLRg5qjObOf5CrWbKnuHZ+zvpEdCqKc=
 github.com/compose-spec/compose-go v1.13.2/go.mod 
h1:SQfvBkB9u8bLhrj4RQP4I777SqzNLSl9/fNnfvOOjek=
-github.com/containerd/accelerated-container-image v0.6.0 
h1:IO6lisC0/VnWDW5kDIUCXBXZTg1jg0pmDQi6KZPpdfE=
-github.com/containerd/accelerated-container-image v0.6.0/go.mod 
h1:RZB4r386ZnUEuYdwJplVoI4avEE+oxWB75uOB3quctA=
+github.com/containerd/accelerated-container-image v0.6.1 
h1:K9+RzqGHPNoJIx/VZRZQ+W8lO2gEO+wanbVfBQsLnGg=
+github.com/containerd/accelerated-container-image v0.6.1/go.mod 
h1:RZB4r386ZnUEuYdwJplVoI4avEE+oxWB75uOB3quctA=
 github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod 
h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE=
 github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod 
h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU=
 github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod 
h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU=
@@ -315,6 +315,7 @@
 github.com/coreos/etcd v3.3.13+incompatible/go.mod 
h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 github.com/coreos/go-iptables v0.4.5/go.mod 
h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
 github.com/coreos/go-iptables v0.5.0/go.mod 
h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
+github.com/coreos/go-iptables v0.6.0 
h1:is9qnZMPYjLd8LYqmm/qlE+wwEgJIkTYdhV3rfZo4jk=
 github.com/coreos/go-iptables v0.6.0/go.mod 
h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
 github.com/coreos/go-oidc v2.1.0+incompatible/go.mod 
h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
 github.com/coreos/go-semver v0.2.0/go.mod 
h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -636,8 +637,8 @@
 github.com/kisielk/gotool v1.0.0/go.mod 
h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 github.com/klauspost/compress v1.11.3/go.mod 
h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
 github.com/klauspost/compress v1.11.13/go.mod 
h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.16.3 
h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
-github.com/klauspost/compress v1.16.3/go.mod 
h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
+github.com/klauspost/compress v1.16.4 
h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU=
+github.com/klauspost/compress v1.16.4/go.mod 
h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
 github.com/klauspost/cpuid/v2 v2.0.4/go.mod 
h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
 github.com/klauspost/cpuid/v2 v2.0.9/go.mod 
h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
 github.com/klauspost/cpuid/v2 v2.1.1 
h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
@@ -1085,8 +1086,8 @@
 golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod 
h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod 
h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
 golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod 
h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
-golang.org/x/crypto v0.7.0/go.mod 
h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
+golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
+golang.org/x/crypto v0.8.0/go.mod 
h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod 
h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod 
h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod 
h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -1180,8 +1181,8 @@
 golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod 
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod 
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod 
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
-golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
+golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
+golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod 
h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod 
h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod 
h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1328,8 +1329,8 @@
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
-golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod 
h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod 
h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod 
h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/cmd/image/list.go 
new/nerdctl-1.3.1/pkg/cmd/image/list.go
--- old/nerdctl-1.3.0/pkg/cmd/image/list.go     2023-04-05 14:12:49.000000000 
+0200
+++ new/nerdctl-1.3.1/pkg/cmd/image/list.go     2023-04-14 06:21:43.000000000 
+0200
@@ -162,7 +162,7 @@
        printer := &imagePrinter{
                w:            w,
                quiet:        options.Quiet,
-               noTrunc:      options.Quiet,
+               noTrunc:      options.NoTrunc,
                digestsFlag:  digestsFlag,
                namesFlag:    options.Names,
                tmpl:         tmpl,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/cmd/image/push.go 
new/nerdctl-1.3.1/pkg/cmd/image/push.go
--- old/nerdctl-1.3.0/pkg/cmd/image/push.go     2023-04-05 14:12:49.000000000 
+0200
+++ new/nerdctl-1.3.1/pkg/cmd/image/push.go     2023-04-14 06:21:43.000000000 
+0200
@@ -150,11 +150,11 @@
                return err
        }
 
-       img, err := client.ImageService().Get(ctx, ref)
+       img, err := client.ImageService().Get(ctx, pushRef)
        if err != nil {
                return err
        }
-       refSpec, err := reference.Parse(ref)
+       refSpec, err := reference.Parse(pushRef)
        if err != nil {
                return err
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/nerdctl-1.3.0/pkg/composer/serviceparser/serviceparser.go 
new/nerdctl-1.3.1/pkg/composer/serviceparser/serviceparser.go
--- old/nerdctl-1.3.0/pkg/composer/serviceparser/serviceparser.go       
2023-04-05 14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/pkg/composer/serviceparser/serviceparser.go       
2023-04-14 06:21:43.000000000 +0200
@@ -21,6 +21,7 @@
        "encoding/csv"
        "errors"
        "fmt"
+       "os"
        "path/filepath"
        "regexp"
        "strings"
@@ -178,6 +179,7 @@
 type Container struct {
        Name    string   // e.g., "compose-wordpress_wordpress_1"
        RunArgs []string // {"--pull=never", ...}
+       Mkdir   []string // For Bind.CreateHostPath
 }
 
 type Build struct {
@@ -659,11 +661,12 @@
        }
 
        for _, v := range svc.Volumes {
-               vStr, err := serviceVolumeConfigToFlagV(v, project)
+               vStr, mkdir, err := serviceVolumeConfigToFlagV(v, project)
                if err != nil {
                        return nil, err
                }
                c.RunArgs = append(c.RunArgs, "-v="+vStr)
+               c.Mkdir = mkdir
        }
 
        for _, config := range svc.Configs {
@@ -733,7 +736,7 @@
        return s, nil
 }
 
-func serviceVolumeConfigToFlagV(c types.ServiceVolumeConfig, project 
*types.Project) (string, error) {
+func serviceVolumeConfigToFlagV(c types.ServiceVolumeConfig, project 
*types.Project) (flagV string, mkdir []string, err error) {
        if unknown := reflectutil.UnknownNonEmptyFields(&c,
                "Type",
                "Source",
@@ -746,7 +749,7 @@
        }
        if c.Bind != nil {
                // c.Bind is expected to be a non-nil reference to an empty 
Bind struct
-               if unknown := reflectutil.UnknownNonEmptyFields(c.Bind); 
len(unknown) > 0 {
+               if unknown := reflectutil.UnknownNonEmptyFields(c.Bind, 
"CreateHostPath"); len(unknown) > 0 {
                        logrus.Warnf("Ignoring: volume: Bind: %+v", unknown)
                }
        }
@@ -758,10 +761,10 @@
        }
 
        if c.Target == "" {
-               return "", errors.New("volume target is missing")
+               return "", nil, errors.New("volume target is missing")
        }
        if !filepath.IsAbs(c.Target) {
-               return "", fmt.Errorf("volume target must be an absolute path, 
got %q", c.Target)
+               return "", nil, fmt.Errorf("volume target must be an absolute 
path, got %q", c.Target)
        }
 
        if c.Source == "" {
@@ -770,7 +773,7 @@
                if c.ReadOnly {
                        s += ":ro"
                }
-               return s, nil
+               return s, mkdir, nil
        }
 
        var src string
@@ -778,7 +781,7 @@
        case "volume":
                vol, ok := project.Volumes[c.Source]
                if !ok {
-                       return "", fmt.Errorf("invalid volume %q", c.Source)
+                       return "", nil, fmt.Errorf("invalid volume %q", 
c.Source)
                }
                // c.Source is like "db_data", vol.Name is like 
"compose-wordpress_db_data"
                src = vol.Name
@@ -787,16 +790,21 @@
                var err error
                src, err = filepath.Abs(src)
                if err != nil {
-                       return "", fmt.Errorf("invalid relative path %q: %w", 
c.Source, err)
+                       return "", nil, fmt.Errorf("invalid relative path %q: 
%w", c.Source, err)
+               }
+               if c.Bind != nil && c.Bind.CreateHostPath {
+                       if _, stErr := os.Stat(src); errors.Is(stErr, 
os.ErrNotExist) {
+                               mkdir = append(mkdir, src)
+                       }
                }
        default:
-               return "", fmt.Errorf("unsupported volume type: %q", c.Type)
+               return "", nil, fmt.Errorf("unsupported volume type: %q", 
c.Type)
        }
        s := fmt.Sprintf("%s:%s", src, c.Target)
        if c.ReadOnly {
                s += ":ro"
        }
-       return s, nil
+       return s, mkdir, nil
 }
 
 func fileReferenceConfigToFlagV(c types.FileReferenceConfig, project 
*types.Project, secret bool) (string, error) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/composer/up_service.go 
new/nerdctl-1.3.1/pkg/composer/up_service.go
--- old/nerdctl-1.3.0/pkg/composer/up_service.go        2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/pkg/composer/up_service.go        2023-04-14 
06:21:43.000000000 +0200
@@ -133,6 +133,13 @@
                logrus.Infof("Creating container %s", container.Name)
        }
 
+       for _, f := range container.Mkdir {
+               logrus.Debugf("Creating a directory %q", f)
+               if err = os.MkdirAll(f, 0o755); err != nil {
+                       return "", fmt.Errorf("failed to create a directory %q: 
%w", f, err)
+               }
+       }
+
        tempDir, err := os.MkdirTemp(os.TempDir(), "compose-")
        if err != nil {
                return "", fmt.Errorf("error while creating/re-creating 
container %s: %w", container.Name, err)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/portutil/iptable/iptables.go 
new/nerdctl-1.3.1/pkg/portutil/iptable/iptables.go
--- old/nerdctl-1.3.0/pkg/portutil/iptable/iptables.go  1970-01-01 
01:00:00.000000000 +0100
+++ new/nerdctl-1.3.1/pkg/portutil/iptable/iptables.go  2023-04-14 
06:21:43.000000000 +0200
@@ -0,0 +1,44 @@
+/*
+   Copyright The containerd Authors.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+package iptable
+
+import (
+       "regexp"
+       "strconv"
+)
+
+// ParseIPTableRules takes a slice of iptables rules as input and returns a 
slice of
+// uint64 containing the parsed destination port numbers from the rules.
+func ParseIPTableRules(rules []string) []uint64 {
+       ports := []uint64{}
+
+       // Regex to match the '--dports' option followed by the port number
+       dportRegex := regexp.MustCompile(`--dports (\d+)`)
+
+       for _, rule := range rules {
+               matches := dportRegex.FindStringSubmatch(rule)
+               if len(matches) > 1 {
+                       port64, err := strconv.ParseUint(matches[1], 10, 16)
+                       if err != nil {
+                               continue
+                       }
+                       ports = append(ports, port64)
+               }
+       }
+
+       return ports
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/portutil/iptable/iptables_linux.go 
new/nerdctl-1.3.1/pkg/portutil/iptable/iptables_linux.go
--- old/nerdctl-1.3.0/pkg/portutil/iptable/iptables_linux.go    1970-01-01 
01:00:00.000000000 +0100
+++ new/nerdctl-1.3.1/pkg/portutil/iptable/iptables_linux.go    2023-04-14 
06:21:43.000000000 +0200
@@ -0,0 +1,42 @@
+/*
+   Copyright The containerd Authors.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+package iptable
+
+import (
+       "github.com/coreos/go-iptables/iptables"
+)
+
+// Chain used for port forwarding rules: 
https://www.cni.dev/plugins/current/meta/portmap/#dnat
+const cniDnatChain = "CNI-HOSTPORT-DNAT"
+
+func ReadIPTables(table string) ([]string, error) {
+       ipt, err := iptables.New()
+       if err != nil {
+               return nil, err
+       }
+
+       var rules []string
+       chainExists, _ := ipt.ChainExists(table, cniDnatChain)
+       if chainExists {
+               rules, err = ipt.List(table, cniDnatChain)
+               if err != nil {
+                       return nil, err
+               }
+       }
+
+       return rules, nil
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/portutil/iptable/iptables_test.go 
new/nerdctl-1.3.1/pkg/portutil/iptable/iptables_test.go
--- old/nerdctl-1.3.0/pkg/portutil/iptable/iptables_test.go     1970-01-01 
01:00:00.000000000 +0100
+++ new/nerdctl-1.3.1/pkg/portutil/iptable/iptables_test.go     2023-04-14 
06:21:43.000000000 +0200
@@ -0,0 +1,71 @@
+/*
+   Copyright The containerd Authors.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+package iptable
+
+import (
+       "testing"
+)
+
+func TestParseIPTableRules(t *testing.T) {
+       testCases := []struct {
+               name  string
+               rules []string
+               want  []uint64
+       }{
+               {
+                       name:  "Empty input",
+                       rules: []string{},
+                       want:  []uint64{},
+               },
+               {
+                       name: "Single rule with single port",
+                       rules: []string{
+                               "-A CNI-HOSTPORT-DNAT -p tcp -m comment 
--comment \"dnat name: \"bridge\" id: \"some-id\"\" -m multiport --dports 8080 
-j CNI-DN-some-hash",
+                       },
+                       want: []uint64{8080},
+               },
+               {
+                       name: "Multiple rules with multiple ports",
+                       rules: []string{
+                               "-A CNI-HOSTPORT-DNAT -p tcp -m comment 
--comment \"dnat name: \"bridge\" id: \"some-id\"\" -m multiport --dports 8080 
-j CNI-DN-some-hash",
+                               "-A CNI-HOSTPORT-DNAT -p tcp -m comment 
--comment \"dnat name: \"bridge\" id: \"some-id\"\" -m multiport --dports 9090 
-j CNI-DN-some-hash",
+                       },
+                       want: []uint64{8080, 9090},
+               },
+       }
+
+       for _, tc := range testCases {
+               t.Run(tc.name, func(t *testing.T) {
+                       got := ParseIPTableRules(tc.rules)
+                       if !equal(got, tc.want) {
+                               t.Errorf("ParseIPTableRules(%v) = %v; want %v", 
tc.rules, got, tc.want)
+                       }
+               })
+       }
+}
+
+func equal(a, b []uint64) bool {
+       if len(a) != len(b) {
+               return false
+       }
+       for i, v := range a {
+               if v != b[i] {
+                       return false
+               }
+       }
+       return true
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/portutil/port_allocate_linux.go 
new/nerdctl-1.3.1/pkg/portutil/port_allocate_linux.go
--- old/nerdctl-1.3.0/pkg/portutil/port_allocate_linux.go       2023-04-05 
14:12:49.000000000 +0200
+++ new/nerdctl-1.3.1/pkg/portutil/port_allocate_linux.go       2023-04-14 
06:21:43.000000000 +0200
@@ -19,6 +19,7 @@
 import (
        "fmt"
 
+       "github.com/containerd/nerdctl/pkg/portutil/iptable"
        "github.com/containerd/nerdctl/pkg/portutil/procnet"
 )
 
@@ -71,6 +72,17 @@
        for _, value := range netprocItems {
                usedPort[value.LocalPort] = true
        }
+
+       ipTableItems, err := iptable.ReadIPTables("nat")
+       if err != nil {
+               return 0, 0, err
+       }
+       destinationPorts := iptable.ParseIPTableRules(ipTableItems)
+
+       for _, port := range destinationPorts {
+               usedPort[port] = true
+       }
+
        start := uint64(allocateStart)
        if count > uint64(allocateEnd-allocateStart+1) {
                return 0, 0, fmt.Errorf("can not allocate %d ports", count)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nerdctl-1.3.0/pkg/taskutil/taskutil.go 
new/nerdctl-1.3.1/pkg/taskutil/taskutil.go
--- old/nerdctl-1.3.0/pkg/taskutil/taskutil.go  2023-04-05 14:12:49.000000000 
+0200
+++ new/nerdctl-1.3.1/pkg/taskutil/taskutil.go  2023-04-14 06:21:43.000000000 
+0200
@@ -81,7 +81,7 @@
                        }
                        in = con
                }
-               ioCreator = cio.NewCreator(cio.WithStreams(in, con, nil), 
cio.WithTerminal)
+               ioCreator = cio.NewCreator(cio.WithStreams(in, os.Stdout, nil), 
cio.WithTerminal)
        } else if flagD && logURI != "" {
                // TODO: support logURI for `nerdctl run -it`
                u, err := url.Parse(logURI)

++++++ vendor.tar.xz ++++++
++++ 2791 lines of diff (skipped)

Reply via email to