Age | Commit message (Collapse) | Author |
|
FileFd currently supports no fileflags which would make sense to provide
via mkostemp, so we can just use mkstemp here which is a standard
function compared to glib extension mkostemp.
O_CREAT (Create) and O_TRUNC (Empty) are implied by O_EXCL, which is the
mode mkstemp uses by default. The file description is opened ReadWrite,
but that used to be the default for FileFd in the old times and not a
problem as the difference is needed by FileFd to decide in which way the
compressor pipeline needs to be created (if any).
Git-Dch: Ignore
|
|
Avoid the warning "the use of `mktemp' is dangerous,
better use `mkstemp' or `mkdtemp'". It is not strictly necessary to
change the usage from a security point of view here, but mktemp is
also removed from the standard since POSIX.1-2008.
The mkostemp call returns a file descriptor the logic for
TemporaryFileName has been changed accordingly to get the same results.
The file permissions are corrected by using fchmod() as the default for
FileFd is 666 while mkstemp creates files with 600 by default.
|
|
The fix avoid the warning "comparison between signed and
unsigned integer expressions [-Wsign-compare]"· The index for the loop needs
to be unsigned for compare with globbuf.gl_pathc structure
member
|
|
- add Glob() to fileutl.{cc,h}
Conflicts:
apt-pkg/contrib/fileutl.h
debian/changelog
|
|
|
|
|
|
|
|
|
|
|
|
Testing for global PendingErrors in users of CopyFile is incorrect
in so far as unrelated errors will prevent us from copying perfectly
fine files and checking for the validity of the files is just better
in CopyFiles as it already checks if files are at least opened.
Add also a higher-level error message to the error stack if it fails.
|
|
OpenInternDescriptor failures would cause additional errors to be
generated by double-closing an fd. Other errors (although these
are generated if the method is used incorrectly, so unlikely)
didn't close the fd aswell.
Closes: 704608
|
|
Previously some errors would set the Fail flag while some didn't
without a clear reason as all errors leave a bad FileFd behind,
so we use a helper now to ensure that all errors set the flag.
|
|
|
|
|
|
- remove _POSIX_SYNCHRONIZED_IO guard in FileFd::Sync() around fsync
as this guard is only needed for fdatasync and not defined on hurd
|
|
- dup() given compressed fd in OpenDescriptor if AutoClose
is disabled as otherwise gzclose() and co will close it
|
|
- ensure that we close compressed fds, wait for forks and such even if
the FileFd itself is set to not autoclose the given Fd
|
|
|
|
|
|
|
|
content as this causes some "interesting" hickups resulting in segfaults
as it seems (Closes: #554387, #670979)
|
|
- check that the fd which are closed are valid
|
|
- redirect stderr from compressors to /dev/null
|
|
|
|
- remove the libz-dev alternative from zlib1g-dev build-dependency
- do the same for bz2 builtin if available
* apt-pkg/contrib/fileutl.cc:
- use libz2 library for (de)compression instead of the bzip2 binary as
the first is a dependency of dpkg and the later just priority:optional
so we gain 'easier' access to bz2-compressed Translation files this way
|
|
|
|
compatible with users accessing it directly, but this prepares for a drop
of this strict requirement in the future
|
|
- do not warn about the ignoring of directories (Closes: #662762)
|
|
- clean up lost atomic cachefiles with 'clean' (Closes: #650513)
|
|
|
|
- store the offset in the internal fd before calculate size of
the zlib-handled file to jump back to this place again
It jumped back to the position of the content - which is wrong as
the internal fd is compressed and even reseting to the beginning of
the file doesn't work as zlib uses an internal buffer, so while we
might haven't read anything yet zlib might have done so already…
|
|
|
|
Also, read only one char in each step of ReadLine instead of back-"seeking"
|
|
information if we are working on a pipe which can't seek
|
|
|
|
anymore and therefore are also able to drop quiet a bit of duplicated code
|
|
|
|
|
|
renamed it everywhere as otherwise stuff "magically" starts to fail…
Fixes commit 2209 as the mixture of #define names generates a lovely
compilable but non-functional mixture of gzip usage…
|
|
internally so that it is exported and can be used like a "normal"
uncompressed file with FileFd
This allows us to hide th zlib usage in the implementation and use gzip
instead if we don't have zlib builtin (the same for other compressors).
The code includes quiet a few FIXME's so while all tests are working
it shouldn't be used just yet outside of libapt as it might break.
|
|
- drop the explicit export of gz-compression handling
|
|
- implement a ModificationTime method for FileFd
|
|
to search for compressed silbings of the given filename and use this guessing
instead of hardcoding Gzip compression
|
|
provide ReadOnly, WriteOnly and ReadWrite as flags alongside
the additional flags as decompression will be one-way later,
but certain parts really depend on Write* openmodes being
ReadWrite opens, so we will have to fail for those.
|
|
|
|
size are pretty unlikely for now, but we need it for deb
packages which could become bigger than 4GB now (LP: #815895)
|
|
|
|
- add GetModificationTime() helper
* apt-pkg/pkgcachegen.cc:
- regenerate the cache if the sources.list changes to ensure
that changes in the ordering there will be honored by apt
* apt-pkg/sourcelist.{cc,h}:
- add pkgSourceList::GetLastModifiedTime() helper
|
|
|
|
- honor Dpkg::Chroot-Directory in the RunScripts*() methods
|