Description
In some cases, the imapsync task stops because of errors while trying to access or process messages located in subfolders under Public and Shared.
The current default exclusion configured in syncctl is:
--exclude '^Public$|^Shared$'"${exclude_regex}"
However, this only excludes the top-level Public and Shared folders. It does not exclude their subfolders, which may still be processed and cause the task to fail.
Steps to reproduce
-
Run a syncctl / imapsync task using the default exclusion rule:
--exclude '^Public$|^Shared$'"${exclude_regex}"
-
Use an IMAP account where Public or Shared contains subfolders, such as:
Public/Junk
Shared/estero/Archive/2020
-
Start the synchronization task.
-
Notice that subfolders under Public and Shared are not excluded and imapsync attempts to process them.
-
The task may stop with ERR_SELECT / EXIT_ERR_SELECT errors caused by permission, folder creation, or server-side access errors.
Examples from task logs
Example 1:
Err 1/1: Host1 folder Public/Junk: Could not select: 1388 NO [NOPERM] Permission denied (0.001 + 0.000 secs).
The most frequent error is ERR_SELECT.
Exiting with return value 117 (EXIT_ERR_SELECT) 1/50 nb_errors/max_errors PID 3889
Example 2:
Could not create folder [Shared/estero/Archive/2020] from [Shared/estero/Archive/2020]: 218 NO [CANNOT] Mailbox can't be created (0.103 + 0.000 + 0.102 secs).
Err 46/50: Host2 folder Shared/estero/Archive/2020: Could not select: 220 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2026-05-19 12:58:35] (0.116 + 0.000 + 0.115 secs).
Current behavior
Subfolders such as the following are not excluded:
Public/Junk
Shared/estero/Archive/2020
As a result, imapsync attempts to select or create these folders and may fail with errors such as:
ERR_SELECT
EXIT_ERR_SELECT
NOPERM Permission denied
CANNOT Mailbox can't be created
SERVERBUG Internal error occurred
Expected behavior
All folders under Public and Shared should be excluded by default, including their subfolders, so that imapsync does not attempt to select, create, or synchronize them.
Suggested fix
Update the default exclusion from:
--exclude '^Public$|^Shared$'"${exclude_regex}"
to:
--exclude '^Shared(/.*)?$|^Public(/.*)?$'"${exclude_regex}"
This would exclude both the top-level folders and all their subfolders, for example:
Shared
Shared/estero
Shared/estero/Archive/2020
Public
Public/Junk
Components
ns8-imapsync
Note:
Ticket Ref: #202736 - #202043
Description
In some cases, the
imapsynctask stops because of errors while trying to access or process messages located in subfolders underPublicandShared.The current default exclusion configured in
syncctlis:However, this only excludes the top-level
PublicandSharedfolders. It does not exclude their subfolders, which may still be processed and cause the task to fail.Steps to reproduce
Run a
syncctl/imapsynctask using the default exclusion rule:Use an IMAP account where
PublicorSharedcontains subfolders, such as:Start the synchronization task.
Notice that subfolders under
PublicandSharedare not excluded andimapsyncattempts to process them.The task may stop with
ERR_SELECT/EXIT_ERR_SELECTerrors caused by permission, folder creation, or server-side access errors.Examples from task logs
Example 1:
Example 2:
Current behavior
Subfolders such as the following are not excluded:
As a result,
imapsyncattempts to select or create these folders and may fail with errors such as:Expected behavior
All folders under
PublicandSharedshould be excluded by default, including their subfolders, so thatimapsyncdoes not attempt to select, create, or synchronize them.Suggested fix
Update the default exclusion from:
to:
This would exclude both the top-level folders and all their subfolders, for example:
Components
ns8-imapsync
Note:
Ticket Ref: #202736 - #202043