Hello Felix,

Felix Fontein <[email protected]> wrote:
 |I've noticed that the new version of s-nail (14.9.0) now prints
 |warnings and segfaults when $HOME of the current user is not writable.

This is bitter!  Thank you very much for reporting this bug!

 |I'm using it to send mail from a cronjob of my http user, which has no
 |write-access to its home folder.
 |
 |The previous versions (14.8.16 and earlier) did neither print these
 |warnings nor segfaulted.

I consider these new verifications an improvement, you need to
redirect standard error to /dev/null to get rid of those (i.e.,
"echo test | sudo -u http mail my@self 2>/dev/null", then).

(The idea is that we now catch things when they get set as
necessary, and can use them without further tests from then on.
Having said this...)

 |I'm using Arch Linux, my server's architecture is x86_64. Steps to
 |reproduce:
 |
 |  # ls -lah /home | grep http
 |  dr-xr-x--- 7 http http 4.0K Jun  3 11:53 http
 |
 |  # echo test | sudo -u http mail my@self
 |  mail: $HOME is not a directory or not accessible: /home/http
 |  mail: $TMPDIR is not a directory or not accessible: /home/http
 |  mail: Assignment of variable aborted: HOME
 |  Segmentation fault

Yes, that is a programming error where the code flow does not
actually represent the comment, which in turn is correct!  Sic!
What a pity!  ^.^

I fixed it accordingly in the other window and will push it in
a few seconds, but this will not help you.  As a workaround, set
HOME to any directory that can be written to, i would suggest /tmp:

  ?0[tmp]# echo bla |
  su -c 'LC_ALL=C /bin/mail -d -:/ -s sub -X"var HOME TMPDIR" a@b' \
    noone
  mail: $HOME is not a directory or not accessible: /var/empty
  mail: $TMPDIR is not a directory or not accessible: /var/empty
  mail: Assignment of variable aborted: HOME
  mail: -X OPTION 15 bytes <var HOME TMPDIR>
  #nodelete,notempty,import-environ-first,sync-environ
    #variable not set: HOME
  #notempty,import-environ-first,sync-environ,default-value
    set TMPDIR=/tmp
  mail: >>> MTA: /usr/sbin/sendmail, arguments: sendmail -i -- a@b
  mail: >>> Date: Sat, 22 Jul 2017 23:30:04 +0200
  mail: >>> To: a@b
  mail: >>> Subject: sub
  mail: >>> User-Agent: mail v14.9.0
  mail: >>> 
  mail: >>> bla

Note the crash actually happens because you allow loading of the
(nonexistent?) ~/.mailrc, so we try to expand ~/ but $HOME is not
set because of the programming error.  So if you need no setting
from /etc/mail.rc or ~{-> /home/http}/.mailrc, then simply set -:/
and be fine with it.  (-:s loads only /etc/mail.rc.)  Otherwise
set HOME=/tmp, as in

  ?0[tmp]# echo bla |
  su -c 'LC_ALL=C HOME=/tmp /bin/mail -s sub a@b' noone #2>/dev/null

Hope this helps!
Thanks again for reporting the error, you have a credit.
Ciao.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
__________________________________
[email protected]

Reply via email to