Commit Graph

345 Commits (0002fdfd6c21655bcba3fb69b291af4d3801ad79)

Author SHA1 Message Date
Andras Timar 0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Miklos Vajna 07629f0d7c Mark getMobileAppDocId() as const
Change-Id: Ie02cf07ce12ad63bf5374d94bdbd1b55eaeec4da
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102897
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-09-17 09:24:44 +02:00
Miklos Vajna 3d082ad451 Mark processInputEnabled() as const
Change-Id: I98222269b20e01ba50166d696d1f6846c06d8764
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102703
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-09-15 09:34:18 +02:00
Ashod Nakashian 9f5bd85008 wsd: use a shared threadname suffix for each document
The use of a common threadname suffix in the WSD and Kit
processes is intentional. It is designed to help filter
for a single document's logs across both processes.

The thread name has nothing to do with the classes in
the code, nor is it intended to imply any relationship
except with the process and the document in question.

As the comment in this patch explains, the choice of
the suffix is arbitrary and while it may be changed,
it has to be sensible and common between the two threads
to allow for easy grepping.

Historically, there were in fact dedicated threads
within the respective "broker" classes, but this
fact should be safely ignored, since at the log level
we care less about which part of the code generates a
log entry (that info, if needed, is at the end of each
log entry, in the form of filename and line number),
rather we care more about which document it relates to,
which is crucial in investigating production issues.

Logs and code structure are only incidentally related.
Logs are (or at least should be) designed around
the execution structure, not code architecture.

(This reverts 2a16f34812)

Change-Id: Ic6fe2f9425998824774d2644fe4362e75dea6b88
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101261
Tested-by: Jenkins
Tested-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-08-26 17:47:50 +02:00
Ashod Nakashian 29a5a1f1e9 wsd: move jail setup to the script to support readonly systemplate
We now gracefully fallback to copying when/if systemplate
is readonly.

The bulk of the change is to support proper cleanup in
both cases.

First, we had to move as much of the jail bootstrapping
into the loolwsd-systemplate-setup script, so systemplate
will be as complete as possible before it is locked down.
Next, we needed to update the jail with graceful fallback
to linking/copying upon failure. For that, the jail setup
logic in Kit.cpp has been reworked to support not just
update failures, but also more comprehensive mounting
failures as well.

Finally, jail cleanup now is seamless. To support proper
cleanup when we had mounting enabled but had to fallback,
we mark jails that aren't mounted so we can 'rm -rf' the
contents safely and without fear or causing undue damage
(as unlikely as that is, technically we wouldn't want to
rm systemplate files, if mounting read-only had failed).

There are a few minor refactorings of JailUtil to make
it cleaner and more robust.

Change-Id: Iac34869cb84f45acf64fbbc46d46898367b496d2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101260
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-08-25 07:58:30 +02:00
Ashod Nakashian bc8da0cb33 wsd: support read-only systemplate
For various reasons, systemplate may be read-only
or under a different owner and therefore impossible
to update the dynamic files in it.

To support such a scenario, we first link the
eight dynamic files in /etc when creating systemplate.
If this fails, we copy the files.

When creating jails, we always check that all the
dynamic files are up-to-date. If they are, nothing
further is necessary and we bind-mount, if enabled
and possible.

However, if the dynamic files are not up-to-date,
we disable bind-mounting and force linking
the files in the jails. Failing that, we copy them,
which is not ideal, but allows us to ensure the
dynamic files are up-to-date as we copy them too.

Ideally, the dynamic files in question would be
hard-link (or at least soft-linked) in systemplate
at creation. From then on we would bind-mount
the jails and everything would work perfectly and
no files would need updating. This patch is fallback
for when this scheme fails, which should be exceedingly
rare anyway, but which still ensures correct operation.

Change-Id: I09c6f057c49396579aaddb1b8bf4af0930dd4247
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100834
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-08-17 13:51:56 +02:00
Tor Lillqvist 5df5329f83 Guard against view count being zero
Happened for me once in the iOS app, not sure if it was just a random
fluke while debugging, or whether it can happen in normal use. Anyway,
take it into consideration.

If the view count is zero, don't overwrite the '['.

Change-Id: Ia797d7cc99cc273e68ec184406f47283c9a647e2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100672
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-08-13 22:07:28 +02:00
Ashod Nakashian c5f9d605e4 wsd: make outgoing connection timeout configurable
The default Poco connection timeout is 60 seconds,
which is probably excessive. The current configurable
default is a more reasonable 30 seconds.

Currently we set this timeout on Storage connections
going out (i.e. WOPI connections).

Change-Id: Ie80a9141ca9bf721addc74baf94e62e0ad72fdd2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98913
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ash@collabora.com>
2020-08-11 20:11:14 +02:00
Gabriel Masei d458f35c1f kit: disable parallel processing at higher levels
Sometimes multiple messages are processed in a single iteration
at socket level. This happens in WebSocketHandler and when draining
Document queue.Just covered these cases.

Change-Id: Ifa46f5d484b67015cca64008b2c89426cc839e64
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99387
Tested-by: Jenkins
Tested-by: Gabriel Masei <gabriel.masei@1and1.ro>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Gabriel Masei <gabriel.masei@1and1.ro>
2020-07-25 21:22:50 +02:00
Gabriel Masei 9c6739eee0 kit: disable parallel handling of messages while processing load and save
The map._activate, among other actions, is sending indirectly some messages
to the server like clientzoom and clientvisiblearea. If these messages are send
before the document finishes processing the load message then there is
a chance that a nodocloaded error will be thrown because there is a
chance that the messages will be processed in parallel with load. This happens
constantly for xlsx files. This is generated by the Unipoll mechanism which,
in case of xlsx files, triggers a parallel processing.
To avoid the above scenario a mechanism of disabling parallel processing of
messages in kit was implemented and is used for load and save messages, for now.

Change-Id: I4c83e72e600f92d0bb4f1f18cebe694e326256d0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98519
Tested-by: Jenkins
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-22 17:38:05 +02:00
Miklos Vajna 57959d6e86 Document::dumpState: fix isLoading typo
Change-Id: I21fdb82bcd9ff9348b8a08de9a55a64164ce47f4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99117
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-21 09:17:24 +02:00
Michael Meeks ca5d5943e4 Kit: add initial state dumping on USR1.
Change-Id: I8225f686e8678c08e505490df056904fc813d2fe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98927
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-18 18:21:14 +02:00
Michael Meeks 0084c3b275 Process any pending tileQueue items first.
Change-Id: I078bc1f52ba7647ca1715ea3222d695936dd657f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98928
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-17 12:29:54 +02:00
Pranam Lashkari 22359767d6 tdf#129296 leaflet: Password protected document load failing
Do not send faileddocloading error if it is because of password.

When the document is password protected, we send to the client
both passwordrequired and faileddocloading.
These two are handled differently. While the first prompts the
user for password input, the second internally flags fatal error
and shows an error message that the document may be corrupted etc.
The end result is that the document is not loaded and displayed
when the user submits a correct password. To reset the fatal
error one has to reload, which is unhelpful when we need to
provide a password.

This patch makes sure that we only send one error message to
the client. If a password is required, it already implies that
the document didn't load, and that with the proper password we
should try again.
Similarly for when the password given is wrong. However, if
loading fails and it isn't a password-related failure,
faileddocloading error is returned and in this case the client
handles it as a final error (that requires reloading to retry).

Change-Id: I383418fd40b6e0749b20af0ef8dc40f391a05559
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-07-16 19:31:31 +02:00
Tor Lillqvist 07bf598430 Make objects and threads go away more reliably in the iOS app
We probably used to have circular references that made KitSocketPoll
and KitWebSocketHandler objects hang around forever, or something.
(Not a problem in web-based Online where kit processes have a
restricted lifetime.)

Change-Id: Ia6eebc51f4a4a8fb4f69a2c83a0131de921ea1d6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98744
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-14 16:56:20 +02:00
Tor Lillqvist b673417946 More re-factoring of tile rendering
This is for the benefit of a next-gen iOS app (without FakeSockets and
much of the current Online plumbing).

This is not supposed to cause any functional changes in normal Online
even if code is organised a bit differently.

Change-Id: Ib09a84ff5d3ba858cf3f50553d76757966af7ad2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98655
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-13 16:39:59 +02:00
Tor Lillqvist 619cf1b304 Bin DeltaGenerator-using code that has been commented out since 2017
"Disable for now - pushed in error" says the comment added in
e11794da25.

Change-Id: Ia2b72bfe20f8ff16d74d1966d511c74eab3e4417
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98587
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-12 12:39:16 +02:00
Tor Lillqvist 63620b1823 Re-factoring to make re-use in a next-gen iOS app easier
Change-Id: I1656d38fb8ad4213417b8c00c0c84540e0eacdbe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98499
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-11 06:14:46 +02:00
Ashod Nakashian 9f7f6dca6a wsd: cleanup realpath call
The new utility is safer and more readable.

Change-Id: I3a86675378d458cb004e5534dbf2b401936d0e57
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98183
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-06 13:54:54 +02:00
Tor Lillqvist 4ac9bd5c1b Fix a couple uses of misleading function names in logging
Change-Id: Id7be123b1183a9e21383eb4ac894d3bd88691f5a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97867
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-03 16:02:42 +02:00
Tor Lillqvist 3edc4d2201 Move the setupKitEnvironment() function into a file of its own
A small re-factoring to help planned re-plumbing of the iOS app.

Change-Id: I21f09216a7c5adf965179765a75f5a0d521cd7f3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97771
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-07-03 08:40:49 +02:00
Ashod Nakashian 5c9988f2e3 wsd: faster jail setup via bind-mount
loolmount now works and supports mounting and
unmounting, plus numerous improvements,
refactoring, logging, etc..  When enabled,
binding improves the jail setup time by anywhere
from 2x to orders of magnitude (in docker, f.e.).

A new config entry mount_jail_tree controls
whether mounting is used or the old method of
linking/copying of jail contents. It is set to
true by default and falls back to linking/copying.
A test mount is done when the setting is enabled,
and if mounting fails, it's disabled to avoid noise.

Temporarily disabled for unit-tests until we can
cleanup lingering mounts after Jenkins aborts our
build job. In a future patch we will have mount/jail
cleanup as part of make.

The network/system files in /etc that need frequent
refreshing are now updated in systemplate to make
their most recent version available in the jails.
These files can change during the course of loolwsd
lifetime, and are unlikely to be updated in
systemplate after installation at all. We link to
them in the systemplate/etc directory, and if that
fails, we copy them before forking each kit
instance to have the latest.

This reworks the approach used to bind-mount the
jails and the templates such that the total is
now down to only three mounts: systemplate, lo, tmp.

As now systemplate and lotemplate are shared, they
must be mounted as readonly, this means that user/
must now be moved into tmp/user/ which is writable.

The mount-points must be recursive, because we mount
lo/ within the mount-point of systemplate (which is
the root of the jail). But because we (re)bind
recursively, and because both systemplate and
lotemplate are mounted for each jails, we need to
make them unbindable, so they wouldn't multiply the
mount-points for each jails (an explosive growth!)
Contrarywise, we don't want the mount-points to
be shared, because we don't expect to add/remove
mounts after a jail is created.

The random temp directory is now created and set
correctly, plus many logging and other improvements.

Change-Id: Iae3fda5e876cf47d2cae6669a87b5b826a8748df
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 05:42:43 +02:00
Szymon Kłos 11965d083e notebookbar: early init
- read settings from loolwsd.xml
- in case of notebookbar activated send :notebookbar parameter
- for mobile apps I left empty parameter in setupKitEnvironment calls

Change-Id: I5813589564b37eecc1e77c5d0eb737eca5f92f04
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97233
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-06-30 08:15:25 +02:00
Miklos Vajna 2604913fb6 kit: mark KitSocketPoll as final
KitSocketPoll has virtual functions, but a non-virtual destructor. Mark
it as final to make it clear that it's safe to call delete on it.

Change-Id: I685f9d7bcfbb82115e9c25991c877aa99391dd3e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97361
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-06-29 09:18:16 +02:00
Tor Lillqvist 7f25109f72 tdf#128502: Chunk of work to enable "multi-tasking" in the iOS app
Seems to not cause any serious regressions in the iOS app or in "make
run", but of course I am not able to run a comprehensive check of all
functionality.

Change-Id: I44a0e8d60bdbc0a885db88475961575c5e95ce88
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93037
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-06-26 13:09:51 +02:00
Ashod Nakashian 4a8937d0d1 wsd: performance improvements
Change-Id: I137dc67b4231df1cd23a9dce72e6b12dc1bf364e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95343
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:01:39 +02:00
Ashod Nakashian d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Ashod Nakashian 68bdbcf798 wsd: remove unused QueueHandler
Change-Id: Iec80d2afb1762175088b92a6e7140b0ca863a483
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95339
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:26:08 +02:00
Ashod Nakashian 6ab64ac992 wsd: single-char string literals -> char
Change-Id: I163d6fe1c80334317d38f8fed2199ad2b31a0f8a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95335
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:22:26 +02:00
Ashod Nakashian 224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Pranam Lashkari 8b349716eb killpoco: removed Poco::Process completely
Change-Id: Iba67abf9342c11517c69c1d94903bf4752aa87d6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/83770
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-29 14:27:54 +02:00
Marco Cecchetti 255d24ba8f forward the device form factor of the client on a new view request
This patch allows the lok core to know about the device form facor of
the client requesting the creation of a new view, immediately instead
of a later time.
When a request for a new view is sent a 'deviceFormFactor' parameter
is appended to the message.
This parameter can have one of the following values: 'desktop',
'tablet','mobile' and is forwarded to the lok core.

Change-Id: I21739ddb8c43c960164b3c625e4cf0a80f4616a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92691
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
2020-04-29 13:18:49 +02:00
Gabriel Masei d006204478 wsd: admin: send smaps fd along websocket upgrade request
Change-Id: I2c5c23284b7578f4c177ec337cc1262bf1259e96
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93074
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-28 17:20:07 +02:00
Dennis Francis 986bcce1c9 kit: Do not broadcast cell-cursor invalidation messages
is a follow up of 217dd2de54
"Do not broadcast view-cursor invalidation messages"

But this change is implicitly Calc specific because
LOK_CALLBACK_CELL_VIEW_CURSOR is used only in Calc.

This patch fixes the following bug:

Suppose there are at least three clients each with a different zoom and the
all client's cursors are placed in same tab-view and away from A1. Now
it can be seen at once that the cursors of other clients in each client
are rendered incorrectly.

The commit c6b18508aec0e609b4c3c000faf89c21e93620bd in core.git
"lok: send other views our cursor position in their view co-ordinates"
does the right thing by sending view specific cell-cursor positions.
But the broadcast of these messages in Kit.cpp means every client will
get the messages intended for others and possibly end up using the
wrong messages to draw the cell-cursors.

Change-Id: I6e9534c2e562f34b5c1fe37242b36e076b9319c8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92916
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
2020-04-28 13:30:22 +02:00
Michael Meeks 3bbbc4f2af Kit: remove redundant FILE wrapper around the fd.
Change-Id: I76f00a6855c486c18fb18fbcefe93ba0072a6eea
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92890
Reviewed-by: Gabriel Masei <gabriel.masei@1and1.ro>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-04-25 14:58:18 +02:00
Gabriel Masei 6b486f229a wsd: admin: move kit memory reporting from kit to admin module
Sometimes kit process goes into a heavy processing state (or even hangs)
and is not able to report its memory usage. Thus we can't implement cleanup
of problematic kit processes based on memory information reported by kit.
By moving memory reporting to admin module we avoid this problem.

Change-Id: Icf274e3a3a97b33623a93f9d2dc1e640ad9b7d99
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92752
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-25 09:11:35 +02:00
Ashod Nakashian ce03253e52 wsd: linkOrCopy now uses realpath to avoid links
This is needed in case the original template
directory itself is linked, which after setting
the FTW_PHYS flag to nftw skips them.

Change-Id: I63141b64ca486e6e2e979cdf1d80fe0fd0f3990c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92104
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 16:40:14 +02:00
Ashod Nakashian 7ea8d62cf6 wsd: improved logging of jail setup
And some formatting, but no functional changes.

Reduced the maximum time before logging all
link/copy activity of jail files, which typically
takes < 200ms.

Change-Id: Ie48072314471195a5f156cb45c616a5e57d2a287
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92103
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 16:39:46 +02:00
Ashod Nakashian 5471e967b9 wsd: killpoco - reduce Poco usage where unnecessary
Poco's File::linkTo was added in version 1.8.1 and
we still support older versions. Also, symlink(2) is
far more transparent and simpler here.

Change-Id: If537cc77cd1388f3c0e2a6b16b1edcf46a60e357
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92102
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 15:40:30 +02:00
Miklos Vajna 49fa1aa1c0 Fix -Werror,-Winconsistent-missing-override
Change-Id: I734c2987b20de3dda85ce079aced3c5b90f352e1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92667
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-04-22 09:58:26 +02:00
Dennis Francis 217dd2de54 Do not broadcast view-cursor invalidation messages
in kit as these are sent by core to specific view(s) by ultimately calling either
(as seen from the usages of LOK_CALLBACK_INVALIDATE_VIEW_CURSOR in core)

1. SfxLokHelper::notifyOtherView() where it sends to particular view.

or

2. SfxLokHelper::notifyOtherViews() where it sends to all views except
the current view.

The core makes the decision to broadcast or not, and if it does, then
the kit's broadcast of broadcasted messages can only cause a blowup of messaging
complexiity w.r.t number of views. It also does not make sense to send
view-cursor messages meant for a view to be sent to others in Calc
with clients of hetrogeneous zooms.

Change-Id: Ib07c5fbba9bb05c59048561d2c26aed00f3be598
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92633
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-22 09:48:55 +02:00
Tor Lillqvist b94fb53d4d tdf#128502: Make _loKitDocument in class Document non-static again
It was made static in ea2b77ce07 for
Android's sake, so returning it to be per-instance is not a big thing.

Keep a separate static just for the Android app's use for now, while
the Android app supports just one open document at a time anyway. (It
is for the iOS app that I am moving towards supporting multiple open
documents at a time.)

Change-Id: I7fabeb21883eb7cd7155e880eb4cc0413124d1f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-21 13:43:43 +02:00
Tor Lillqvist 1525f774d9 tdf#128502: Get rid of the static file-level variable 'document' in Kit.cpp
It is not a problem in the multi-process web-based Online, where the
variable exists separately in each KIT process (which handles exactly
one document). But in a mobile app, when we want to be able to handle
multiple document in the single process, we can't have such variables.

Change-Id: I1d3da48316eb3a8c72ff4957cc3fcba8f6870f16
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92582
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-21 12:15:07 +02:00
Tor Lillqvist 927f77354c Bin unused variable
Change-Id: I382e8bd8f2430dbab7f9ec623299c461b747e0a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92512
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-19 23:28:53 +02:00
Tor Lillqvist 2a16f34812 Don't use "kitbroker" as part of the thread name in a 'kit' process
It just causes confusion with the name "DocumentBroker".
DocumentBroker objects exist only in the WSD process. Instead just use
"kit".

Change-Id: I3d9915c4759899ea6ed9084cf3ec6dc0f3b88ee5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92474
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 16:33:56 +02:00
Michael Meeks eab1832b06 tdf#132100 - don't copy debugsource into jails.
gdb will take it from the system anyway, so it's just amazingly
excessive weight wrapped in a performance problem.

Change-Id: Ie8d7d2be97da64233a6d7cb4864d6ee88ea8c337
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92207
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-14 18:57:38 +02:00
Michael Meeks a7dc2d1467 kill IoUtil - obsolete & unused.
The switch away from LOOLWebSocket and the use of a websocket
for talking to forkit removes the need for the pipe code.

Change-Id: Ifb0c6c88681289e7a1709d9bc3281532935c7be4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92033
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 16:38:25 +02:00
Michael Meeks 28a9c4dc05 Poll - cleanup method naming, and fix merge issues.
This mends several problems from commit
5710c86323.

Change-Id: I1b29f29ca81679608a2692488fa1ef22b2e62dfd
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92032
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 13:58:00 +02:00
Michael Meeks 5710c86323 Poll - switch to ppoll for closer to microsecond accuracy.
Change-Id: Ib8a2bb6f60302df8631edadbbb8db626894c457c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 10:06:23 +02:00
Martin Milata c571d9286d tdf#129895: handle symlinks when populating chroot
In linkOrCopy, the nftw() function is used without the FTW_PHYS flag to
populate child roots from systemplate. From man nftw:

  FTW_PHYS
    If set, do not follow symbolic links.  (This is what you want.)
    If not set, symbolic links are followed, but no file is reported twice.

Because the order in which directory entries are visited is not defined,
having multiple symlinks to a file results in only one of the paths
being created in the chroot.

This is not really a problem because loolwsd-systemplate-setup creates
systemplate without symlinks. Fixing it might prevent unpleasant
surprises in the future though, and might possibly allow to make
systemplate and chroots smaller (also the manpage says that you want
it:)).

The commit adds FTW_PHYS flag to the call as well as symlink handling.

Change-Id: I01354f529b5d340185988ed026f266caf17a6881
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87749
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-07 13:22:42 +02:00