This is an automatic notification regarding your Bug report
which was filed against the src:crowdsec package:

#1077303: crowdsec FTBFS fixup for docker transition

It has been closed by Debian FTP Masters <ftpmas...@ftp-master.debian.org> 
(reply to Cyril Brulebois <cy...@debamax.com>).

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Debian FTP Masters 
<ftpmas...@ftp-master.debian.org> (reply to Cyril Brulebois 
<cy...@debamax.com>) by
replying to this email.


-- 
1077303: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077303
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: crowdsec
Source-Version: 1.4.6-9
Done: Cyril Brulebois <cy...@debamax.com>

We believe that the bug you reported is fixed in the latest version of
crowdsec, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1077...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Cyril Brulebois <cy...@debamax.com> (supplier of updated crowdsec package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 31 Jul 2024 12:03:56 +0200
Source: crowdsec
Architecture: source
Version: 1.4.6-9
Distribution: unstable
Urgency: medium
Maintainer: Cyril Brulebois <cy...@debamax.com>
Changed-By: Cyril Brulebois <cy...@debamax.com>
Closes: 1077303
Changes:
 crowdsec (1.4.6-9) unstable; urgency=medium
 .
   [ Nilesh Patra ]
   * Fix FTBFS with docker.io 26+ (Closes: #1077303):
      - Add 0020-add-patch-to-build-with-docker-26.patch
      - Version golang-github-docker-docker-dev (Build-)Depends accordingly.
Checksums-Sha1:
 db582b22f3e601e68fa0d969785e8bf6dc67762f 4952 crowdsec_1.4.6-9.dsc
 5c331f16cc241baf1b3d3c32ac5756d5fc447eea 32388 crowdsec_1.4.6-9.debian.tar.xz
 807ca67bcf0726b24e3bdb2fab098ceea188d81e 27870 
crowdsec_1.4.6-9_source.buildinfo
Checksums-Sha256:
 10b35c4e5f9b7f25110ad5f7fdb6fd3d13fc04249b1e43411d2919777ac86ebd 4952 
crowdsec_1.4.6-9.dsc
 d2ddafcd0eead66f2edb815389024ad9dfdddead65e75a94d1e67bf2376818c8 32388 
crowdsec_1.4.6-9.debian.tar.xz
 aa5554a86e5079439e24a70884016911720cd1a43fb57788df607ede18d840d1 27870 
crowdsec_1.4.6-9_source.buildinfo
Files:
 c7ad3f1dd119fa99ea10080c09f20c2d 4952 golang optional crowdsec_1.4.6-9.dsc
 0f82f9faa3840243f0f97120b869e6f8 32388 golang optional 
crowdsec_1.4.6-9.debian.tar.xz
 cbb7ab4cb24329110a92e5e1afa8900b 27870 golang optional 
crowdsec_1.4.6-9_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEEtg6/KYRFPHDXTPR4/5FK8MKzVSAFAmaqDGQQHGtpYmlAZGVi
aWFuLm9yZwAKCRD/kUrwwrNVIPfYD/9V+JHkDfw1wEfo0ZE03gGmSf9WkPnlIkaA
MbsVbGGLkVpZeRc6ETHCEIWxWw0RvTb2PpfgdGT80BqI+tcU7+yiTUsFEyVZptce
YZtg4kuehhcUyF3QrJyLs9HIlku3nnv3uDtb4qkbQ/dfyjyo2Hc754n1VGlFtJCo
vp8YuQoXE0m/Jv8izXf4Reoby0deEsciCg8DXQlpw7IemirzHFuHNE7gRLjZzKCk
6cMIy9eFg+LpfkWZnC7sxrC67wfTCqUQG5CTgqtHd8QciCO5uV+/biYdYay/QMKB
s+I0UTJg2DzteylYUfFc8dOvC/zXytB86xEJIm6udLBd1pSrxVdmpVbV79RoWXQ/
C8VWSRgtLLAt5iMdvhgC4T7+T9ZzBeIYWJifpktGxDpCJzzZPtGm37nl4dLjTN3d
bm3EQUC+etBqCDlO1ipPGijS2XfrzYavNJb9pW37vw8A9xkGgau3Ae9Fyn+FhbDs
g4v90Jm78sosgE+Hrsma9Ln1s8wUobfuh4hjQ6B9FskedCJXKAWk4ux8h3OEDhNg
BfGFqQwiifYnVS/secMtE4nTQribg5PEXZOtSbPeZH3WwwbyvB2ehLjRiQO2iWFO
2bah6CO0AGGRzO8uDG0WkvixYSyngkJG5GEKhM+wu7FwQYZKCjTS3CO/DvDjRIuZ
4KeS13unuw==
=Ffi7
-----END PGP SIGNATURE-----

Attachment: pgpUpFZMocCmG.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: crowdsec
Source-Version: 1.4.6-8
Severity: serious
Tags: patch

Hey Cyril,

Currently crowdsec FTBFS with new docker.io upload[1][2] blocking the 
transition. I
have a patch (attached) that gets things building. Since you upload this pretty 
regularly,
would you take care of it?

If you're out of time I could do a team upload. Let me know. Thanks!

[1]: https://qa.debian.org/excuses.php?package=docker.io
[2]: https://ci.debian.net/packages/c/crowdsec/testing/amd64/49715452/

Best,
Nilesh
From 6a80242bad27e480156b63dad02a1932bc7f5729 Mon Sep 17 00:00:00 2001
From: Nilesh Patra <nil...@iki.fi>
Date: Sun, 28 Jul 2024 12:33:22 +0530
Subject: [PATCH] Fixup for FTBFS with docker 26

---
 debian/control                                |   4 +-
 ...20-add-patch-to-build-with-docker-26.patch | 122 ++++++++++++++++++
 debian/patches/series                         |   1 +
 pkg/acquisition/modules/docker/docker.go      |  11 +-
 pkg/acquisition/modules/docker/docker_test.go |   2 +-
 pkg/metabase/container.go                     |  13 +-
 6 files changed, 139 insertions(+), 14 deletions(-)
 create mode 100644 debian/patches/0020-add-patch-to-build-with-docker-26.patch

diff --git a/debian/control b/debian/control
index 94a27ce..798ba8c 100644
--- a/debian/control
+++ b/debian/control
@@ -24,7 +24,7 @@ Build-Depends: debhelper-compat (= 13),
                golang-github-crowdsecurity-machineid-dev,
                golang-github-davecgh-go-spew-dev,
                golang-github-dghubble-sling-dev,
-               golang-github-docker-docker-dev,
+               golang-github-docker-docker-dev (>= 26),
                golang-github-docker-go-connections-dev,
                golang-github-enescakir-emoji-dev,
                golang-github-gin-gonic-gin-dev (>= 1.8.1),
@@ -139,7 +139,7 @@ Depends: golang-entgo-ent-dev,
          golang-github-crowdsecurity-machineid-dev,
          golang-github-davecgh-go-spew-dev,
          golang-github-dghubble-sling-dev,
-         golang-github-docker-docker-dev,
+         golang-github-docker-docker-dev (>= 26),
          golang-github-docker-go-connections-dev,
          golang-github-enescakir-emoji-dev,
          golang-github-gin-gonic-gin-dev (>= 1.8.1),
diff --git a/debian/patches/0020-add-patch-to-build-with-docker-26.patch b/debian/patches/0020-add-patch-to-build-with-docker-26.patch
new file mode 100644
index 0000000..4014de7
--- /dev/null
+++ b/debian/patches/0020-add-patch-to-build-with-docker-26.patch
@@ -0,0 +1,122 @@
+diff --git a/pkg/acquisition/modules/docker/docker.go b/pkg/acquisition/modules/docker/docker.go
+index 117eadd..b9619d9 100644
+--- a/pkg/acquisition/modules/docker/docker.go
++++ b/pkg/acquisition/modules/docker/docker.go
+@@ -15,6 +15,7 @@ import (
+ 	"github.com/crowdsecurity/crowdsec/pkg/types"
+ 	"github.com/crowdsecurity/dlog"
+ 	dockerTypes "github.com/docker/docker/api/types"
++	dockerContainer "github.com/docker/docker/api/types/container"
+ 	"github.com/docker/docker/client"
+ 
+ 	"github.com/pkg/errors"
+@@ -55,7 +56,7 @@ type DockerSource struct {
+ 	logger                *log.Entry
+ 	Client                client.CommonAPIClient
+ 	t                     *tomb.Tomb
+-	containerLogsOptions  *dockerTypes.ContainerLogsOptions
++	containerLogsOptions  *dockerContainer.LogsOptions
+ }
+ 
+ type ContainerConfig struct {
+@@ -119,7 +120,7 @@ func (d *DockerSource) Configure(Config []byte, logger *log.Entry) error {
+ 		d.Config.Since = time.Now().UTC().Format(time.RFC3339)
+ 	}
+ 
+-	d.containerLogsOptions = &dockerTypes.ContainerLogsOptions{
++	d.containerLogsOptions = &dockerContainer.LogsOptions{
+ 		ShowStdout: d.Config.FollowStdout,
+ 		ShowStderr: d.Config.FollowStdErr,
+ 		Follow:     true,
+@@ -170,7 +171,7 @@ func (d *DockerSource) ConfigureByDSN(dsn string, labels map[string]string, logg
+ 		return err
+ 	}
+ 
+-	d.containerLogsOptions = &dockerTypes.ContainerLogsOptions{
++	d.containerLogsOptions = &dockerContainer.LogsOptions{
+ 		ShowStdout: d.Config.FollowStdout,
+ 		ShowStderr: d.Config.FollowStdErr,
+ 		Follow:     false,
+@@ -266,7 +267,7 @@ func (d *DockerSource) SupportedModes() []string {
+ //OneShotAcquisition reads a set of file and returns when done
+ func (d *DockerSource) OneShotAcquisition(out chan types.Event, t *tomb.Tomb) error {
+ 	d.logger.Debug("In oneshot")
+-	runningContainer, err := d.Client.ContainerList(context.Background(), dockerTypes.ContainerListOptions{})
++	runningContainer, err := d.Client.ContainerList(context.Background(), dockerContainer.ListOptions{})
+ 	if err != nil {
+ 		return err
+ 	}
+@@ -399,7 +400,7 @@ func (d *DockerSource) WatchContainer(monitChan chan *ContainerConfig, deleteCha
+ 		case <-ticker.C:
+ 			// to track for garbage collection
+ 			runningContainersID := make(map[string]bool)
+-			runningContainer, err := d.Client.ContainerList(context.Background(), dockerTypes.ContainerListOptions{})
++			runningContainer, err := d.Client.ContainerList(context.Background(), dockerContainer.ListOptions{})
+ 			if err != nil {
+ 				if strings.Contains(strings.ToLower(err.Error()), "cannot connect to the docker daemon at") {
+ 					for idx, container := range d.runningContainerState {
+diff --git a/pkg/acquisition/modules/docker/docker_test.go b/pkg/acquisition/modules/docker/docker_test.go
+index cf6e350..eeaf67a 100644
+--- a/pkg/acquisition/modules/docker/docker_test.go
++++ b/pkg/acquisition/modules/docker/docker_test.go
+@@ -216,7 +216,7 @@ container_name_regexp:
+ 
+ }
+ 
+-func (cli *mockDockerCli) ContainerList(ctx context.Context, options dockerTypes.ContainerListOptions) ([]dockerTypes.Container, error) {
++func (cli *mockDockerCli) ContainerList(ctx context.Context, options dockerContainer.ListOptions) ([]dockerTypes.Container, error) {
+ 	if readLogs == true {
+ 		return []dockerTypes.Container{}, nil
+ 	}
+diff --git a/pkg/metabase/container.go b/pkg/metabase/container.go
+index b53803b..2368a9b 100644
+--- a/pkg/metabase/container.go
++++ b/pkg/metabase/container.go
+@@ -5,7 +5,6 @@ import (
+ 	"context"
+ 	"fmt"
+ 	"runtime"
+-	"time"
+ 
+ 	"github.com/docker/docker/api/types"
+ 	"github.com/docker/docker/api/types/container"
+@@ -113,7 +112,7 @@ func (c *Container) Create() error {
+ 
+ func (c *Container) Start() error {
+ 	ctx := context.Background()
+-	if err := c.CLI.ContainerStart(ctx, c.Name, types.ContainerStartOptions{}); err != nil {
++	if err := c.CLI.ContainerStart(ctx, c.Name, container.StartOptions{}); err != nil {
+ 		return fmt.Errorf("failed while starting %s : %s", c.ID, err)
+ 	}
+ 
+@@ -126,7 +125,7 @@ func StartContainer(name string) error {
+ 		return fmt.Errorf("failed to create docker client : %s", err)
+ 	}
+ 	ctx := context.Background()
+-	if err := cli.ContainerStart(ctx, name, types.ContainerStartOptions{}); err != nil {
++	if err := cli.ContainerStart(ctx, name, container.StartOptions{}); err != nil {
+ 		return fmt.Errorf("failed while starting %s : %s", name, err)
+ 	}
+ 
+@@ -139,8 +138,10 @@ func StopContainer(name string) error {
+ 		return fmt.Errorf("failed to create docker client : %s", err)
+ 	}
+ 	ctx := context.Background()
+-	var to time.Duration = 20 * time.Second
+-	if err := cli.ContainerStop(ctx, name, &to); err != nil {
++	timeoutSeconds := 20
++	var to container.StopOptions
++	to.Timeout = &timeoutSeconds
++	if err := cli.ContainerStop(ctx, name, to); err != nil {
+ 		return fmt.Errorf("failed while stopping %s : %s", name, err)
+ 	}
+ 	log.Printf("container stopped successfully")
+@@ -154,7 +155,7 @@ func RemoveContainer(name string) error {
+ 	}
+ 	ctx := context.Background()
+ 	log.Printf("Removing docker metabase %s", name)
+-	if err := cli.ContainerRemove(ctx, name, types.ContainerRemoveOptions{}); err != nil {
++	if err := cli.ContainerRemove(ctx, name, container.RemoveOptions{}); err != nil {
+ 		return fmt.Errorf("failed to remove container %s : %s", name, err)
+ 	}
+ 	return nil
diff --git a/debian/patches/series b/debian/patches/series
index 7a725af..8257803 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,3 +13,4 @@
 0017-fix-default-acquisition.patch
 0018-non-fatal-errors-for-invalid-datasources.patch
 0019-disable-unreliable-test-TestStreaming.patch
+0020-add-patch-to-build-with-docker-26.patch
diff --git a/pkg/acquisition/modules/docker/docker.go b/pkg/acquisition/modules/docker/docker.go
index 117eadd..b9619d9 100644
--- a/pkg/acquisition/modules/docker/docker.go
+++ b/pkg/acquisition/modules/docker/docker.go
@@ -15,6 +15,7 @@ import (
 	"github.com/crowdsecurity/crowdsec/pkg/types"
 	"github.com/crowdsecurity/dlog"
 	dockerTypes "github.com/docker/docker/api/types"
+	dockerContainer "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 
 	"github.com/pkg/errors"
@@ -55,7 +56,7 @@ type DockerSource struct {
 	logger                *log.Entry
 	Client                client.CommonAPIClient
 	t                     *tomb.Tomb
-	containerLogsOptions  *dockerTypes.ContainerLogsOptions
+	containerLogsOptions  *dockerContainer.LogsOptions
 }
 
 type ContainerConfig struct {
@@ -119,7 +120,7 @@ func (d *DockerSource) Configure(Config []byte, logger *log.Entry) error {
 		d.Config.Since = time.Now().UTC().Format(time.RFC3339)
 	}
 
-	d.containerLogsOptions = &dockerTypes.ContainerLogsOptions{
+	d.containerLogsOptions = &dockerContainer.LogsOptions{
 		ShowStdout: d.Config.FollowStdout,
 		ShowStderr: d.Config.FollowStdErr,
 		Follow:     true,
@@ -170,7 +171,7 @@ func (d *DockerSource) ConfigureByDSN(dsn string, labels map[string]string, logg
 		return err
 	}
 
-	d.containerLogsOptions = &dockerTypes.ContainerLogsOptions{
+	d.containerLogsOptions = &dockerContainer.LogsOptions{
 		ShowStdout: d.Config.FollowStdout,
 		ShowStderr: d.Config.FollowStdErr,
 		Follow:     false,
@@ -266,7 +267,7 @@ func (d *DockerSource) SupportedModes() []string {
 //OneShotAcquisition reads a set of file and returns when done
 func (d *DockerSource) OneShotAcquisition(out chan types.Event, t *tomb.Tomb) error {
 	d.logger.Debug("In oneshot")
-	runningContainer, err := d.Client.ContainerList(context.Background(), dockerTypes.ContainerListOptions{})
+	runningContainer, err := d.Client.ContainerList(context.Background(), dockerContainer.ListOptions{})
 	if err != nil {
 		return err
 	}
@@ -399,7 +400,7 @@ func (d *DockerSource) WatchContainer(monitChan chan *ContainerConfig, deleteCha
 		case <-ticker.C:
 			// to track for garbage collection
 			runningContainersID := make(map[string]bool)
-			runningContainer, err := d.Client.ContainerList(context.Background(), dockerTypes.ContainerListOptions{})
+			runningContainer, err := d.Client.ContainerList(context.Background(), dockerContainer.ListOptions{})
 			if err != nil {
 				if strings.Contains(strings.ToLower(err.Error()), "cannot connect to the docker daemon at") {
 					for idx, container := range d.runningContainerState {
diff --git a/pkg/acquisition/modules/docker/docker_test.go b/pkg/acquisition/modules/docker/docker_test.go
index cf6e350..eeaf67a 100644
--- a/pkg/acquisition/modules/docker/docker_test.go
+++ b/pkg/acquisition/modules/docker/docker_test.go
@@ -216,7 +216,7 @@ container_name_regexp:
 
 }
 
-func (cli *mockDockerCli) ContainerList(ctx context.Context, options dockerTypes.ContainerListOptions) ([]dockerTypes.Container, error) {
+func (cli *mockDockerCli) ContainerList(ctx context.Context, options dockerContainer.ListOptions) ([]dockerTypes.Container, error) {
 	if readLogs == true {
 		return []dockerTypes.Container{}, nil
 	}
diff --git a/pkg/metabase/container.go b/pkg/metabase/container.go
index b53803b..2368a9b 100644
--- a/pkg/metabase/container.go
+++ b/pkg/metabase/container.go
@@ -5,7 +5,6 @@ import (
 	"context"
 	"fmt"
 	"runtime"
-	"time"
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/container"
@@ -113,7 +112,7 @@ func (c *Container) Create() error {
 
 func (c *Container) Start() error {
 	ctx := context.Background()
-	if err := c.CLI.ContainerStart(ctx, c.Name, types.ContainerStartOptions{}); err != nil {
+	if err := c.CLI.ContainerStart(ctx, c.Name, container.StartOptions{}); err != nil {
 		return fmt.Errorf("failed while starting %s : %s", c.ID, err)
 	}
 
@@ -126,7 +125,7 @@ func StartContainer(name string) error {
 		return fmt.Errorf("failed to create docker client : %s", err)
 	}
 	ctx := context.Background()
-	if err := cli.ContainerStart(ctx, name, types.ContainerStartOptions{}); err != nil {
+	if err := cli.ContainerStart(ctx, name, container.StartOptions{}); err != nil {
 		return fmt.Errorf("failed while starting %s : %s", name, err)
 	}
 
@@ -139,8 +138,10 @@ func StopContainer(name string) error {
 		return fmt.Errorf("failed to create docker client : %s", err)
 	}
 	ctx := context.Background()
-	var to time.Duration = 20 * time.Second
-	if err := cli.ContainerStop(ctx, name, &to); err != nil {
+	timeoutSeconds := 20
+	var to container.StopOptions
+	to.Timeout = &timeoutSeconds
+	if err := cli.ContainerStop(ctx, name, to); err != nil {
 		return fmt.Errorf("failed while stopping %s : %s", name, err)
 	}
 	log.Printf("container stopped successfully")
@@ -154,7 +155,7 @@ func RemoveContainer(name string) error {
 	}
 	ctx := context.Background()
 	log.Printf("Removing docker metabase %s", name)
-	if err := cli.ContainerRemove(ctx, name, types.ContainerRemoveOptions{}); err != nil {
+	if err := cli.ContainerRemove(ctx, name, container.RemoveOptions{}); err != nil {
 		return fmt.Errorf("failed to remove container %s : %s", name, err)
 	}
 	return nil
-- 
2.43.0

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to