From 44ad8f036165a5086298de26f5a75fd6588a0da7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 13 Jan 2022 14:05:45 +0100 Subject: [PATCH] handle mixing simple and compound sync options more explicitly --- src/config.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 8aa9f2e..1f423c6 100644 --- a/src/config.c +++ b/src/config.c @@ -324,18 +324,30 @@ merge_ops( int cops, int ops[], const char *chan_name ) return 1; } // Mix in non-overlapping Push/Pull or New, etc. - // Do the ops first, so e.g. PullNew Push Flags will error out. - ops[F] |= cops & OP_MASK_TYPE; - ops[N] |= cops & OP_MASK_TYPE; if (cops & XOP_PULL) { + if (cops & (XOP_PUSH | OP_MASK_TYPE)) { + // Mixing instant effect flags with row/column flags would be confusing, + // so instead everything is instant effect. This implies that mixing + // direction with type would cause overlaps, so PullNew Push Delete, etc. + // is invalid. + // Pull Push covers everything, so makes no sense to combine. + ivl: + error( "Invalid combination of simple and compound Sync options %s.\n", + channel_str( chan_name ) ); + return 1; + } if (ops[N] & OP_MASK_TYPE) goto ovl; ops[N] |= OP_MASK_TYPE; - } - if (cops & XOP_PUSH) { + } else if (cops & XOP_PUSH) { + if (cops & OP_MASK_TYPE) + goto ivl; if (ops[F] & OP_MASK_TYPE) goto ovl; ops[F] |= OP_MASK_TYPE; + } else { + ops[F] |= cops & OP_MASK_TYPE; + ops[N] |= cops & OP_MASK_TYPE; } } else if (cops & (OP_MASK_TYPE | XOP_MASK_DIR)) { // Pull New, etc. if (ops[F] & XOP_TYPE_NOOP)