GNU Mailutils fails its test suite on aarch64

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
  • Pierre Langlois
Owner
unassigned
Submitted by
Tobias Geerinckx-Rice
Severity
normal
T
T
Tobias Geerinckx-Rice wrote on 28 Aug 2020 17:19
(name . Bug Guix)(address . bug-guix@gnu.org)
87tuwmlrwu.fsf@nckx
Guix,
‘readmsg’ from mailutils@3.10 segfaults on aarch64, blocking
‘emacs’
and ‘emacs-no-x’, but not ‘emacs-minimal’.
--- ./readmsg/tests/testsuite.dir/4/testsuite.log
---------------------------

# -*- compilation -*-
4. hdr.at:17: testing readmsg -h ...
./hdr.at:17:
MAIL=$abs_top_srcdir/testsuite/spool/mbox1
FOLDER=$MAIL
export MAIL FOLDER
readmsg --no-site --no-user readmsg -h SOMETHING
--- /dev/null 2020-08-25 23:01:26.064000000 +0000
+++
/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stderr
2020-08-
27 15:25:42.447733149 +0000
@@ -0,0 +1 @@
+/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/test-source:
line 2
1: 30506 Segmentation fault readmsg --no-site --no-user
readmsg -h SOMETHING
--- - 2020-08-27 15:25:42.455592145 +0000
+++
/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stdout
2020-08-
27 15:25:42.451733151 +0000
@@ -1,17 +1,2 @@
From bar@dontmailme.org Fri Dec 28 23:28:09 2001
-Received: (from bar@dontmailme.org)
- by dontmailme.org id fERKR9N16790
- for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08
+0200
-Date: Fri, 28 Dec 2001 23:28:08 +0200
-From: Bar <bar@dontmailme.org>
-To: Foo Bar <foobar@nonexistent.net>
-Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
-Subject: Re: Jabberwocky
-
-It seems very pretty, but it's *rather* hard to understand!'
-Somehow it seems to fill my head with ideas -- only I don't
-exactly know what they are! However, SOMEBODY killed SOMETHING:
-that's clear, at any rate...
-
-
./hdr.at:17: exit code was 139, expected 0
4. hdr.at:17: 4. readmsg -h (hdr.at:17): FAILED (hdr.at:17)
Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCX0kgcQAKCRANsP+IT1Vt
eUAqAP9ITH2CkusARgzIeJnppZLJkUVJb+/iZLvyAMSPvEkXFwD/UhdNNYPW/1sn
L8meOKlUz2kjbnR3sZw+2aoNs4gkfwM=
=1hFp
-----END PGP SIGNATURE-----

P
P
Pierre Langlois wrote on 12 Sep 2020 14:24
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 43088@debbugs.gnu.org)
87wo0z6v4i.fsf@gmx.com
Hi Tobias,

Tobias Geerinckx-Rice via Bug reports for GNU Guix writes:

Toggle quote (52 lines)
> Guix,
>
> ‘readmsg’ from mailutils@3.10 segfaults on aarch64, blocking
> ‘emacs’
> and ‘emacs-no-x’, but not ‘emacs-minimal’.
>
> --- ./readmsg/tests/testsuite.dir/4/testsuite.log
> ---------------------------
>
> # -*- compilation -*-
> 4. hdr.at:17: testing readmsg -h ...
> ./hdr.at:17:
> MAIL=$abs_top_srcdir/testsuite/spool/mbox1
> FOLDER=$MAIL
> export MAIL FOLDER
> readmsg --no-site --no-user readmsg -h SOMETHING
> --- /dev/null 2020-08-25 23:01:26.064000000 +0000
> +++
> /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stderr
> 2020-08-
> 27 15:25:42.447733149 +0000
> @@ -0,0 +1 @@
> +/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/test-source:
> line 2
> 1: 30506 Segmentation fault readmsg --no-site --no-user readmsg -h
> SOMETHING
> --- - 2020-08-27 15:25:42.455592145 +0000
> +++
> /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stdout
> 2020-08-
> 27 15:25:42.451733151 +0000
> @@ -1,17 +1,2 @@
> From bar@dontmailme.org Fri Dec 28 23:28:09 2001
> -Received: (from bar@dontmailme.org)
> - by dontmailme.org id fERKR9N16790
> - for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
> -Date: Fri, 28 Dec 2001 23:28:08 +0200
> -From: Bar <bar@dontmailme.org>
> -To: Foo Bar <foobar@nonexistent.net>
> -Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
> -Subject: Re: Jabberwocky
> -
> -It seems very pretty, but it's *rather* hard to understand!'
> -Somehow it seems to fill my head with ideas -- only I don't
> -exactly know what they are! However, SOMEBODY killed SOMETHING:
> -that's clear, at any rate...
> -
> -
>
> ./hdr.at:17: exit code was 139, expected 0
> 4. hdr.at:17: 4. readmsg -h (hdr.at:17): FAILED (hdr.at:17)

I've been hit by this as well so I thought I'd look into it today, and I
think I found the problem! I just sent an email upstream to
bug-mailutils@gnu.org about it.

Essentially, we have a `weedc' variable that's not initialized, and on
aarch64 it gets initialized with `0xffff'. See

Here's the reproducer I just sent upstream:

```
$ export MAIL=/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/testsuite/spool/mbox1
$ export FOLDER=/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/testsuite/spool/mbox1
$ ... edit readmsg script so that `gdb --args' is prepended
$ /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/readmsg --no-site --no-user readmsg -h SOMETHING
...
(gdb) start
Temporary breakpoint 2 at 0x4034c8: file readmsg.c, line 463.
Starting program: /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/.libs/readmsg --no-site --no-user readmsg -h SOMETHING
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/cb88z63hyg1icd2kkahiink2p291mhr2-glibc-2.31/lib/libthread_db.so.1".

Temporary breakpoint 2, main (argc=6, argv=0xffffffffeb58) at readmsg.c:463
463 int *set = NULL;
(gdb) p weedc
$4 = 65535
(gdb) watch weedc
Hardware watchpoint 3: weedc
(gdb) c
Continuing.
From bar@dontmailme.org Fri Dec 28 23:28:09 2001

Program received signal SIGSEGV, Segmentation fault.
0x00000000004030a0 in print_header (message=0x470f90, unix_header=1, weedc=65535, weedv=0x4042c8 <__libc_csu_init>) at readmsg.c:353
353 if (weedv[j][0] == '!')
(gdb) p j
$5 = 0
(gdb) p weedv[j][0]
Cannot access memory at address 0x910003fda9bc7bfd
(gdb) up
#1 0x0000000000403a2c in main (argc=2, argv=0xffffffffeb78) at readmsg.c:580
580 print_header (msg, unix_header, weedc, weedv);
(gdb) p weedc
$6 = 65535
(gdb)
```

The test suite all passes if we initialize `int weedc = 0'!

Thanks,
Pierre
-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAl9cve0YHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UXDoH/A0B+U4V782fANjUy5ILMo1m
afpyI9W6zjbMRE66sLZmGRnwX4TavriJFiAj1b8ao13NM/ULyDSX0HQizTdGzowk
or5jRyRTlNFGsjzvAeR/tnxQFvWR4OTeLB8mlr6v3zNogl/7irS2Kllo0I80KVx2
eeYZ7V7wCM5v9nMshFTm7vTtEsU+qiCyjE80Xy1PW+7dUycsypcxGkInT9PL324I
SIgkppV8JGQuL+pPtBzHxK8MpfCbGAu07xwJy08p7nOBGO6kPIIBTR7yVn62KYp8
HMHmTjqczwAIzJ6BzwYsXk7I7PKa65fxtQ4smHsq6DYD1bvpryFEpct6ulD9uPc=
=4825
-----END PGP SIGNATURE-----

P
P
Pierre Langlois wrote on 13 Sep 2020 14:20
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 43088@debbugs.gnu.org)
87h7s17trd.fsf@gmx.com
Pierre Langlois writes:

Toggle quote (60 lines)
> Hi Tobias,
>
> Tobias Geerinckx-Rice via Bug reports for GNU Guix writes:
>
>> Guix,
>>
>> ‘readmsg’ from mailutils@3.10 segfaults on aarch64, blocking
>> ‘emacs’
>> and ‘emacs-no-x’, but not ‘emacs-minimal’.
>>
>> --- ./readmsg/tests/testsuite.dir/4/testsuite.log
>> ---------------------------
>>
>> # -*- compilation -*-
>> 4. hdr.at:17: testing readmsg -h ...
>> ./hdr.at:17:
>> MAIL=$abs_top_srcdir/testsuite/spool/mbox1
>> FOLDER=$MAIL
>> export MAIL FOLDER
>> readmsg --no-site --no-user readmsg -h SOMETHING
>> --- /dev/null 2020-08-25 23:01:26.064000000 +0000
>> +++
>> /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stderr
>> 2020-08-
>> 27 15:25:42.447733149 +0000
>> @@ -0,0 +1 @@
>> +/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/test-source:
>> line 2
>> 1: 30506 Segmentation fault readmsg --no-site --no-user readmsg -h
>> SOMETHING
>> --- - 2020-08-27 15:25:42.455592145 +0000
>> +++
>> /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/tests/testsuite.dir/at-groups/4/stdout
>> 2020-08-
>> 27 15:25:42.451733151 +0000
>> @@ -1,17 +1,2 @@
>> From bar@dontmailme.org Fri Dec 28 23:28:09 2001
>> -Received: (from bar@dontmailme.org)
>> - by dontmailme.org id fERKR9N16790
>> - for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
>> -Date: Fri, 28 Dec 2001 23:28:08 +0200
>> -From: Bar <bar@dontmailme.org>
>> -To: Foo Bar <foobar@nonexistent.net>
>> -Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
>> -Subject: Re: Jabberwocky
>> -
>> -It seems very pretty, but it's *rather* hard to understand!'
>> -Somehow it seems to fill my head with ideas -- only I don't
>> -exactly know what they are! However, SOMEBODY killed SOMETHING:
>> -that's clear, at any rate...
>> -
>> -
>>
>> ./hdr.at:17: exit code was 139, expected 0
>> 4. hdr.at:17: 4. readmsg -h (hdr.at:17): FAILED (hdr.at:17)
>
> I've been hit by this as well so I thought I'd look into it today, and I
> think I found the problem! I just sent an email upstream to
> bug-mailutils@gnu.org about it.

Cool, upstream fixed the bug! [0]

Here's a patch to apply the fix before we get the next release.

OK to commit?

Thanks,
Pierre

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

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAl9eDpYYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UIz8H/13KXBixOtvVFd0bAtmg5Dz7
DOxX2z1fJh1P/ttonJZ9qrbnRv2z46NCdU5Yc81dNd+g4QcyMqkeqQJAomy2TywS
0ZlZKYu8ziJhEhxLAlvxrSR+lNIc7N6zbOGyCn+WjQ9R9HPnr3SW6EwqhUqQLpnH
dau+FzNuc+Gc1v5dna62Cd99Fx4tqyRqsHiIcEjEhCC0pRaeJ+j/m0ywyQXLlhCZ
p0yl4Pgd3nL/vRal4vMKiNMPf4t1qpenWgdd+PbPeonsToccC4Ur8SFD/k0nSd5i
7FA+b6DZmOEkvth878rwvYE+B71/k2K19XA7/zxqEJHxrG8Vz4Oq7UfrqxWDsHo=
=Nd5E
-----END PGP SIGNATURE-----

From 0aac8082acd0c19a2d991376c7527053e196a1fd Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
Date: Sun, 13 Sep 2020 13:02:52 +0100
Subject: [PATCH] gnu: mailutils: Fix unitialized variable in readmsg.

Fixes mailutils on aarch64, see https://issues.guix.gnu.org/43088.

* gnu/packages/patches/mailutils-fix-uninitialized-variable.patch: New
file.
* gnu/packages/mail.scm (mailutils)[source]: Add patch.
* gnu/local.mk (dist_patch_DATA): Register patch.
---
gnu/local.mk | 1 +
gnu/packages/mail.scm | 5 +++-
...mailutils-fix-uninitialized-variable.patch | 26 +++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/mailutils-fix-uninitialized-variable.patch

Toggle diff (60 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1baa8405c5..6cdbe0d778 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1291,6 +1291,7 @@ dist_patch_DATA = \
%D%/packages/patches/luajit-no_ldconfig.patch \
%D%/packages/patches/luit-posix.patch \
%D%/packages/patches/lvm2-static-link.patch \
+ %D%/packages/patches/mailutils-fix-uninitialized-variable.patch \
%D%/packages/patches/make-impure-dirs.patch \
%D%/packages/patches/mariadb-client-test-32bit.patch \
%D%/packages/patches/mars-install.patch \
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 4a9c6fc90f..45d7877c27 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -197,7 +197,10 @@ example, modify the message headers or body, or encrypt or sign the message.")
version ".tar.xz"))
(sha256
(base32
- "17smrxjdgbbzbzakik30vj46q4iib85ksqhb82jr4vjp57akszh9"))))
+ "17smrxjdgbbzbzakik30vj46q4iib85ksqhb82jr4vjp57akszh9"))
+ (patches
+ ;; Fixes https://issues.guix.gnu.org/43088.
+ (search-patches "mailutils-fix-uninitialized-variable.patch"))))
(build-system gnu-build-system)
(arguments
`(#:phases
diff --git a/gnu/packages/patches/mailutils-fix-uninitialized-variable.patch b/gnu/packages/patches/mailutils-fix-uninitialized-variable.patch
new file mode 100644
index 0000000000..2a1c81648b
--- /dev/null
+++ b/gnu/packages/patches/mailutils-fix-uninitialized-variable.patch
@@ -0,0 +1,26 @@
+From 5ca6382fe8adb5bc436a6d873c8b86c69d5abfd1 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Sun, 13 Sep 2020 14:43:46 +0300
+Subject: [PATCH] Fix uninitialized variable in readmsg
+
+* readmsg/readmsg.c (main): Initialize weedc.
+---
+ readmsg/readmsg.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
+index 9f305bb9c..3a9f420db 100644
+--- a/readmsg/readmsg.c
++++ b/readmsg/readmsg.c
+@@ -466,7 +466,7 @@ main (int argc, char **argv)
+ mu_mailbox_t mbox = NULL;
+ struct mu_wordsplit ws;
+ char **weedv;
+- int weedc;
++ int weedc = 0;
+ int unix_header = 0;
+
+ /* Native Language Support */
+--
+2.28.0
+
--
2.28.0
L
L
Ludovic Courtès wrote on 16 Sep 2020 18:41
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)
87a6xpn06m.fsf@gnu.org
Hi Pierre,

Well done!

Pierre Langlois <pierre.langlois@gmx.com> skribis:

Toggle quote (7 lines)
> From 0aac8082acd0c19a2d991376c7527053e196a1fd Mon Sep 17 00:00:00 2001
> From: Pierre Langlois <pierre.langlois@gmx.com>
> Date: Sun, 13 Sep 2020 13:02:52 +0100
> Subject: [PATCH] gnu: mailutils: Fix unitialized variable in readmsg.
>
> Fixes mailutils on aarch64, see <https://issues.guix.gnu.org/43088>.

For easier grepping, I recommend always writing:


Toggle quote (5 lines)
> * gnu/packages/patches/mailutils-fix-uninitialized-variable.patch: New
> file.
> * gnu/packages/mail.scm (mailutils)[source]: Add patch.
> * gnu/local.mk (dist_patch_DATA): Register patch.

Otherwise LGTM, thank you! It’s OK to push on ‘master’.

Ludo’.
P
P
Pierre Langlois wrote on 16 Sep 2020 21:03
(name . Ludovic Courtès)(address . ludo@gnu.org)
87a6xp7ddq.fsf@gmx.com
Hi Ludo,

Ludovic Courtès writes:

Toggle quote (18 lines)
> Hi Pierre,
>
> Well done!
>
> Pierre Langlois <pierre.langlois@gmx.com> skribis:
>
>> From 0aac8082acd0c19a2d991376c7527053e196a1fd Mon Sep 17 00:00:00 2001
>> From: Pierre Langlois <pierre.langlois@gmx.com>
>> Date: Sun, 13 Sep 2020 13:02:52 +0100
>> Subject: [PATCH] gnu: mailutils: Fix unitialized variable in readmsg.
>>
>> Fixes mailutils on aarch64, see <https://issues.guix.gnu.org/43088>.
>
> For easier grepping, I recommend always writing:
>
> Fixes <https://bugs.gnu.org/NNN>.
>

Cool, done.

Toggle quote (7 lines)
>> * gnu/packages/patches/mailutils-fix-uninitialized-variable.patch: New
>> file.
>> * gnu/packages/mail.scm (mailutils)[source]: Add patch.
>> * gnu/local.mk (dist_patch_DATA): Register patch.
>
> Otherwise LGTM, thank you! It’s OK to push on ‘master’.

Thanks! Pushed as 891b045f3848596c8939e31e80185f31448cade1

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

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAl9iYYEYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UteAIAJlmzrxyFS6UW/nYowePUjq0
e0v/wQsMC1vYG7PB2mU/t7fd7Z2687psnzGgETpqOG61LvSCAwaLryGGcOp7Iu1E
mZL4PzXGDLlc3nTm75uSjcampd53PgJuB68HmFg/e3lH/8JjBmlP958Fp4wfNChj
VlVm90BiczJYahP0tx/924ylCYgedYW4orXI9Xd4V0UzH9UXHYosaupJrCRcpMCG
VdGUhJdysIDkB/ANDvKP99VB8fb8OwhLFiuq/O6X+yaZvRa74YtLU1APbOdhT1Bp
7hSh//5OKLMvPNd+hOt1XeiBgHmhVguVv2LaBuniR+6vPEky8Rv3Y+S9lEQkqD8=
=ltri
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 43088@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 43088
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch