Commit graph

3455 commits

Author SHA1 Message Date
Patrick Ohly
18d4d22723 nightly testing: fixed splitting of enabled tests
Must use regex, string.split() does not split at character
set.
2011-04-21 18:34:40 +08:00
Patrick Ohly
86ace96ec1 nightly testing: added sync testing with CalDAV/CardDAV
apple, googlecalendar and yahoo include now also Client::Sync
tests. For "apple", this is the full set of tests. For the
others, only testItems is run.
2011-04-21 18:34:40 +08:00
Patrick Ohly
cf3ab837c2 local sync: "source-config" optional
The "source-config" peer in the target context used to be required for
local sync. Now it is optional. The reasoning is:
- For WebDAV, copying username/password from the main config may
  already be enough to find the server.
- For local file sources, no sync properties ared needed
  at all.

In both cases, "source-config" is used if available. That can be useful
to set loglevel separately, for example.
2011-04-21 12:36:12 +02:00
Patrick Ohly
436c23f827 config: "uri" now has source name as fallback
For SyncEvolution<->SyncEvolution synchronization there should be
no need to set the uri property of each source explicitly, because
typically it is the same as the source name.

With this patch, the source name is used as fallback. Because some
code needs to check whether the URI is set, getURI() returns the
setting directly (as before) whereas getURINonEmpty() always returns a
non-empty result with the name as fallback.
2011-04-21 12:20:00 +02:00
Patrick Ohly
d2e70d93e5 command line: an invalid --template parameter did not always trigger an error
Specifying an invalid template name continued with an empty template
if enough properties were specified. That's not correct and leads
to unexpected results:
- peerIsClient might have been part of the desired template.
- Set of sources to be created is defined by template.

Now an error is printed for this case.
2011-04-20 22:11:36 +02:00
Patrick Ohly
66a770c4bc command line: accept template name with underscores
Printing of templates was changed to use underscores instead of
spaces, but retrieving a template was not. Turned out that
it doesn't compare against the list that it builds up, but instead
does a matching against the fingerprint.

Now the fingerprint comparison treats spaces like underscores,
so that "SyncEvolution_Client" matches against the "SyncEvolution Client"
fingerprint. Better for backwards compatibility, too.
2011-04-20 18:50:25 +02:00
Patrick Ohly
98c98fa29a command line: avoid spaces in the handles of template names
The device templates contained spaces ("Nokia N900", for example),
which was hard to use on the command line and in scripts. Now
an underscore is used instead of spaces.
2011-04-20 18:15:07 +02:00
Patrick Ohly
118662a301 WebDAV: always register our special property
This is a better fix for the webDAVCredentialsOkay property
registration: always do it, regardless whether the backend is enabled,
because then the config migration code will always know about it.

Also fixed automated testing to include that property.
2011-04-20 18:13:16 +02:00
Patrick Ohly
6147f6f718 local sync: make a copy of errno before calling something which might overwrite it
Logging calls might end up calling functions which modify errno.
Seen once where logging reported a "pipe error" and the following
exception a "resource temporarily unavailable".
2011-04-20 16:47:24 +02:00
Patrick Ohly
2587fe9382 server sync session: detect final sync mode, part II (BMC #2786)
testOneWayFromClient was still failing in server mode because of a
similar issue as with slow sync as fallback for refresh-from-server:
the client can ask for a two-way sync and then withhold all of its own
changes to achieve the same effect.

Detect this based on the requested sync mode.
2011-04-20 16:47:24 +02:00
Patrick Ohly
feec9fffc5 nightly testing: support --enable foo=<tests> for all tests
Only the "evolution" test allowed selecting which client-test
tests to run. Now this code is in SyncEvolutionTest class itself.
The parameter to it with the default test list was turned into
a simple string, to match the value of the --enable parameter.
2011-04-20 20:47:57 +08:00
Patrick Ohly
10656b6484 nightly testing: unset http_proxy for client-test runs
This is needed for local CalDAV/CardDAV tests to succeed.
With http_proxy set, all traffic would be attempted via
these proxies, which doesn't work.

All tests which need proxies have to be configured such
that proxyHost/useProxy is set correctly in the server configs.
2011-04-20 20:47:57 +08:00
Patrick Ohly
c7a730ac08 local sync: fixed non-blocking recv()
recv() may return -1 and EAGAIN/EWOULDBLOCK, according to the man
page. That was treated as a fatal error instead of retrying, which
was the original intention.

For writev() it is less clear whether EAGAIN/EWOULDBLOCK need to be
handled. Let's catch them anyway.
2011-04-20 14:23:59 +02:00
Patrick Ohly
e3ccba5d1c local sync: fixed potential NULL pointer read
The following code crashed if m_length was read after executing
the release() calls:
realloc(buffer.m_message.release(), buffer.m_message->m_length)

That's because release() resets the m_message pointer. It seems that
clang orders execution like that whereas gcc doesn't.
2011-04-20 14:20:46 +02:00
Patrick Ohly
162568b064 WebDAV: send all optional extensions to CalDAV/CardDAV servers
Some of our extensions are optional, for example X-EVOLUTION-UI-SLOT
(because Nokia phones had problems with that). CalDAV/CardDAV servers
are meant to preserve all extensions, so let's send them everything we
have.

For calendar, this is not yet relevant in practice (rule doesn't do
anything).

Apple Calendar server + CardDAV really preserves the slot parameter.
Yahoo CardDAV does not, but at least accepts it.
2011-04-20 12:50:02 +02:00
Patrick Ohly
944321542e CalDAV: ignore Apple Calendar server "unlimited recurrence" issue
Apple Calendar server does not seem to support unlimited
recurrences. It adds a UNTIL clause. Ignore that by removing
the test case from the Apple specific test data.
2011-04-20 11:18:21 +02:00
Patrick Ohly
13b03180f6 CalDAV: temporarily ignore lost ORGANIZER (BMC #16452)
Due to a bug in libical, the Apple Calendar server's data
is nor parse correctly and ORGANIZER gets lost. This patch
temporarily removes the property from the test data to get
the testItem test to pass.
2011-04-20 11:16:09 +02:00
Patrick Ohly
f3fcd98fae device sync: added debug messages to SAN sending
Neither the SAN message nor creating it left any traces in the log
file. That made it a bit hard to track what was sent. Added some debug
logging.
2011-04-20 10:34:42 +02:00
Patrick Ohly
4ca0883b66 server sync session: add locally deleted items in "refresh-from-client" (BMC #2786)
When deleting items on the server due to "refresh-from-client" sync,
we want to have these items counted in the statistics, just as on
a client in a "refresh-from-server".

The code doing this had to be updated to distinguish between client and
server mode.
2011-04-20 10:33:53 +02:00
Patrick Ohly
467fdf70c8 local sync: fixed several potential bugs in transport
The main bug fix is for partial writes: the base address wasn't getting
updated, so the same data would have been sent multiple times. Not sure
whether this really occurred in practice.

fcntl() was called for random file descriptors due to a buffer
overflow. If a valid file descriptor was hit, the real user of it
might have gotten confused.

writev() was passed unitialized memory. Okay in this case (hole in struct),
but ugly in valgrind and easily fixed with memset().
2011-04-20 10:26:33 +02:00
Patrick Ohly
ee802e699e client-test: sped up testLargeObject/testMaxMsg
Creating test data in SyncTests::doVarSizes() took a long time
because it created a TestingSyncSource multiple times inside
a loop. Each destruction of that instance caused a 5 second delay,
necessary to ensure correct time-based change tracking.

Adding a second version of insertManyItems() which uses a single
instance of TestingSyncSource created by doVarSizes() itself
makes it possible to sleep only once.
2011-04-20 10:21:04 +02:00
Patrick Ohly
aebba85c31 server sync session: detect final sync mode (BMC #2786)
This patch relies on libsynthesis reporting a stable sync mode
of each source in the PEV_ALERTED progress event. This was added
recently to libsynthesis in server mode.

This patch deals with a client that falls back to "delete data + slow
sync" as a way of doing a refresh-from-server (as Synthesis engine
itself does) at least in one case: server-alerted syncs know the originally
requested sync mode and assume that a slow sync is the intended mode,
which then gets translated back into refresh-from-server.

A session with such a sync initiated by a client is still recorded as
"slow sync".
2011-04-19 16:56:35 +02:00
Patrick Ohly
c1a2d81e91 virtual source: added better config checking and error reporting
An empty "database" property for a virtual source lead to a useless
error about instantiating a source with an empty name. Now the error
is reported for the virtual source and includes the "database" value.

A sanity check that the source really had exactly two sub-sources
was missing. Added.
2011-04-19 13:58:04 +02:00
Patrick Ohly
0574084362 SyncSource: better error message for incomplete config
The file backend refuses to create a source if backendFormat is unset.
This was reported as "<source>: backend 'file' not supported",
which was confusing because the backend was in fact supported.

Now the error message is "<source>: backend 'file' not supported or
not fully configured (format '<format>')".
2011-04-19 13:56:02 +02:00
Patrick Ohly
22e5783822 local sync: exceptions thrown in child process were not reported
Exceptions encountered in the child process were printed as [ERROR],
but not reported to the parent process and thus did not end up in the
final sync report.

Now they are, which makes finding the root cause of a failed local
sync a bit easier.
2011-04-19 13:54:09 +02:00
Patrick Ohly
cac3ebfd9b local sync: better error message when URI is empty
The error message "@<context>/<source>: source not configured" becames
confusing when <source> is empty. Now "missing URI for one of the
sources" is printed instead.
2011-04-19 13:48:51 +02:00
Patrick Ohly
87b4a063a3 command line: better error message when checking sources, avoid "list"
The command line instantiated sources with the name "list" (cut-and-paste
error?) instead of using the proper name. As a result, error messages
created by these sources didn't refer back to the configuration. Now
the real name is used.
2011-04-19 13:48:13 +02:00
Patrick Ohly
a269278e08 Akonadi: must not reuse EDS test names
The Akonadi source reused the EDS test names (vcard30, ical20, ...).
This has the effect that the configuration of these tests was
overwritten each time client-test was started. Each backend must
use its own names here.

For Akonadi, kde_events/tasks/memos were chosen. "calendar" was avoided
because some people include tasks in that category.
2011-04-19 13:43:40 +02:00
Patrick Ohly
ffc9aab3f4 vCard profile: added more permanent support for KAddressBook extensions
This re-adds the code from a3d7412972
which was temporarily removed in revert commit
4ff3777c70.

This time, the changes are done in such a way that other, non-KDE
backends are not affected. The properties fall into three categories:

1. The KDE extension maps to a field which has already an property mapping
   that is understood by SyncML peers (example: X-messaging/xmpp-All KDE
   property maps to X-JABBER). In these cases, the external
   property is not used with KDE (empty property with rule="KDE").
   A second property entry exclusively for KDE (rule="KDE") defines
   the mapping to the KDE property.
2. The KDE extension has no corresponding mapping (X-KADDRESSBOOK-CRYPTO*,
   X-messaging/irc-All for IRC chat handle). In these cases the KDE
   property name is used also with SyncML peers.
3. An Evolution extension has no corresponding extension in KDE (X-EVOLUTION-VIDEO-URL).
   Here the Evolution extension is passed to KDE.

Whether KDE extensions like X-messaging/irc-All should be exposed as
they are to other peers is uncertain. It might be more natural to follow
the X-AIM/JABBER/MSM/... pattern and introduce X-IRC. Or follow RFC 4770,
which defines the IMPP property... at the end of the day, this depends on
the peers which we want to send these extensions to.
2011-04-18 21:41:36 +02:00
Patrick Ohly
ca4eaa3f5f WebDAV: fixed compile error with WebDAV disabled
Referencing the new property when WebDAV wasn't enabled didn't
work.
2011-04-15 18:14:14 +02:00
Patrick Ohly
8b9a5156c1 clang/g++: keep g++ happy by hiding clang pragmas 2011-04-15 17:59:05 +02:00
Patrick Ohly
9878b9e56a Akonadi: disable by default
Same rationale as with KWallet: don't surprise traditional
users by enableing it without their consent. Also the automatism
enabled it on Ubuntu Hardy where it didn't compile.
2011-04-15 23:16:40 +08:00
Patrick Ohly
5627f1d6ad autotools: the KWallet code depends on C++
AC_PROG_CXX was done too late for the KWallet check.
Must be done already before AC_LANG_PUSH(C++).
2011-04-15 22:58:32 +08:00
Patrick Ohly
4ff3777c70 Akonadi: reverting vCard profile changes
Nightly testing shows that the changes in
a3d7412972 affect other backends. This
patch removes the changes temporarily to have more time for
investigating that.
2011-04-15 16:59:45 +02:00
Patrick Ohly
d71c698671 WebDAV: avoid aborts due to debug OPTIONS request
The OPTIONS request doesn't use the retry mechanismn and thus
failed hard when Google started the 401 throttling. Now such
any error is simply ignored.
2011-04-15 14:29:43 +02:00
Patrick Ohly
1ca98c6626 NeonCXX: avoid over-runing the deadline
The last wait might have been much later than the deadline. Now it is
truncated to that point in time, for one last attempt before giving up.
2011-04-15 14:28:43 +02:00
Patrick Ohly
f4882211c1 NeonCXX: removed duplicate 401 throttling code inside Neon
The outer retry loops seems to handle the 401 Google throttling
fine, no need anymore for the identical code which was invoked
by Neon inside the credentials callback.
2011-04-15 14:27:37 +02:00
Patrick Ohly
17c84b4c21 CalDAV: added retry for data dump
The REPORT request which retrieved calendar data was only sent
once. If it failed, creating the backup failed. Now this request
is tried a few times similar to the other requests. Before each
retry, the potentially incomplete backup is removed.
2011-04-15 14:25:52 +02:00
Patrick Ohly
fe95a19f4a ItemCache: allow backup dumps to restart
Added ItemCache::reset(), will be used by WebDAV backend if dumping
data fails in the middle and needs to be retried.
2011-04-15 14:24:30 +02:00
Patrick Ohly
cbbd3a2f6e WebDAV: improved retry logic, fixed Google "401 throttling" workaround
The retry mechanism for Google's request throttling with incorrect
401 responses broke when introducing forced authentication, because
Neon never asked for credentials in that case, which bypassed the
retry logic.

Moved the 401 handling into the outer retry loop of run() + retry.
Cleaned up operation handling: the deadline is now set once
before entering the retry logic. This is also a convenient place
to record the name of the upcoming operation (used for debugging
and error messages).

Made the information that credentials were valid before persistent as
"WebDAVCredentialsOkay" in the .internal.ini file of the
"source-config" peer. This turned out to be necessary for unit testing,
because running the next test had no knowledge that retrying is
okay and gave up too early.

The inner retry loop in the credentials callback is probably obsolete
now; will be removed.
2011-04-15 13:30:51 +02:00
Patrick Ohly
b6db982f5c Timespec: added access methods for seconds, nsecs and total time as double
More readable than accessing tv_sec and tv_nsec directly. duration()
can be passed to Sleep().
2011-04-15 13:29:16 +02:00
Patrick Ohly
bb5c1ac39b SyncSource config: grant sources read/write access to context
The intention always was that backends may add their own
properties. For sync properties this seemed less relevant,
so sources only got read access to it.

But the WebDAV backends run with their own "source-config" context
and now need read/write access to store information that is
shared between all sources.

Therefore this patch removes the "const" qualifier from SyncConfig.
2011-04-15 13:26:55 +02:00
Patrick Ohly
f49711dca3 WebDAV: cleaned up error messages a bit
Include more information about the HTTP status code in the
description because otherwise it won't show up in exception
printing.
2011-04-15 08:50:51 +02:00
Patrick Ohly
14565681bc KWallet: KDE detection was flawed
The logic for detecting a KDE session was reversed: if KDE_FULL_SESSION
is *not* set, then the session is not KDE. As a result, KWallet was
used inside a GNOME session instead of GNOME keyring if both were
enabled.
2011-04-15 08:39:48 +02:00
Patrick Ohly
31e286059b eGroupware: added template (BMC #15992)
The problem with eGroupware is that it doesn't have one fixed syncURL.
Users of the template must remember to change it. To make this more
obvious, it is set to http://set.your.domain.here/rpc.php

The failure to fix the URL is leading to fairly obvious network
errors.

Various people have reported success with eGroupware, the latest
one here: http://www.ruinelli.ch/how-to-sync-egroupware-with-a-tablet-n900-with-syncevolution
Therefore it makes sense to also mark this template as "consumerReady"
and have it shown in the sync UI.
2011-04-15 08:15:19 +02:00
Patrick Ohly
29da40384a WebDAV: detect temporary Google error page
When Google calendar has temporary problems, it redirects to
an HTML error page. That defeated our "retry on error" logic.
Now redirects are checked inside Session::check(), with a special
case in place for this Google redirect.
2011-04-14 13:45:56 +02:00
Patrick Ohly
54f03a0905 logging: avoid extra newlines in redirected text
When capturing lines from stdout or stderr, strip the trailing newline
before calling message() because that introduces an additional newline
by itself.
2011-04-14 13:42:18 +02:00
Patrick Ohly
70f7a924cc Logging: add relative time to [INFO/DEBUG ...] prefix at debug level
It is useful to know how long certain operations take. Instead of
adding random time stamps at the log calls, this should better be
done consistently for all lines.

In a normal sync log, such a time stamp is added by the Synthesis
logging code. For stdout logging, this patch adds it if the log
level is >= DEBUG. That way it won't distract normal users but will
be available automatically when producing a log for developers.

Because a full time dump can be long and because the delta between
events is more interesting, only relative time since the start of
logging is printed.
2011-04-14 11:12:08 +02:00
Patrick Ohly
106598bd16 WebDAV: added extensive resending of requests
This is motivated by the observation that the Yahoo server becomes
unresponsive (various 5xx errors) quite often, which used to abort
the sync. Now there are better chances that it'll complete eventually,
although the root cause (server not responsive enough) remains.

PROPFIND, PUT and GET are all tried again. For a failed PUT this is
problematic because it is simply not known whether the command was
already executed. A check for "item does not exist" therefore can only
be done on the first attempt. Likewise, any future "eTag matches"
check (not yet implemented) will be also impossible.

Because of the retry, a PUT is no longer marked as not
idem-potent. The advantage is that an existing connection will be
reused for it.

The implementation is based around the idea that the higher levels in
the stack define a deadline until which the operation must succeed,
and then the lower levels (individual PROPFIND/PUT/GET) retry inside
that allowed time interval. That ensures that the initial service
discovery never takes longer that the configured timeout, which
wouldn't be the case if the timeout was applied to every single
PROPFIND inside the semantic operation.
2011-04-14 10:17:50 +02:00
Patrick Ohly
0d96fa07d3 Akonadi: fixed a compile problem when it was disabled
Without Akonadi support enabled, SyncSource.h was never included
and thus the registration code didn't compile.
2011-04-14 10:17:50 +02:00