Bug#980042: mailutils: does not remove extracted emails

2021-02-02 Thread Pierrick CHANTEUX
Hello,

I've been hit by the same bug while trying to delete some messages in my
local mbox with the regular "mail" command. I'm also running mailutils
3.11.1-4 on a sid machine.

While investigating I found out that version 3.11 of mailutils
introduced a rewrite of their traditional mbox handling code. According
to the source code of that "mboxrd" component (libproto/mbox/mboxrd.c),
it appears that when flushing mbox changes to disk, the program will
create and write to a temporary mailbox. If it succeeds, it will then
rename it to your current mbox name. This behavior seems incompatible
with the permissions of /var/mail on a Debian system (2775 root:mail).

When running strace on "mail", I've found this just after issuing the
'quit' command, which seems to confirm the problem :
openat(AT_FDCWD, "/var/mail/username", O_RDWR) = 6
fcntl(6, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0,
l_len=0}) = 0
rt_sigprocmask(SIG_BLOCK, [HUP INT TERM TSTP WINCH], NULL, 8) = 0
msync(0x7f469e481000, 16357, MS_SYNC)   = 0
fstat(4, {st_mode=S_IFREG|0660, st_size=16357, ...}) = 0
stat("/var/mail", {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/var/mail/muMAULJT", O_RDWR|O_CREAT|O_EXCL, 0600) = -1
EACCES (Permission non accordée)

NOTE : "Permission non accordée" translates to "Permission denied"

It's also worth noting that running 'mail -u username' as root works and
I can delete my messages, but it modifies /var/mail/username permissions
(0600 root:mail instead of 0660 username:mail), as expected with that
temporary mbox + renaming way of doing.

Best regards,
-- 
Pierrick CHANTEUX
Service Informatique
Institut de Physique du Globe de Paris
1, rue Jussieu - 75005 Paris



Bug#980042: mailutils: does not remove extracted emails

2021-01-13 Thread Florent Rougon
Package: mailutils
Version: 1:3.11.1-4
Severity: important

Dear maintainer,

Since I upgraded mailutils from 1:3.10-3+b1 to 1:3.11.1-2 a couple of
days ago, movemail doesn't remove extracted emails anymore from the
source mbox file (I do *not* use option --keep-messages).

Example:

  1) Verify that /var/mail/$USER is empty.

  2) echo Bla | mail -s "Test movemail" $USER

  3) 'ls -l /var/mail/$USER' now reports size 573 bytes (it contains the
 test email sent in step 2).

  4) /usr/bin/movemail.mailutils /var/mail/$USER /tmp/extracted-mail

  5) No error reported, test email was properly extracted to
 /tmp/extracted-mail, but /var/mail/$USER is still 573 bytes long.

This has the following consequence when I use my mail client (Gnus,
which can use movemail to read mbox files): since the upgrade to
mailutils 1:3.11.1-2, *every time I check my mail box*, new copies of
every email stored in /var/mail/$USER are retrieved. A nightmare...

I verified yesterday that the following downgrade of mailutils fixes the
problem:

  [REMOVE, NOT USED] libmailutils8:amd64 1:3.11.1-2
  [INSTALL, DEPENDENCIES] libmailutils7:amd64 1:3.10-3+b1
  [DOWNGRADE] mailutils:amd64 1:3.11.1-2 -> 1:3.10-3+b1
  [DOWNGRADE] mailutils-common:amd64 1:3.11.1-2 -> 1:3.10-3

Today, I upgraded to the latest version in unstable (1:3.11.1-4).
Unfortunately, this caused the problem to reappear, hence this report.

Thanks for your work, kind regards.

Florent

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-1-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mailutils depends on:
ii  libc6 2.31-9
ii  libcrypt1 1:4.4.17-1
ii  libfribidi0   1.0.8-2
ii  libgnutls30   3.7.0-5
ii  libgsasl7 1.10.0-3
ii  libldap-2.4-2 2.4.56+dfsg-1
ii  libmailutils8 1:3.11.1-4
ii  libncurses6   6.2+20201114-2
ii  libpam0g  1.4.0-2
ii  libreadline8  8.1-1
ii  libtinfo6 6.2+20201114-2
ii  libunistring2 0.9.10-4
ii  mailutils-common  1:3.11.1-4

Versions of packages mailutils recommends:
ii  postfix [mail-transport-agent]  3.5.6-1

Versions of packages mailutils suggests:
pn  mailutils-doc  
pn  mailutils-mh   

-- no debconf information