Commit Graph

47 Commits (cute-signatures)

Author SHA1 Message Date
Ariadne Conill 2c3cef8787 portability: take over strlcpy 2021-12-29 20:14:41 +02:00
Ariadne Conill f4f7796ccc everywhere: use stdlib.h for malloc(3) definition, not GNU-specific malloc.h
musl implements support for malloc.h, but it is only a stub.  we do not use
any of the GNU-specific malloc interfaces, so just use POSIX stdlib.h instead.

ref #10794
2021-12-14 16:23:29 +00:00
Timo Teräs 7d6de2203e database: support loading v3 indexes 2021-11-09 21:50:11 +02:00
Timo Teräs 62e1cba691 adb: adb_walk_adb fix out of boundary write
If a signature is longer than max allowed adb signature length
then adb_walk_block writes out of boundary of stack variable tmp.

The len += snprintf is not safe per standard snprintf implementation
(kernel does it differently). Introduce and use apk_blob_push_fmt
which does the checking better.

Fixes #10752

Reported-by: Samanta Navarro <ferivoz@riseup.net>
2021-07-26 10:19:20 +03:00
Timo Teräs 1456296b43 add adbgen applet to generate databases from it's text dump 2021-06-02 22:35:58 +03:00
Timo Teräs 2156107afc minor performance improvements on build and code 2020-10-09 16:09:19 +03:00
Timo Teräs efe0c4afec adb: introduce apk-tools database format, and few applets
This is a flat buffers inspired format that allows fast
mmaped access to the data with low overhead, signature support
and relatively good forward support.
2020-10-09 16:09:19 +03:00
Timo Teräs d0edeec8fb make the atom functions not use global state
This greatly helps with memory management on applications that
may want to daemonize and open/close database several times.

Also the lifetime and "owner" of memory for all data is now
explicitly bound to owning struct apk_database, which might
be helpful when writing language bindings. As side effect, the
interned "atoms" are unique only within what apk_database, so
comparing packages from different apk_database may not work
as expected.

Fixes #10697
2020-05-19 12:02:56 +03:00
Timo Teräs 7b76182f39 fix apk_blob_pull_csum to always initialize apk_checksum
Fixes #10686 to not use uninitialized value in the error paths.
2020-05-07 13:28:24 +03:00
TBK 5d796b5678 use SPDX-License-Identifier in source files 2020-05-07 10:45:42 +03:00
Timo Teräs c054fbc11e db: fix unaligned memory access in csum_hash() 2020-02-21 09:33:58 +02:00
Timo Teräs 3694dc5fa2 fix murmur3 hash unaligned memory access
- do not do unaligned accesses on non-x86 hardware
- clean up the code a little bit
2020-02-17 21:36:28 +02:00
Timo Teräs 6da3e8eb15 istream, archive, db: convert db and tar function to use istream 2020-01-11 11:20:45 +02:00
Ian Douglas Scott d901444ec9 Fix compile with glibc 2019-05-28 13:07:50 +03:00
Timo Teräs 44daf80873 fix strncpy bounds errors
error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]

Based on patch by Elan Ruusamäe <glen@delfi.ee>
2019-02-13 16:05:27 +02:00
Timo Teräs 9039dbe06c blob: fix sign extension in test_bit 2016-04-03 16:06:57 +03:00
Andrew Wilcox 1bc31bdf22 blob: Add missing header 2015-10-08 11:35:09 +03:00
Timo Teräs 5ecc97e724 add simple stats applet 2015-06-12 11:20:01 +03:00
Timo Teräs 3e8e2b5622 free atoms when VALGRIND is defined 2015-06-12 10:32:54 +03:00
Timo Teräs 36d730e95d optimize base64 decoding a bit
it's a hot path for decoding checksums in fdb
2015-06-12 09:08:31 +03:00
Timo Teräs ed94d8ffba use murmur3_32 hash
it is more efficient than the previously used djb hash
2015-06-11 16:54:13 +03:00
Timo Teräs 23d0a2244a ignore .apk-new files for overlays 2015-04-08 11:08:16 +03:00
Timo Teräs 36d5b91495 support extended pax header in tar extractor 2014-11-01 19:17:06 +02:00
William Pitcock 78ee4267cd libapk, apk(8): fix header inclusion issues with musl's headers 2013-06-12 10:47:11 -05:00
Timo Teräs b7a22e555f solver, test: implements more provides things, add tests
ref #574
2012-02-27 16:35:04 +02:00
Timo Teräs 073df81973 blob: fix base64 decoding after previous optimizations 2012-02-10 14:19:53 +02:00
Timo Teräs fe9b4a3888 blob: optimize spn and cspn 2012-02-08 17:01:14 +02:00
Timo Teräs 4aa80564f9 blob: optimize digit and base64 decoding 2012-02-08 14:02:26 +02:00
Timo Teräs 500f8d4a7d solver, db: implement repository pinning
Improves /etc/apk/repositories format so you can say:
http://nl.alpinelinux.org/alpine/v2.3/main
@edge http://nl.alpinelinux.org/alpine/edge/main
@testing http://nl.alpinelinux.org/alpine/edge/testing

After which you can pin dependencies to these tags using:
 apk add stableapp newapp@edge bleedingapp@testing

Apk will now by default only use the untagged repositories,
but adding a tag to specific dependency:
 1. will prefer that tag for the name
 2. allowing pulling in dependencies from that tag (though,
    it prefers untagged packages to satisfy deps if possible)

fixes #575
2011-10-29 05:18:21 +03:00
Timo Teräs 1817b0a3c3 all: update copyright year statement 2011-09-13 11:53:01 +03:00
Timo Teräs 972bec3210 various: use 'atoms' for certain package field and misc fixes
- implement a hash table for commonly shared fields such as
   license, version and architecture
 - use macroes to print blobs or pkgname-pkgver strings
 - fix some old cruft
2010-12-14 19:51:16 +02:00
Natanael Copa c9690b0e7c blob: fix segfault on x86_64 with --virtual
blob.ptr might be non-null on empty field in /var/lib/apk/installed
so we compare with blob length.

This fixes a segfault on x86_64.
2010-11-23 09:37:12 +00:00
Timo Teräs 038b672061 state: improve error messages from dependency failures
Print more information why installation changeset calculation failed.
Fixes #187.
2010-06-01 11:49:32 +03:00
Timo Teras a7c5fda40a blob: base64 encoding and decoding
and prefer sha1 checksums to be stored in base64 encoded format.
2009-07-15 14:48:57 +03:00
Timo Teras 981bc118f8 db: live with sha1 and md5
this also convers scripts file to a tar archive.
2009-07-14 19:14:05 +03:00
Timo Teras e98d8253b9 blob: add some likelyness to help compiler optimizations 2009-07-14 14:08:15 +03:00
Timo Teras 8d1eeb58e4 blob: some helpers to replace snprintf
snprintf is dog slow. make the blob stuff have some helper functions
so we can use them in code paths that are executed often.
2009-07-14 13:27:21 +03:00
Timo Teras f1985b03bd hash: allow caching of hash value 2009-07-14 10:47:20 +03:00
Timo Teras 4562f44f9b bstream: make tokenizable and load index using bstream
some fixes on index reading code too.
2009-07-14 09:33:47 +03:00
Timo Teras bf094dc5ea csum: use openssl instead
instead of having static md5 implemenation, use the openssl
library for digest functions.
2009-07-08 10:45:49 +03:00
Timo Teras fac4cdb3fa blob: function to checksum a blob
And use it in couple of places. Some whitespace fixes too.
2009-06-28 18:52:40 +03:00
Timo Teras 7cef96c30d blob: add strspn helpers 2009-04-14 18:46:35 +03:00
Timo Teras 15b547c55b db: keep only filename in file entries, hash by both directory and file 2009-01-14 10:44:47 +02:00
Timo Teras f0609951b9 hash, db: use apk_blob_t and list_* 2008-11-27 20:25:01 +02:00
Timo Teras 57154db85d db: parse new style .PKGINFO 2008-11-06 16:58:58 +02:00
Timo Teras 823283edca Argument parsing. Some other stuff too. 2008-04-21 16:30:10 +00:00
Timo Teras d6c7435242 Initial commit of some stuff written so far. Still in state of flux. Expect
breakage and major changes.
2008-04-17 14:09:13 +00:00