Bug#1071035: FAIL: TestGroup_deadlock

2024-05-13 Thread Reinhard Tartler

Control: reassign -1 golang-golang-x-sync 0.7.0
Control: affects -1 golang-github-fatih-semgroup

This seems to be related to upgrading golang-golang-x-sync to 0.7.0.

This is how to reproduce is using pristine upstream sources:

siretart@x1:/tmp/docker.io $ git clone https://github.com/fatih/semgroup
Cloning into 'semgroup'...
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (46/46), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 46 (delta 23), reused 21 (delta 7), pack-reused 0
Receiving objects: 100% (46/46), 10.49 KiB | 10.49 MiB/s, done.
Resolving deltas: 100% (23/23), done.
siretart@x1:/tmp/docker.io $ cd ./semgroup/
siretart@x1:/tmp/docker.io/semgroup $ go mod edit -require 
golang.org/x/sync@v0.7.0
siretart@x1:/tmp/docker.io/semgroup $ go mod tidy
siretart@x1:/tmp/docker.io/semgroup $ go test -vet=off -v -p 8 
github.com/fatih/semgroup
=== RUN   TestGroup_single_task
--- PASS: TestGroup_single_task (0.00s)
=== RUN   TestGroup_multiple_tasks
--- PASS: TestGroup_multiple_tasks (0.00s)
=== RUN   TestGroup_multiple_tasks_errors
--- PASS: TestGroup_multiple_tasks_errors (0.00s)
=== RUN   TestGroup_deadlock
semgroup_test.go:92: error should be:
1 error(s) occurred:
* couldn't acquire semaphore: context canceled
got:
2 error(s) occurred:
* couldn't acquire semaphore: context canceled
* couldn't acquire semaphore: context canceled
--- FAIL: TestGroup_deadlock (0.00s)
=== RUN   TestGroup_multiple_tasks_errors_Is
--- PASS: TestGroup_multiple_tasks_errors_Is (0.00s)
=== RUN   TestGroup_multiple_tasks_errors_As
--- PASS: TestGroup_multiple_tasks_errors_As (0.00s)
=== RUN   ExampleGroup_parallel
--- PASS: ExampleGroup_parallel (0.00s)
=== RUN   ExampleGroup_withErrors
--- PASS: ExampleGroup_withErrors (0.00s)
FAIL
FAILgithub.com/fatih/semgroup   0.002s
FAIL



Bug#1071035: FAIL: TestGroup_deadlock

2024-05-13 Thread Reinhard Tartler



Control: tag -1 patch

I've filed https://github.com/fatih/semgroup/pull/7 as a workaround.

Anthony, what's your take on this, should we include that patch in the Debian 
Package?

-rt

From bb5f94c0d8e6ddf1f24f673303d73e84c285e1ac Mon Sep 17 00:00:00 2001
From: Reinhard Tartler 
Date: Mon, 13 May 2024 08:31:03 -0400
Subject: [PATCH] chore: bump x/sync to 0.7

Note that this version changes the behavior of semaphore slightly.
After 
https://cs.opensource.google/go/x/sync/+/14be23e5b48bec28285f8a694875175ecacfddb3
the semaphore package will reliably raise errors for both go routines

change the test to test for a substring to be more relaxed in case that
behavior gets reverted
---
 go.mod   | 2 +-
 go.sum   | 4 ++--
 semgroup_test.go | 8 
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/go.mod b/go.mod
index 1a651d6..5926c6b 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,4 @@ module github.com/fatih/semgroup
 
 go 1.17
 
-require golang.org/x/sync v0.0.0-20210220032951-036812b2e83c

+require golang.org/x/sync v0.7.0
diff --git a/go.sum b/go.sum
index 5c00efd..e8ef4a3 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,2 @@
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c 
h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
+golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
diff --git a/semgroup_test.go b/semgroup_test.go
index 255206d..3c90bf6 100644
--- a/semgroup_test.go
+++ b/semgroup_test.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"os"
+   "strings"
"sync"
"testing"
 )
@@ -85,11 +86,10 @@ func TestGroup_deadlock(t *testing.T) {
t.Fatalf("g.Wait() should return an error")
}
 
-	wantErr := `1 error(s) occurred:

-* couldn't acquire semaphore: context canceled`
+   wantErr := `couldn't acquire semaphore: context canceled`
 
-	if wantErr != err.Error() {

-   t.Errorf("error should be:\n%s\ngot:\n%s\n", wantErr, 
err.Error())
+   if !strings.Contains(err.Error(), wantErr) {
+   t.Errorf("error should contain:\n%s\ngot:\n%s\n", wantErr, 
err.Error())
}
 }
 



Bug#1071035: FAIL: TestGroup_deadlock

2024-05-13 Thread Reinhard Tartler
Source: golang-github-fatih-semgroup
Version: 1.2.0-2
Severity: serious
Justification: FTBFS

Your package fails to build from source, more specifically, when running the
test suite. I can reproduce on my amd64 laptop. Here is the relevant part of 
the log:

   dh_auto_test -O--builddirectory=_build -O--buildsystem=golang
cd _build && go test -vet=off -v -p 8 github.com/fatih/semgroup
=== RUN   TestGroup_single_task
--- PASS: TestGroup_single_task (0.00s)
=== RUN   TestGroup_multiple_tasks
--- PASS: TestGroup_multiple_tasks (0.00s)
=== RUN   TestGroup_multiple_tasks_errors
--- PASS: TestGroup_multiple_tasks_errors (0.00s)
=== RUN   TestGroup_deadlock
semgroup_test.go:92: error should be:
1 error(s) occurred:
* couldn't acquire semaphore: context canceled
got:
2 error(s) occurred:
* couldn't acquire semaphore: context canceled
* couldn't acquire semaphore: context canceled
--- FAIL: TestGroup_deadlock (0.00s)
=== RUN   TestGroup_multiple_tasks_errors_Is
--- PASS: TestGroup_multiple_tasks_errors_Is (0.00s)
=== RUN   TestGroup_multiple_tasks_errors_As
--- PASS: TestGroup_multiple_tasks_errors_As (0.00s)
=== RUN   ExampleGroup_parallel
--- PASS: ExampleGroup_parallel (0.00s)
=== RUN   ExampleGroup_withErrors
--- PASS: ExampleGroup_withErrors (0.00s)
FAIL
FAILgithub.com/fatih/semgroup   0.002s
FAIL
dh_auto_test: error: cd _build && go test -vet=off -v -p 8 
github.com/fatih/semgroup returned exit code 1




-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.7.12-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
sbuild (Debian sbuild) 0.85.8 (25 April 2024) on x1.int.tauware.de

+==+
| golang-github-fatih-semgroup 1.2.0-2 (amd64) Mon, 13 May 2024 10:17:26 + |
+==+

Package: golang-github-fatih-semgroup
Version: 1.2.0-2
Source Version: 1.2.0-2
Distribution: unstable
Machine Architecture: amd64
Host Architecture: amd64
Build Architecture: amd64
Build Type: binary

I: NOTICE: Log filtering will replace 
'var/run/schroot/mount/unstable-amd64-sbuild-c4abcda8-6c4c-46bc-a658-fa5bbda190de'
 with '<>'
I: NOTICE: Log filtering will replace 
'build/golang-github-fatih-semgroup-jAWYkc/resolver-Z2VXYh' with 
'<>'

+--+
| Update chroot|
+--+

Hit:1 http://127.0.0.1:3142/deb.debian.org/debian unstable InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

+--+
| Fetch source files   |
+--+


Local sources
-

/tmp/docker.io/golang-github-fatih-semgroup_1.2.0-2.dsc exists in 
/tmp/docker.io; copying to chroot
I: NOTICE: Log filtering will replace 
'build/golang-github-fatih-semgroup-jAWYkc/golang-github-fatih-semgroup-1.2.0' 
with '<>'
I: NOTICE: Log filtering will replace 
'build/golang-github-fatih-semgroup-jAWYkc' with '<>'

+--+
| Install package build dependencies   |
+--+


Setup apt archive
-

Merged Build-Depends: debhelper-compat (= 13), dh-sequence-golang, golang-any 
(>= 2:1.17~), golang-golang-x-sync-dev, build-essential, fakeroot
Filtered Build-Depends: debhelper-compat (= 13), dh-sequence-golang, golang-any 
(>= 2:1.17~), golang-golang-x-sync-dev, build-essential, fakeroot
dpkg-deb: building package 'sbuild-build-depends-main-dummy' in 
'/<>/apt_archive/sbuild-build-depends-main-dummy.deb'.
Ign:1 copy:/<>/apt_archive ./ InRelease
Get:2 copy:/<>/apt_archive ./ Release [609 B]
Ign:3 copy:/<>/apt_archive ./ Release.gpg
Get:4 copy:/<>/apt_archive ./ Sources [688 B]
Get:5 copy:/<>/apt_archive ./ Packages [720 B]
Fetched 2017 B in 0s (0 B/s)
Reading package lists...
Reading package lists...

Install main build dependencies (apt-based resolver)


Installing build dependencies
Reading package lists...
Building dependency tree...
Reading state information...
The following