Commit Graph

12 Commits

Author SHA1 Message Date
Matthew Leeds
72cad27632 lib: Don't try to use a NULL FlatpakRemoteState
In flatpak_remote_ref_new(), the state parameter is optional, so check
if it's NULL before trying to use it in
flatpak_remote_state_lookup_sparse_cache(). This prevents a seg fault
when GNOME Software is installing a .flatpakref file.

Fixes https://github.com/flatpak/flatpak/issues/1632

Closes: #1635
Approved by: pwithnall
2018-05-01 17:28:12 +00:00
Matthew Leeds
ff93f89eb5 lib: Don't try to read uninitialized memory
Oddly this uninitialized memory read leads to a seg fault on ARM but
not on x86_64.

Closes: #1621
Approved by: mwleeds
2018-04-26 23:22:32 +00:00
Alexander Larsson
f4460bcf3f libflatpak: Fix leak in FlatpakRemoteRef 2018-04-24 10:30:28 +02:00
Matthew Leeds
e1e64e4d25 lib: Make metadata optional in FlatpakRemoteRef
Sometimes we're not able to access the `xa.cache` data that's usually in
the summary and ostree-metadata, such as when the remote is a USB drive
that had `ostree summary -u` run on it. In that case, we don't want
flatpak_remote_ref_new() to fail, because the FlatpakRemoteRef instance
might still be useful enough without the metadata, such as in
flatpak_installation_list_remote_refs_sync. So this commit makes the
metadata property of FlatpakRemoteRef nullable which has the effect of
making the test_list_refs_in_remote() test pass with P2P enabled.

The metadata property wasn't added to FlatpakRemoteRef until commit
c33f842b7 so presumably no one is depending on it.

Closes: #1600
Approved by: alexlarsson
2018-04-23 06:33:28 +00:00
Alexander Larsson
4da56c8c62 RemoteState: Drop cancallable from flatpak_remote_state_lookup_cache()
This is a no-i/o operation on immutable data, there is no need for
a cancellable.

Closes: #1594
Approved by: alexlarsson
2018-04-20 11:16:57 +00:00
Alexander Larsson
7a61658012 RemoteState: Don't unnecessary strdup the metadata
This makes flatpak_remote_state_lookup_cache() return the metadata
from the actual FlatpakRemoteState rather than duplicating it.
All callers are updated to not free anymore and to strdup if needed.

Closes: #1594
Approved by: alexlarsson
2018-04-20 11:16:57 +00:00
Joaquim Rocha
516e249e50 lib/installation: Use "collection refs" when listing refs
When listing refs installed or from a remote, only the refs matching the
main collection-id were being returned. However, it is very important to
have access to all refs, independently from their collection-id,
especially when trying to list remotes coming from a USB repository.

These changes add the mentioned refs and update the places that use
this list, both in the lib and in the CLI.

For the implementation to become easier, we introduce also a
FlatpakCollectionRef, that should be replaced by OstreeCollectionRef
once the latter becomes part of the general API (currently it is in the
experimental one).

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Alexander Larsson
abb1e6f7fd lib: Make all *Ref properties construct-only and static-strings
The Ref objects are always created by the library itself, and are
immutable.

Closes: #1591
Approved by: alexlarsson
2018-04-19 08:17:46 +00:00
Alexander Larsson
c33f842b70 lib: Add metadata info in FlatpakRemoteRef
This adds things like the size and the metadata, as well as eol strings
to FlatpakRemoteRef. We typically have this accessible anyway, in the
FlatpakRemoteState.

This makes flatpak_installation_fetch_remote_size/metadata_sync deprecated.

Closes: #1591
Approved by: alexlarsson
2018-04-19 08:17:46 +00:00
Matthias Clasen
75218c4a65 Fix license headers
We were referring to the nonexisting "version 2" of the
Lesser GPL. It should be "version 2.1".
2016-07-29 14:27:49 -04:00
Alexander Larsson
8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson
c24528d369 Rename source files to flatpak 2016-05-09 09:00:20 +02:00