FS#37161 - [s-nail] I get "Segmentation fault (core dumped)" with settings that work with heirloom-mailx
Attached to Project:
Arch Linux
Opened by Karol Błażewicz (karol) - Wednesday, 02 October 2013, 00:49 GMT
Last edited by Gaetan Bisson (vesath) - Thursday, 03 October 2013, 16:26 GMT
Opened by Karol Błażewicz (karol) - Wednesday, 02 October 2013, 00:49 GMT
Last edited by Gaetan Bisson (vesath) - Thursday, 03 October 2013, 16:26 GMT
|
Details
I use mailx to send e-mails to my gmail account. My
/etc/mail.rc setup works with heirloom-mailx but not with
s-nail:
$ echo "foo" | mailx -s "test" karol.blazewicz@gmail.com Segmentation fault (core dumped) How to debug this? |
This task depends upon
Closed by Gaetan Bisson (vesath)
Thursday, 03 October 2013, 16:26 GMT
Reason for closing: Fixed
Additional comments about closing: s-nail-14.4.3-1 in [testing]
Thursday, 03 October 2013, 16:26 GMT
Reason for closing: Fixed
Additional comments about closing: s-nail-14.4.3-1 in [testing]
- get the PKGBUILD
- add options=('debug') to it
- run makepkg in the same directory
- install the resulting package
- run `gdb mailx`
- in gdb, type `run -s test`
- when the segfault appears, type `bt` in gdb
- post output here
I cannot reproduce your issue either, but since there is some doubt on the stability of s-nail I will hold back from moving it to [core] until we can get to the bottom of this.
$ gdb mailx
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/mail...Reading symbols from /usr/lib/debug/usr/bin/mail.debug...(no debugging symbols found)...done.
(no debugging symbols found)...done.
(gdb) run -s test
Starting program: /usr/bin/mailx -s test
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Send options without primary recipient specified.
Synopsis:
mailx [-BDdEFintv~] [-A acc] [-a attachment] [-b bcc-addr] [-c cc-addr]
[-O mtaopt [-O mtaopt-arg]] [-q file] [-r from-addr] [-S var[=value]]
[-s subject] to-addr...
mailx [-BDdEeHiNnRv~#] [-A acct] [-S var[=value]] -f [file]
mailx [-BDdEeiNnRv~#] [-A acc] [-S var[=value]] [-u user]
[Inferior 1 (process 27128) exited with code 02]
(gdb) bt
No stack.
Then I tried with the recipient:
(gdb) run -s test karol
Starting program: /usr/bin/mailx -s test karol
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
test test
^DEOT
Program received signal SIGSEGV, Segmentation fault.
0x0807f4f2 in ?? ()
(gdb) bt
#0 0x0807f4f2 in ?? ()
#1 0x0807cd5b in ?? ()
#2 0x0807d131 in ?? ()
#3 0x0807ebbe in ?? ()
#4 0x0807ed67 in ?? ()
#5 0x0806d981 in ?? ()
#6 0xb7bd59d3 in __libc_start_main () from /usr/lib/libc.so.6
#7 0x0804b2d1 in ?? ()
$ pacman -Qi s-nail-debug | grep -e Name -e Description -e Depends
Name : s-nail-debug
Description : Detached debugging symbols for s-nail
Depends On : s-nail=14.4.2-2
$ pacman -Ql s-nail-debug
s-nail-debug /usr/
s-nail-debug /usr/lib/
s-nail-debug /usr/lib/debug/
s-nail-debug /usr/lib/debug/.build_id/
s-nail-debug /usr/lib/debug/.build_id/0d/
s-nail-debug /usr/lib/debug/.build_id/0d/3374be8da580590bd65d161a609b74c47e3153
s-nail-debug /usr/lib/debug/.build_id/0d/3374be8da580590bd65d161a609b74c47e3153.debug
s-nail-debug /usr/lib/debug/usr/
s-nail-debug /usr/lib/debug/usr/bin/
s-nail-debug /usr/lib/debug/usr/bin/mail.debug
Should I open a thread on the forums not to clutter the bug tracker with discussion how to properly debug stuff?
I'm new to Arch Linux, however, and have yet zero knowledge of the package manager.
Assuming that it has downloaded the s-nail-14_4_2.tar.gz tarball to your system, you could also simply extract that and run 'make WANT_ASSERTS=1', then run 'gdb ./s-nail', just as Gaetan Bisson has shown.
If that doesn't crash, maybe run 'make WANT_ASSERTS=1 PREFIX=/usr SYSCONFDIR=/etc MANDIR=/usr/share/man MAILSPOOL=/var/spool/mail SID= NAIL=mail DESTDIR=pkg install', and then try to crash ./pkg/bin/mail. (This is the configuration that Arch Linux uses to install mailx(1).)
Whatever you do, please ensure that the shown CFLAGS include the '-g' flag, because that enables debugging symbols. You may simply pass CFLAGS='-O2 -g' to the shown make(1) invocations, too.
If you get a backtrace i'm happy to see that.
Below is the 'make WANT_ASSERTS=1' magic:
$ gdb ./s-nail
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/karol/apps/s-nail/src/s-nail-14.4.2/s-nail...done.
(gdb) run -s test karol
Starting program: /home/karol/apps/s-nail/src/s-nail-14.4.2/./s-nail -s test karol
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
test
^DEOT
Program received signal SIGSEGV, Segmentation fault.
0xb7c3e016 in __strlen_sse2_bsf () from /usr/lib/libc.so.6
(gdb) bt
#0 0xb7c3e016 in __strlen_sse2_bsf () from /usr/lib/libc.so.6
#1 0x0808978c in smtp_auth_var (atype=atype@entry=0x809c5b7 "-user", addr=addr@entry=0x0) at smtp.c:316
#2 0x08086293 in start_mta (to=to@entry=0x80a84d0 <_builtin_buf+16>, input=input@entry=0x80ca678, hp=hp@entry=0xbffff500) at sendout.c:894
#3 0x08086936 in transfer (to=to@entry=0x80a84d0 <_builtin_buf+16>, input=input@entry=0x80ca678, hp=hp@entry=0xbffff500) at sendout.c:848
#4 0x08088d2f in mail1 (hp=hp@entry=0xbffff500, printheaders=printheaders@entry=0, quote=quote@entry=0x0, quotefile=quotefile@entry=0x0,
recipient_record=recipient_record@entry=0, doprefix=doprefix@entry=0) at sendout.c:1186
#5 0x08088e82 in mail (to=0x80a84d0 <_builtin_buf+16>, cc=0x0, bcc=0x0, subject=0xbffff898 "test", attach=0x0, quotefile=quotefile@entry=0x0,
recipient_record=0) at sendout.c:766
#6 0x0804c429 in main (argc=4, argv=0xbffff684) at main.c:712
I posted what Steffen Nurpmeso (sdaoden) asked me to do: compiled with 'make WANT_ASSERTS=1' and run 'gdb ./s-nail'.
They should not be enabled for i686 builds; I wonder what calls __strlen_sse2_bsf and/or whether I forgot to turn them off somewhere...
Sorry for the trouble Steffen, apparently this has nothing to do with your code, it looks like my own packaging mistake... :)
And thanks a lot for posting this, Karol!
I can reproduce the segmentation fault if i ensure neither *from* nor *hostname* are set, and am looking into this.
@Gaetan: it's not worth the effort, that new package will include all the necessary things.
Thanks.
:)
Karol, thanks again for reporting this dumbness of mine!
It's a one-line problem i've introduced last year, i didn't know much of the code and tried to get through, moving around things and slightly changing to a syntax that i can deal with. Unfortunately it seems that i have been sloppy sometimes.
The attached patch corrects the problem, but i will release 14.4.3 in a few minutes, too.
Ciao.