Skip to content

Imapsync resyncs \Seen flag in cron mode and reverts WebTop read status #8107

Description

@stephdl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions