summaryrefslogtreecommitdiff
path: root/src/io.c
AgeCommit message (Collapse)AuthorFilesLines
2020-02-14io: add stream copy helperTimo Teräs1-4/+30
2020-01-25don't ignore md parameter to apk_fileinfo_hash_xattr_array()Reid Rankin1-1/+1
2020-01-11io: use min() instead of MIN()Timo Teräs1-5/+4
2020-01-11io: convert bstream mmap to istream, remove the now obsolete bstream machineryTimo Teräs1-197/+65
2020-01-11convert remaining locations to use istream instead of bstreamTimo Teräs1-87/+110
2020-01-11istream, archive, db: convert db and tar function to use istreamTimo Teräs1-7/+157
2020-01-11istream: add buffering capabilityTimo Teräs1-33/+47
Convert all implementations to do buffering. This is in preparation to remove bstream interface as redundant. istream_read() will return full reads unless end-of-file. The backends can return short reads to optimize buffering or due to other reasons like boundary change for gz.
2020-01-06io: remove the now unused pid association with istreamTimo Teräs1-21/+6
2020-01-06io: remove unused size parameter from bstream closeTimo Teräs1-32/+22
2019-12-18io: use proper base struct types for method implementationsTimo Teräs1-50/+33
2018-10-30fix xattr hash to be sha1Timo Teräs1-1/+1
The hash type was accidentally changed in previous commit. Currently csum->data cannot hold longer hash, so fix the hash.
2018-10-26add support for openssl 1.1Timo Teräs1-19/+26
2018-01-04enable automatic update of indexes controlled by --cache-max-ageTimo Teräs1-5/+7
This modifies apk cache for indexes to be automatically refreshed periodically without explicit 'update' or '--update-cache' usage. The default is to do if-modified-since request if the local copy is older than 4 hours. This age can be changed with --cache-max-age. Using --update-cache will change this age to 60 seconds to make sure the cached copy is relatively new. The small age is in order to try to avoid downloading indexes second time when apk-tools is upgraded and apk re-execs after self-upgrade. Accordingly using explicitly 'apk update' will now enforce --force-refresh and request the very latest index by requesting any potential http proxy to do refresh too.
2017-10-12io: fix skip and splice to detect unexpected end-of-fileTimo Teräs1-28/+19
2017-08-23fix comparison of unsigned expression < 0 is always falseDmitry Golovin1-3/+5
found by clang
2017-06-23io: make io vtables const struct, and add accessors for themTimo Teräs1-36/+58
This reduces function pointers in heap, and unifies how the io functions are called.
2017-02-15add support for pre and post commit hooksHenrik Riomar1-3/+4
This allows for instance integration of etckeeper [TT: Reorganized code a bit, and modified to use single directory commit_hooks.d with argument for script of stage.]
2015-11-09io, database: preserve [am]time for cached and fetched filesTimo Teräs1-0/+58
preserve [am]time for all packages and indexes. this fixes the caching error that 'apk update' is after new index is generated, but before the used mirror is synchronized. this caused local apkindex timestamp to be newer than file in mirror, when in fact it was outdated index. this also fixes fetched files to have build timestamp so that files going to .iso or custom images have proper timestamps (rsync with appropriate --modify-window now works)
2015-10-08io: fix posix_fallocate failure handlingNatanael Copa1-1/+1
We need fall back to a splice buffer if posix_fallocate call fails due to file being a device (eg tty) or a pipe. This fixes apk fetch --stdout.
2015-09-03io: use posix_fallocate to allocate disk spaceTimo Teräs1-3/+8
ftruncate does not allocate it, and subsequent access to mmaped file will result in SIGBUS. this fixes to properly report disk full errors.
2015-06-12fix bstream_from_fd to use mmap when availableTimo Teräs1-1/+2
2015-05-26detect failures in writing to file during final flush of buffersAlex Dowad1-1/+3
In practice this should fix to e.g. not wipe out /etc/apk/world if final flush to /etc/apk/world.new fails. This was prompted by an incident the other day where I ran the root partition of an Alpine box out of space using 'apk add', and apk helpfully wiped the contents of /etc/apk/world at the same time. It might be tricky to try to reproduce exactly the same failure, but from an examination of the code, setting 'rc' before the final call to fdo_flush rather than after is one possible cause of this behavior. (If the entire contents of /etc/apk/world.new are buffered, and all get written out in the final fdo_flush call, and that call fails, fdo_close will still happily rename /etc/apk/world.new to /etc/apk/world.)
2015-04-22io: fix compiler error by including stdint.hAlex Dowad1-0/+1
According to the C standards, uint32_t is defined in stdint.h. Presumably apk is usually built against C libraries where stdint.h is indirectly included through another header file, but this isn't the case with the version of glibc which I am using.
2015-04-13fix tee io error handlingTimo Teräs1-3/+5
use ERR_PTR mechanism, and handle it at all places.
2015-04-08use memmove for copying buffer leftovers, as the ranges may overlapTimo Teräs1-1/+1
issue cought by fortify
2015-04-08unbreak audit after xattr supportTimo Teräs1-2/+1
2015-04-08audit xattrsTimo Teräs1-27/+71
ref #3027
2015-03-11calculate and store checksum of xattrsTimo Teräs1-0/+36
ref #3027
2015-03-10rename file info related functions for consistencyTimo Teräs1-3/+3
2015-03-10extract xattrs from packagesTimo Teräs1-0/+5
ref #3027
2015-03-10rework error handling for write streamsTimo Teräs1-7/+4
2015-03-10rework error handling for read streamsTimo Teräs1-12/+11
2015-01-30remove support for old database location in /varTimo Teräs1-31/+0
the location changed in apk-tools 2.1.0 (March 2011) which was used in Alpine Linux 2.2.
2014-10-08io,url,db: support for if-modified-sinceTimo Teräs1-17/+12
2014-10-07io: fix few error path leaksTimo Teräs1-2/+7
2013-07-04io: use fget{pw,gr}ent_r only on uclibc and glibcTimo Teräs1-4/+23
musl does not have those.
2013-06-17io: get rid of APK_PROGRESS_SCALETimo Teräs1-2/+2
no need to muldiv all the time, just pass the current amount of bytes done, and let callbacks use that directly.
2013-06-17cache: implement progress bar (ref #1170)Timo Teräs1-2/+9
2013-06-17io: fix splice for copying unknown lengthsTimo Teräs1-1/+3
2012-02-23db: keep architecture in $ROOT/etc/apk/archTimo Teräs1-0/+30
This we use proper arch in case modifying chroot installation.
2012-02-23audit, db: add etc/apk/protected_files.d and new audit featuresTimo Teräs1-2/+5
fixes #607. audit is now mostly rewritten for the new functionality. And has new features like --check-permissions, --recursive and --packages. $ROOT/etc/apk/protected_files.d/*.list can now contain additional protected paths, one path per line: +etc @etc/init.d -tmp + will include the directory as protected configuration directory. @ considers the directory protected, but will backup only symlinks. - removes any protection lbu should be modified to put include and exclude paths in etc/apk/protected_files.d/lbu.list. Additionally, some packages might provide their own listings. E.g. ssh might want to provide ssh.list with something like: +root/.ssh +home/*/.ssh
2012-02-22db, io: load repositories also from etc/apk/repositories.d/*.listTimo Teräs1-1/+1
Load additional repositories from $ROOT/etc/apk/repositories.d/*.list unless --repositories-file is given as parameter.
2012-02-22db, solver, io: scan cache items at startupTimo Teräs1-0/+27
It is faster to just scan the cache directory for existing packages at startup than trying to faccessat() them on demand. It also makes quite a few parts of the code more readable and simpler.
2011-09-13all: update copyright year statementTimo Teräs1-1/+1
2011-03-16db: relocate from /var/lib/apkTimo Teräs1-0/+31
move all files therein to other places. this allows /var to be mounted from harddisk, but rest of system be run from ramdisk. this also removes support for historical version of the scripts database which was obsoleted in 2.0_pre16 (in July 2009).
2010-12-09io: enhance istream/bstreams with pipe to forked childTimo Teräs1-10/+29
* prunes the child pid to avoid zombies * handles the errors so e.g. file-not-found is reported properly
2010-10-08db: fix the previous commitTimo Teräs1-1/+1
id cache needs to be initialized early. and group database filename is surprisingly 'group'.
2010-10-08io, db: id cache should be specific to database root, not system rootTimo Teräs1-36/+52
Otherwise we end up using wrong uid/gid mappings when doing install to alternate system root. Fixes #434.
2010-08-30Fix building on eglibcNatanael Copa1-0/+1
Seems like recent eglibc requires that you include sys/stat.h
2010-06-12archive: honor username/groupname instead of uid/gidTimo Teräs1-0/+126
Take the uid/gid from passwd and group.