| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This makes the function safer on linux since the file is warrantied to never
be visible on the filesystem, cannot be linked anywhere unless O_EXCL is
not specified and it is lost forever on any kind of program termination.
|
|
|
|
|
|
|
| |
Print message if creation of temporary file fails.
When rename of temporary file fails, exit with ARCHIVE_FAILED.
Reword message on failed rename.
Revert d84ec3f and 85b9f66, call archive_set_error()w before unlinking.
|
|
|
|
|
|
|
| |
As Windows does not support atomic rename/_wrename
we have to unlink the file right before calling _wrename
leaving a short unsafe window where a different file with the
same name can be created and make the rename operation fail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This flag changes the way that regular files are extracted:
Instead of removing existing files first and re-creating them in
order to replace their contents, a temporary file is created and
when writing to the temporary file is completed, the file is
rename(2)d to the final destination name.
This has the effect of presenting a consistent view of the file to
the system (either the file with the new contents or the file with
the old contents). Removing and overwriting the file has the
undesired side effect that the the system can either not see the
file at all (from the time it is being removed till the time it is
being re-created), or worse it can see partial file contents. This
is problematic when extracting system files (for example shared
libraries).
If the existing file that is going to be overwritten is a hard link,
for now we unlink it before calling rename(2). This can be done
correctly by creating a hardlink to a tmpnam(3) generated file
and then use rename(2), but that is fairly intrusive and requires
refactoring.
Fixes #1289
|
|
|
|
|
|
|
|
|
| |
identifiers for which there is both a struct and a function. MinGW uses
a #define for setting struct stat to be the right struct, so doing #undef
stat to clear the way for a #define for stat() the function
inadvertantly clobbers the selected stat struct. To avoid this, we
define la_stat() to _la_stat on Windows and stat() elsewhere, and then
use la_stat() instead of stat().
|
| |
|
|
|
|
|
|
|
| |
A bunch of constant variables/tables are missing const markings.
Adding them allows moving more data to the read only sections, and
ends up shrinking writable data a bit by 1k on x86_64/Linux. Not
much, but still nice.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This breaks a static dependency on libbz2. Before this,
any use of libarchive that ended up linking archive_util.c would
require libbz2. (And since archive_util.c contains a bunch of
very core functions, this is pretty much everybody.)
Now you only require libbz2 if you request library version information
or actually use some other feature that involves bzip2 support.
Note that most of the libraries provide version information via
compile-time macros -- libbz2 only provides such information via
a function call, which is why this issue only arises with libbz2.
In particular, the libbz2 version reports the version that we
are currently linked against; the other library versions report
the version we were compiled with (which may not be the same as
what we are currently using).
|
| |
|
| |
|
|
|
|
|
|
|
| |
query libarchive support
Rework some of the Zip, Cab, and LZ4 tests to use these
to determine what behavior they should expect.
|
|
|
|
|
| |
This should address an issue compiling with older versions
of Visual Studio.
|
| |
|
|
|
|
| |
reallocation moving the string
|
| |
|
| |
|
| |
|
|
|
|
| |
Fix a const mistake.
|
| |
|
|
|
|
|
|
|
|
|
| |
Add a utility function, archive_version_details, to return a string
containing the libarchive version as well as the versions of third party
libraries such as zlib, bz2lib and liblzma. Use this function for
bsdtar --version and bsdcpio --version.
http://code.google.com/p/libarchive/issues/detail?id=118
|
|
|
|
| |
This is the normal implementation of quicksort.
|
|
|
|
|
| |
This is useful for sorting a list of filepaths to
multivolume RARs for example.
|
| |
|
|
|
|
|
|
|
|
| |
to avoid file descriptor leaks to the child process.
- Pass O_CLOEXEC to open(2) system call if it is defined.
- Use fcntl(2) and F_DUPFD_CLOEXEC instead of dup(2)
if F_DUPFD_CLOEXEC is defined.
- Set FD_CLOEXEC with fcntl(2) if a file descriptor does not have.
|
|
|
|
|
|
|
|
|
|
| |
archive_string_append_from_mbs,
those function should report the error to the caller instead of invoking __archive_errx().
We should report that ENOMEM error as possible as we can and we still need to further
improve reporting ENOEM.
SVN-Revision: 4193
|
|
|
|
| |
SVN-Revision: 3693
|
|
|
|
|
|
| |
I migrated that of Windows implementation into archive_util.c.
SVN-Revision: 3661
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Change the interface in order to reduece the comparison of
charset names. Previous version always did it when the functions
were called; it was very inefficient. So I have made a conversion
object, struct archive_string_conv, to resolve that issue.
- Integrate *_from_charset and *_to_charset into *_in_locale because
of above.
- Integrate *_from_utf16be and *_to_utf16be into *in_locale.
- On Windows, Make a codepage from a charset name to know whether
current codepage and specified charset are the same or not.
SVN-Revision: 3108
|
|
|
|
|
|
|
|
|
| |
assumption that WCS was UNICODE. What format WCS has is deeply dependent on
platform, and WCS must be converted to/from locale dependent MBS on every
platform through mbstowcs/wcstombs or related functions, which the platforms
provide. We should, thus, respect the platform policy about WCS for potability.
SVN-Revision: 3074
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* New functions archive_{read,write}_set_{format,filter}_option accept
three strings: module name, option name, value.
This is a better match for C clients of the library, who want
to set one option at a time anyway for better error handling.
* archive_{read,write}_set_options still accept a single string
with possibly multiple options, but are now much simpler internally
because they build on the above.
* New tests for all of the above.
* Update a lot of tests to give good coverage of the new functions.
SVN-Revision: 3026
|
|
|
|
|
|
| |
current locale and specific locale with iconv.
SVN-Revision: 3021
|
|
|
|
|
|
| |
archive_string.c, and Use iconv for it if available.
SVN-Revision: 3019
|
|
|
|
|
|
| |
and refactor the charset conversion routines to be more consistent.
SVN-Revision: 2993
|
|
|
|
|
|
|
| |
when it's available.
See Issue 66 and Issue 132 for more discussion.
SVN-Revision: 2992
|
|
|
|
|
|
| |
putting the new error into it.
SVN-Revision: 2989
|
|
|
|
|
|
|
|
| |
In particular, we should start filling in assertions in lots
of tests to verify that textual error messages are getting
generated on errors.
SVN-Revision: 2777
|
|
|
|
| |
SVN-Revision: 2316
|
|
|
|
|
|
|
| |
this, as there are apparently libarchive uers that abuse archive_errno()
and this change is likely to mask bugs in such software.
SVN-Revision: 1989
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of files. But, the old API is supported almost entirely unchanged, which
I wasn't certain would be possible.
Big changes:
* You can add more than one write filter by using
archive_write_add_filter_{bzip2,compress,gzip,lzma,xz}.
This will be more interesting when we have uuencode, RPM, encryption.
* The old archive_write_set_compression_XXXX are shorthands for
"remove all the current filters and add this one." They're
deprecated and scheduled to be removed in libarchive 4.0.
* The internal API and life cycle for write filters has been
rationalized: create, set options, open, write, close, free.
* New utility functions provide information about each filter
when there's more than one: code, name, and number of bytes processed
* Old archive_bytes_compressed(), etc, are implemented in terms of
the more generic new functions.
* The read side was generalized to also support the new utility
functions.
In particular, the write filters are much simpler since each
one doesn't have to deal with blocking. In this version, there's
still a "write_add_filter_none" that handles blocking, but I
think I'll soon fold that down into the client wrapper and
add_filter_none will become a no-op. I think this also gets
us a big step closer to multi-volume support on the write side.
SVN-Revision: 1920
|
|
|
|
|
|
|
| |
and merge __la_mkstemp() and __archive_mktemp() because
__la_mkstemp() was only used by __archive_mktemp().
SVN-Revision: 1896
|
|
|
|
|
|
| |
which will be used by ISO writer and xar writer.
SVN-Revision: 1895
|
|
|
|
| |
SVN-Revision: 1786
|
|
|
|
| |
SVN-Revision: 1680
|
|
|
|
|
|
| |
My previous change caused error on linux.
SVN-Revision: 1665
|
|
|
|
|
|
| |
Found by Clang Static Analyzer.
SVN-Revision: 1617
|
|
|
|
| |
SVN-Revision: 1222
|
|
|
|
|
|
|
|
|
|
| |
not being used. Some of these are good catches, a few are
annoying. Unfortunately, GCC on this system won't just
allow you to cast the result explicitly to (void) to
shut up the error, so I've had to introduce some gratuitous
extra variables. <sigh>
SVN-Revision: 1075
|
|
|
|
| |
SVN-Revision: 543
|
|
|
|
| |
SVN-Revision: 530
|
|
|
|
| |
SVN-Revision: 510
|