Usermin not moving mail files

SYSTEM INFORMATION
OS type and version Rocky Linux 9.8
Webmin version 2.641
Usermin version 2.540
Virtualmin version 8.1.0 GPL
Theme version 26.41.1
Apache version 2.4.62
Package updates All installed packages are up to date

Hi, I recently started using Usermin for my personal email and I have just noticed that it is not moving or copying mail over to the chosen required folder.

There was another post somewhat related to this but has been closed after the 60 day closure setup.

Not just my main PC but others as well.

Any ideas what could be up?

I ran fix permissions, all seems fine.

David

Is it not moving it at all or is it going to the wrong folder. Seems there was an ‘off by one’ problem a while back.

Also, have you tried another browser? I see you have tried different machines but if it is the same OS/Browser combination that could be a problem. Not likely but easy to check?

Hi, thanks, not moving or copying, I think once it moved an email I did not even select, that was a one off, will try another browser as you suggest. Usually use Edge on Win 11

David

Same issue in Firefox latest release.

Thanks again.

David

Just noticed I cannot drag an email to a folder either, not sure if that is normal behavior as I have just started using UM. It seems quite nice actually.

David

If I hit the move or copy button I just go up one level. Not even a choice on what to do as far as I can tell.

As I click move or just copy it seems to go through the process of doing it but nothing gets moved or copied. Bug maybe, more than likely my fault though.

David

It just moved an email I did not choose again, when I clicked to copy and not move, the file I actually chose did not get copied but another did?

That does not happen every-time though.

Weird scenes inside the gold mine as Jim Morrison once sang about.

@Le_Gallois

Could you try the following patch? Run the commands below to apply it and see if it helps:

sudo webmin patch https://patch-diff.githubusercontent.com/raw/webmin/webmin/pull/2744.patch
sudo cp /usr/share/webmin/mailboxes/boxes-lib.pl /usr/share/usermin/mailbox/boxes-lib.pl
sudo cp /usr/share/webmin/mailboxes/folders-lib.pl /usr/share/usermin/mailbox/folders-lib.pl
sudo systemctl restart usermin webmin

Hi Ilia, the second and third commands I get …

cp: cannot stat ‘/usr/share/webmin/mailboxes/boxes-lib.pl’: No such file or directory …

No /usr/share/webmin folder, that sounds serious.

I did a fresh install of Rocky 9 the other day, upgraded PHP then yesterday Rocky upgraded to 9.8

Problem was there before Rocky upgrade but I was ignoring it.

That’s about it.

Thanks.

David

Actually looks like the patch fails as well, first time it just pushed to a new line so I thought it was ok.

Output below.

sudo webmin patch https://patch-diff.githubusercontent.com/raw/webmin/webmin/pull/2744.patch
Patch failed: Checking patch mailboxes/boxes-lib.pl...
error: while searching for:
                $i++;
                next;
                }
        local $mail = &read_mail_file($f, $_[3]);
        $mail->{'idx'} = $i++;
        $mail->{'id'} = $f;     # ID is relative path, like cur/4535534
        $mail->{'id'} = substr($mail->{'id'}, length($_[0])+1);
        push(@rv, $mail);
        }
return @rv;

error: patch failed: mailboxes/boxes-lib.pl:2087
error: while searching for:
sub select_maildir
{
local ($file, $ids, $headersonly) = @_;
&mark_read_maildir($file);
local @files = &get_maildir_files($file);
local @rv;
foreach my $i (@$ids) {
        local $path = "$file/$i";
        local $mail = &read_mail_file($path, $headersonly);

error: patch failed: mailboxes/boxes-lib.pl:2110
error: while searching for:
                # Get index in directory
                $mail->{'idx'} = &indexof($path, @files);
                }
        push(@rv, $mail);
        }
return @rv;
}


error: patch failed: mailboxes/boxes-lib.pl:2139
error: while searching for:
        # Check the on-disk cache file
        local $cachefile = &get_maildir_cachefile($_[0]);
        local @cst = $cachefile ? stat($cachefile) : ( );
        if ($cst[9] >= $newest) {
                # Can read the cache
                open(CACHE, "<", $cachefile);
                while(<CACHE>) {

error: patch failed: mailboxes/boxes-lib.pl:2167
Checking patch mailboxes/folders-lib.pl...
error: while searching for:
        local $count = $rv[2];
        return () if (!$count);
        $_[2]->{'lastchange'} = $rv[3] if ($rv[3]);

        # Work out what range we want
        local ($start, $end) = &compute_start_end($_[0], $_[1], $count);

error: patch failed: mailboxes/folders-lib.pl:174
error: while searching for:
                }
        local $h = $irv[1];
        local $count = $irv[2];
        return () if (!$count);
        $folder->{'lastchange'} = $irv[3] if ($irv[3]);


error: patch failed: mailboxes/folders-lib.pl:458
error: while searching for:
                }
        local $h = $rv[1];
        local $count = $rv[2];
        return () if (!$count);
        $folder->{'lastchange'} = $irv[3] if ($irv[3]);

        @rv = &imap_command($h, "FETCH 1:$count UID");
        foreach my $uid (@{$rv[1]}) {

error: patch failed: mailboxes/folders-lib.pl:637
error: while searching for:
sub mailbox_list_mails_sorted
{
local ($start, $end, $folder, $headersonly, $error, $field, $dir) = @_;
print DEBUG "mailbox_list_mails_sorted from $start to $end\n";
if (!$field) {
        # Default to current ordering

error: patch failed: mailboxes/folders-lib.pl:708
error: while searching for:
local @wantids = map { $sorter[$_] } ($start .. $end);
print DEBUG "wantids = ",scalar(@wantids),"\n";
local @mails = &mailbox_select_mails($folder, \@wantids, $headersonly);
for(my $i=0; $i<@mails; $i++) {
        $rv[$start+$i] = $mails[$i];
        print DEBUG "setting $start+$i to ",$mails[$i]," id ",$wantids[$i],"\n";
        $mails[$i]->{'sortidx'} = $start+$i;
        }
print DEBUG "rv = ",scalar(@rv),"\n";
return @rv;
}

error: patch failed: mailboxes/folders-lib.pl:738
error: while searching for:
&open_dbm_db($index, $ifile, 0600);
print DEBUG "indexchange=$index->{'lastchange'} folderchange=$folder->{'lastchange'}\n";
if ($index->{'lastchange'} != $folder->{'lastchange'} ||
    !$folder->{'lastchange'}) {
        # The mail file has changed .. get IDs and update the index with any
        # that are missing
        local @ids = &mailbox_idlist($folder);

error: patch failed: mailboxes/folders-lib.pl:808
error: while searching for:
        local @mails = scalar(@newids) ?
                        &mailbox_select_mails($folder, \@newids, 1) : ( );
        foreach my $mail (@mails) {
                foreach my $f (@index_fields) {
                        if ($f eq "date") {
                                # Convert date to Unix time

error: patch failed: mailboxes/folders-lib.pl:823
Checking patch mailboxes/mailboxes-lib.pl...
error: while searching for:
# Show rows for actual mail messages
my $i = 0;
foreach my $mail (@mail) {
        local $idx = $mail->{'idx'};
        local $cols = 0;
        local @cols;

error: patch failed: mailboxes/mailboxes-lib.pl:1209
Applying patch mailboxes/boxes-lib.pl with 4 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Rejected hunk #4.
Applying patch mailboxes/folders-lib.pl with 7 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Rejected hunk #4.
Rejected hunk #5.
Rejected hunk #6.
Rejected hunk #7.
Applying patch mailboxes/mailboxes-lib.pl with 1 reject...
Rejected hunk #1.

Would you like me to send you the VM install log?

Thanks again.

David

More strange behaviour …

If you actually read an email and click the move option it immediately deletes the email and you see it in trash, if you click copy the email to a folder, it copies it to trash.

Might be more odd things happening, will post if and when I come across them.

David

From Trash I can move emails to the inbox or sent but not to any of the extra folders I have created.

Will leave it at that for now.

David

In your case, for the patch to work, you need to run dnf reinstall usermin webmin first, and then run it again. For the second set of commands, use /usr/libexec instead of /usr/share in the paths.

The complete set would be:

sudo dnf reinstall usermin webmin -y
sudo webmin patch https://patch-diff.githubusercontent.com/raw/webmin/webmin/pull/2744.patch
sudo cp /usr/libexec/webmin/mailboxes/boxes-lib.pl /usr/libexec/usermin/mailbox/boxes-lib.pl
sudo cp /usr/libexec/webmin/mailboxes/folders-lib.pl /usr/libexec/usermin/mailbox/folders-lib.pl
sudo systemctl restart usermin webmin

What is the output of the check on the “Limits and Validation ⇾ Validate Virtual Servers / Fix Permissions” page?

Thanks Ilia.

Output is …

Beginning validation of selected virtual servers. Any problems found will be shown in red ..
mydomain.fr
All features are good
.. done

Ran those commands, patch went ok and others but no resultant joy , problem persists. : (

I can move to trash though, not sure I tried that earlier.

In no rush to solve this, if you want root access let me know. Nothing critical anymore on the server, basically retired here.

I have one more issue with the server and IPV6 but I will start another post, Gmail not happy as usual.

David

Actually, where I said about reading a email and trying to move and it goes to trash, ignore that, my fault, I did not see that trash was default send to.

I chose a folder that I created but get this …

Guessing that is normal?

It is not copying either though.

David

Ok, I see the problem.

I created virtual folders.

Geez, I feel silly.

I deleted the folders and created new.

Not virtual ones, all seems ok, but still not explain some oddities like wrong emails being moved or copying to virtual folders etc…

All seems good.

Sorry to waste your time Iila and Idiot.

David

Your mail folders should be created as “Local mail file,” not as a “Virtual folder”.