Commit Graph

5724 Commits

Author SHA1 Message Date
Patrick Ohly 04f11b422e source -> datastore rename, improved terminology
The word "source" implies reading, while in fact access is read/write.
"datastore" avoids that misconception. Writing it in one word emphasizes
that it is single entity.

While renaming, also remove references to explicit --*-property
parameters. The only necessary use today is "--sync-property ?"
and "--datastore-property ?".

--datastore-property was used instead of the short --store-property
because "store" might be mistaken for the verb. It doesn't matter
that it is longer because it doesn't get typed often.

--source-property must remain valid for backward compatility.

As many user-visible instances of "source" as possible got replaced in
text strings by the newer term "datastore". Debug messages were left
unchanged unless some regex happened to match it.

The source code will continue to use the old variable and class names
based on "source".

Various documentation enhancements:
  Better explain what local sync is and how it involves two sync
  configs. "originating config" gets introduces instead of just
  "sync config".

  Better explain the relationship between contexts, sync configs,
  and source configs ("a sync config can use the datastore configs in
  the same context").

  An entire section on config properties in the terminology
  section. "item" added (Todd Wilson correctly pointed out that it was
  missing).

  Less focus on conflict resolution, as suggested by Graham Cobb.

  Fix examples that became invalid when fixing the password
  storage/lookup mechanism for GNOME keyring in 1.4.

  The "command line conventions", "Synchronization beyond SyncML" and
  "CalDAV and CardDAV" sections were updated. It's possible that the
  other sections also contain slightly incorrect usage of the
  terminology or are simply out-dated.
2014-07-28 15:29:41 +02:00
Patrick Ohly 581cee897e Google: remove SyncML template, combine CalDAV/CardDAV
Google has turned off their SyncML server, so the corresponding
"Google Contacts" template became useless and needs to be removed. It
gets replaced by a "Google" template which combines the three
different URLs currently used by Google for CalDAV/CardDAV.

This new template can be used to configure a "target-config@google"
with default calendar and address book database already enabled. The
actual URL of these databases will be determined during the first
sync using them.

The template relies on the WebDAV backend's new capability to search
multiple different entries in the syncURL property for databases. To
avoid listing each calendar twice (once for the legacy URL, once with
the new one) when using basic username/password authentication, the
backend needs a special case for Google and detect that the legacy URL
does not need to be checked.
2014-07-28 15:24:46 +02:00
Patrick Ohly 74143960b9 WebDAV: support multiple URLs in syncURL
The syncURL property may contain multiple different space or tab
separated URLs. Previously, the WebDAV backend only used the first one
when scanning for databases. Now it tries all of them.

This will be useful for configuring all Google endpoints in one
template.
2014-07-28 15:24:46 +02:00
Patrick Ohly cab4d0a98d WebDAV: avoid DNS SRV retry loop for aliases
Certains domains (like googleapis.com) are aliases. The lookup tools
do not fail with NXDOMAIN in this case, causing the
syncevo-webdav-lookup script to return only an unknown lookup error,
in which case the WebDAV backend will retry for a while.

We need to detect aliases resp. missing SRV information and return a
"no information error".
2014-07-28 15:24:46 +02:00
Patrick Ohly 2371f69f97 PIM testing: remove asyncError test
The asyncError relied on calling
folks_individual_aggregator_remove_individual() incorrectly
with a NULL pointer. folks in Debian Testing just crashes
now, so we can no longer do this.
2014-07-25 14:23:30 +02:00
Patrick Ohly 8c6f770e38 local sync: allow config name in syncURL=local://
Previously, only syncURL=local://@<context name> was allowed and used
the "target-config@context name" config as target side in the local
sync.

Now "local://config-name@context-name" or simply "local://config-name"
are also allowed. "target-config" is still the fallback if only a
context is give.

It also has one more special meaning: "--configure
target-config@google-calendar" will pick the "Google_Calendar"
template automatically because it knows that the intention is to
configure the target side of a local sync. It does not know that when
using some other name for the config, in which case the template (if
needed) must be specified explicitly.

The process name in output from the target side now also includes the
configuration name if it is not the default "target-config".
2014-07-25 03:01:52 -07:00
Patrick Ohly 5ab328af07 D-Bus testing: fix race condition in TestLocalSync.testNoParent
The first progress signal gets emitted after sleeping for 10 seconds
at the start of the sync and then killing syncevo-dbus-server races
with completing the sync. What we want is to kill during the 10 second
wait, so we better wait for the debug output directly before it and
then kill directly.
2014-07-24 15:39:52 +02:00
Patrick Ohly 57f44fe607 config: allow storing credentials for email address
When configuring a WebDAV server with username = email address and no
URL (which is possible if the server supports service discovery via
the domain in the email address), then storing the credentials in the
GNOME keyring used to fail with "cannot store password in GNOME
keyring, not enough attributes".

That is because GNOME keyring seemed to get confused when a network
login has no server name and some extra safeguards were added to
SyncEvolution to avoid this.

To store the credentials in the case above, the email address now gets
split into user and domain part and together get used to look up the
password.
2014-07-24 15:39:35 +02:00
Patrick Ohly 76599a8056 autotools, NEWS: SyncEvolution 1.4.99.3 2014-07-23 12:29:44 +02:00
Patrick Ohly 834c1e7a6b ephemeral sync: don't write binfile client files (FDO #55921)
When doing PBAP caching, we don't want any meta data written because
the next sync would not use it anyway. With the latest libsynthesis
we can configure "/dev/null" as datadir for the client's binfiles and
libsynthesis will avoid writing them.

The PIM manager uses this for PBAP syncing automatically. For testing
it can be enabled by setting the SYNCEVOLUTION_EPHEMERAL env variable.
2014-07-23 10:48:19 +02:00
Patrick Ohly 198594b622 PIM testing: fix target session checking
The recent change which introduced checking of the target session only
worked if the entries were listed in the "right" (= target-config
entry last) order. Don't reply on that, instead check for the one new entry
that we should find and use that.
2014-07-23 10:48:19 +02:00
Patrick Ohly 36b7e9cd0f glib: avoid GValue compile problem
clang 3.4 generated references to the unused (!?) dummyTake() and
dummySetStatic(). Provide an empty implementation of them.
2014-07-23 10:48:19 +02:00
Patrick Ohly 7a04bde07d D-Bus server: remove some dead code
Some of the global constants were not used. Found by clang 3.4.
2014-07-23 10:48:19 +02:00
Patrick Ohly 7ca22d8db8 testing: avoid undefined vararg after reference
clang 3.4 warns about undefined behavior when applying va_start()
to a reference. We have to use a pointer here to avoid that.
2014-07-23 10:48:19 +02:00
Patrick Ohly 96e873a935 suspend flags: try harder to write data in signal handler
As pointed out by compiler warnings on recent distros, the write()
result in the SuspendFlags signal handler was ignored. Not sure
whether it really can fail in practice. Handle some
possible errors with retrying.
2014-07-23 10:48:19 +02:00
Patrick Ohly 38d6498e4e testing: check symlink() result (FDO #79316)
The Cmdline.cpp unit tests did not check the symlink() result,
causing a warning resp. error depending on the configure options.

Reported by Emiliano Heyns.
2014-07-23 10:48:19 +02:00
Patrick Ohly eaeb528896 autotools: fix linking of dbus-client-server against pcre
When building shared binaries, the pcre libs must be explicitly
listed because dbus-client-server calls them through test.c.
2014-07-23 10:48:19 +02:00
Patrick Ohly 8e333f0a46 glib: avoid deprecated g_type_init and g_thread_init
Calling them triggers warnings with newer glib which are fatal
when compiling with -Werror.
2014-07-23 10:48:19 +02:00
Patrick Ohly d06e40d365 engine: enable batching by default (FDO #52669)
This reverts commit c435e937cd.

Commit 7b636720a in libsynthesis fixes an unitialized memory read in
the asynchronous item update code path.

Testing confirms that we can now used batched writes reliably with EDS
(the only backend currently supporting asynchronous writes +
batching), so this change enables it again also for local and
SyncEvolution<->SyncEvolution sync (with asynchronous execution of
contact add/update overlapped with SyncML message exchanges) and other
SyncML syncs (with changes combined into batches and executed at the
end of each message).
2014-07-23 10:42:31 +02:00
Patrick Ohly 0c989eb74d CardDAV: implement read-ahead
Instead of downloading contacts one-by-one with GET, SyncEvolution now
looks at contacts that are most likely going to be needed soon and
gets all of them at once with addressbook-multiget REPORT.

The number of contacts per REPORT is 50 by default, configurable by
setting the SYNCEVOLUTION_CARDDAV_BATCH_SIZE env variable.

This has two advantages:
- It avoids round-trips to the server and thus speeds up a large
  download (100 small contacts with individual GETs took 28s on
  a fast connection, 3s with two REPORTs).
- It reduces the overall number of requests. Google CardDAV is known
  to start issuing intermittent 401 authentication errors when the
  number of contacts retrieved via GET is too large. Perhaps this
  can be avoided with addressbook-multiget.

This is similar to read-ahead in EDS contacts. However, because we
cannot run Neon requests asynchronously (at least not easily), a
batched read must complete before any contact from it can be
returned to the caller.
2014-07-21 12:15:52 +02:00
Patrick Ohly bc392b99f5 PIM: sync.py --sync-flags
Arbitrary sync flags can be passed to SyncPeerWithFlags() with the
new --sync-flags command line parameter. The value of that parameter
must be a JSON formatted hash.

The advantage of this approach over explicit command line parameters
(like --progress-frequency) is that we do not need to add further code
when adding new flags. We can also pass intentionally broken flags
to check the PIM Managers error handling.

The downside is that it is a bit less user-friendly.

With this change, progress frequency and PBAP sync can be set in two
ways, either as part of --sync-flags or with the individual command
line parameters.  The latter override --sync-flags.
2014-07-21 10:40:57 +02:00
Patrick Ohly 1a9e55bfe6 PIM: PBAP chunk transfer flags in SyncPeerWithFlags()
All of the new PBPA chunk env variables can now also be set
for individual syncs via flags in SyncPeerWithFlags().
2014-07-21 10:40:57 +02:00
Patrick Ohly 037b8b46c4 PIM: better error messages for SyncPeerWithFlags
When the value of a flag has the wrong type, then dumping the value
may provide some hint about what is wrong. Note that values of types
not expected at all by the SyncFlags type already get filtered out
already by our D-Bus binding, in which case the error message shows
no value.
2014-07-21 10:40:57 +02:00
Patrick Ohly 40eb6880f0 util: ToString()
Template method which converts any type with a << operator into
a string.
2014-07-21 10:40:57 +02:00
Patrick Ohly 27f4952e5c PBAP: typo fix in README 2014-07-21 10:40:57 +02:00
Patrick Ohly fda741136f testing: include syncevo-webdav-lookup in test binaries
syncevo-webdav-lookup is needed during testing when doing
WebDAV database scans, so build it in "src" like the rest
of the binaries and link to it in the installed test suite.
2014-07-21 10:40:57 +02:00
Patrick Ohly 124f6e7b2c testing: uninstall synclog2html
The test script was installed, but not uninstalled.
2014-07-21 10:40:57 +02:00
Patrick Ohly 43ab1aba81 Google Calendar: remove child hack, improve alarm hack (FDO #63881)
Google recently enhanced support for RECURRENCE-ID, so SyncEvolution
no longer needs to replace the property when uploading a single
detached event with RECURRENCE-ID. However, several things are still
broken in the server, with no workaround in SyncEvolution:
- Removing individual events gets ignored by the server;
  a full "wipe out server data" might work (untested).
- When updating the parent event, all child events also get
  updated even though they were included unchanged in the data
  sent by SyncEvolution.
- The RECURRENCE-ID of a child event of an all-day recurring event
  does not get stored properly.
- The update hack seems to fail for complex meetings: uploading them
  once and then deleting them seems to make uploading them again
  impossible.

All of these issues were reported to Google and are worked on there,
so perhaps the situation will improve. In the meantime, syncing with
Google CalDAV should better be limited to:
- Downloading a Google calendar in one-way mode.
- Two-way syncing of simple calendars without complex meeting
  serieses.

While updating the Google workarounds, the alarm hack (sending a
new event without alarms twice to avoid the automatic server side
alarm) was simplified. Now the new event gets sent only once with a
pseudo-alarm.
2014-07-14 04:46:29 -07:00
Patrick Ohly 6b131dc27f testing: refresh test data
Google seems to have changed its PHOTO rewriting. If that keeps
happening, we need to stop comparing the actual data.

However, comparing the actual data is useful to detect when we
do not properly handle it. For example, in testUpdateRemoteWins/local-synced
it was a bit surprising that only one contact had to be updated at first.

It turned out that libsynthesis did not compare the entire photo data,
only the part before embedded null bytes.
2014-07-14 04:43:05 -07:00
Patrick Ohly d7f16430bc PIM testing: enhance PBAP caching test
The bugs caused by introducing merging of arrays were not detected
by the automated testing. We need to repeat syncing after we have
data and check that nothing changes in the default, no-phone mode,
and we need to check that nothing got changed on the remote side.

In PBAP mode that would have triggered an error, but when using the
file backend we silently modified its data.

Removing the URL ensures that the failure to avoid writes of
incomplete contacts gets covered. Rearranging the properties
also may be relevant (but was handled already).
2014-07-14 13:39:23 +02:00
Patrick Ohly 5d3df97cac datatypes: fix contact caching
Adding grouping to the contact datatype broke PBAP caching: when
sending an empty URL, for example, during the sync, the parsed contact
had different field arrays than the locally stored contact, because the
latter was saved without the empty URL.

This caused the field-based comparison to detect a difference even when
the final, reencoded contact wasn't different at all.

To solve this, syncing now uses the same "don't send empty properties"
configuration as local storages. Testing shows that this resolves
the difference for EDS.

A more resilient solution would be to add a check based on the encoded
data, but that's more costly performance wise.
2014-07-14 13:38:55 +02:00
Patrick Ohly 7d66823e5f datatypes: fix vCard handling
The new "preserve repeating properties during conflict resolution"
feature was only active when using EDS as storage. The relevant
merge script must be applied to all datatypes, not just the EDS
flavor.

The feature was also unintentionally active when running in
caching mode. This caused two problems:
- The cached item was updated even though only the
  ordering of repeating properties had been modified during
  merging.
- The merged item was sent back to the client side, which
  was undesirable (caching is supposed to be one-way) or even
  impossible (PBAP is read-only, causing sync failures eith error 20030).

We must check for caching mode and disable merging when it is active.
We also must not tell the engine that we updated the photo property
in the winning item, because then that item would get sent to the
read-only side of the sync.

Perhaps a better solution would be to actually tell the engine
that the remote side is read-only when we activate caching mode.
2014-07-11 11:57:14 +02:00
Patrick Ohly 1431fd4a7b datatypes: avoid PHOTO corruption during merge (FDO #77065)
When handling an update/update conflict (both sides of the sync have an
updated contact) and photo data was moved into a local file by EDS, the engine
merged the file path and the photo data together and thus corrupted the photo.

The engine does not know about the special role of the photo property.
This needs to be handled by the merge script, and that script did not
cover this particular situation. Now the loosing side is cleared,
causing the engine to then copy the winning side over into the loosing
one.

Found by Renato Filho/Canonical when testing SyncEvolution for Ubuntu 14.04.
2014-07-11 11:57:14 +02:00
Patrick Ohly bbe782a658 testing: ignore some more Akonadi runtime files
Seen after updating Debian Testing.
2014-07-11 11:57:14 +02:00
Patrick Ohly 845b0ba614 testing: ignore minor leak when using DLT 2014-07-11 11:57:14 +02:00
Patrick Ohly 38c6466738 PBAP: silence cppcheck warnings
cppcheck warns when members are not initialized in the constructor.
That's okay in this case, but let's do it anyway.
2014-07-11 11:57:14 +02:00
Patrick Ohly 527b47c80e PBAP: transfer in chunks (FDO #77272)
If enabled via env variables, PullAll transfers will be limited to
a certain numbers contacts at different offsets until all data got
pulled. See README for details.

When transfering in chunks, the enumeration of contacts for the engine
no longer matches the PBAP enumeration. Debug output uses "offset #x"
for PBAP and "ID y" for the engine.
2014-07-11 11:57:14 +02:00
Patrick Ohly 52a478a811 PBAP: clean up internal PullAll API
Returning an ID as string and then taking an int as argument was not
very clean. Document the logic and make this more consistent.
2014-07-11 11:57:14 +02:00
Patrick Ohly 7ae52c29ba PBAP: mention SyncPeerWithFlags in README
The env variable is no longer necessary for users of the D-Bus API.
2014-07-11 11:57:14 +02:00
Patrick Ohly 8142fefe91 PBAP: remove transfer via pipe
Using a pipe was never fully supported by obexd (blocks
obexd). Transfering in suitably sized chunks (FDO #77272) will be a
more obexd friendly solution with a similar effect (not having to
buffer the entire address book in memory).
2014-07-11 11:57:14 +02:00
Patrick Ohly 4f16f586f1 remove unused member variables
gcc 4.9 found some unused member variables which can be removed.
2014-07-03 11:20:10 +02:00
Patrick Ohly 4dd10c1c0c D-Bus server: fix compiler warning
Passing 0.1 as delay did not work as intended because it was converted
to an integer value of 0 seconds. Found by gcc 4.9. Must use a one second
delay.
2014-07-03 11:20:10 +02:00
Patrick Ohly 5aee365225 testing: use inline cppcheck suppressions for libsynthesis
cppcheck 1.65 finds several false positives which are easier
to handle with inline suppressions.
2014-07-03 11:20:10 +02:00
Patrick Ohly 1f9d7b5979 cppcheck: suppress if check warning
s.getState() returns a different value later, so there is no
dead code as cppunit 1.65 believes.
2014-07-03 11:20:10 +02:00
Patrick Ohly d81f8168a3 cppcheck: suppress NULL warning in printf util
cppcheck 1.65 does not recognize that the preceeding if
check on the size of the buffer always causes it to be allocated
first.
2014-07-03 11:20:10 +02:00
Patrick Ohly 6d660250cc D-Bus server: remove redundant m_server
The base class already has a copy of it, so Session doesn't
need its own. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly fdd66536ce PIM: fix cppcheck control flow warning
The "func" variable was correctly initialized to NULL if no comparsion
matches, but cppcheck 1.65 warns anyway. Use the more readable
intialization to NULL in the final else clause.
2014-07-03 11:20:10 +02:00
Patrick Ohly 535bb97ae8 PIM: fix cppcheck performance warning
The code did one rare string copy instead of using a reference,
due to a missing ampersand. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly 764e9eee79 testing: fix cppcheck ClientTest::registerTests() warning
cppcheck warns that "factory" might get overwritten. Probably
never happened becaued registerTests() is only called once, but
let's fix it anyway.
2014-07-03 11:20:10 +02:00
Patrick Ohly 16db5644c6 autotools: fix PIM Manager link issue on Debian Testing
We call ICU i18 directly and thus must link against it.
Used to work earlier, probably because something pulled
in the library.
2014-07-03 11:20:10 +02:00