Steps to reproduce
- Create an imapsync task with a frequent cron schedule (e.g.
CRON=3m) and FOLDER_INBOX empty (full folder synchronization).
- Read the source mailbox only through WebTop; never log into the remote source account.
- Mark an email as read in WebTop.
- Wait for the next cron run.
Expected behavior
An email marked as read in WebTop stays read. The read status set locally should not be overwritten by the periodic sync.
Actual behavior
The email reverts to unread. On each run imapsync resyncs all flags (including \Seen) from the source. Because the source mailbox is never touched, its message stays \Unseen, so imapsync overwrites the \Seen flag set in WebTop. With a 3-minute cron this happens every few minutes.
Root cause is in syncctl. The --noresyncflags option (which would prevent this) is applied only when FOLDER_INBOX is set:
# line 80-82
if [[ -n "${FOLDER_INBOX}" ]] ; then
sync_unseen=1
...
fi
# line 101
${sync_unseen:+--search1=UNSEEN --setflag1=Seen --noresyncflags} \
When FOLDER_INBOX is empty, sync_unseen is never set, so --noresyncflags is never passed and imapsync's default flag resync overwrites WebTop's read status.
--noresyncflags and FOLDER_INBOX are currently tied together in the code but solve two different problems: FOLDER_INBOX limits which folders are synced, --noresyncflags prevents flag overwrite. In cron mode flags should not be resynced regardless of the FOLDER_INBOX value.
Design question for the fix: apply --noresyncflags always by default, or only when the task runs on a frequent cron schedule.
Workaround: enable FOLDER_INBOX (inbox only), which activates --search1=UNSEEN --setflag1=Seen --noresyncflags.
Components
- NethServer 8
- ns8-imapsync 1.2.7
- ns8-webtop 1.5.7
See also
Steps to reproduce
CRON=3m) andFOLDER_INBOXempty (full folder synchronization).Expected behavior
An email marked as read in WebTop stays read. The read status set locally should not be overwritten by the periodic sync.
Actual behavior
The email reverts to unread. On each run imapsync resyncs all flags (including
\Seen) from the source. Because the source mailbox is never touched, its message stays\Unseen, so imapsync overwrites the\Seenflag set in WebTop. With a 3-minute cron this happens every few minutes.Root cause is in
syncctl. The--noresyncflagsoption (which would prevent this) is applied only whenFOLDER_INBOXis set:When
FOLDER_INBOXis empty,sync_unseenis never set, so--noresyncflagsis never passed and imapsync's default flag resync overwrites WebTop's read status.--noresyncflagsandFOLDER_INBOXare currently tied together in the code but solve two different problems:FOLDER_INBOXlimits which folders are synced,--noresyncflagsprevents flag overwrite. In cron mode flags should not be resynced regardless of theFOLDER_INBOXvalue.Design question for the fix: apply
--noresyncflagsalways by default, or only when the task runs on a frequent cron schedule.Workaround: enable
FOLDER_INBOX(inbox only), which activates--search1=UNSEEN --setflag1=Seen --noresyncflags.Components
See also
imapsync/usr/local/bin/syncctllines 80-101