Skip to content

Fix unpacking of filenames with contains UTF-8 characters #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

### Fixed

* Fix unpacking of filenames with contains UTF-8 characters. [#52]
* Fixed the build script so it enforce the use of `libarchive` 3.2.0 or newer.

[#52]: https://github.com/OSSystems/compress-tools-rs/pull/52

## [0.10.0] - 2021-02-11

### Changed
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ futures-executor = { version = "0.3.5", optional = true }
blocking = { version = "1.0.0", optional = true }
tokio = { version = "1.0.0", features = ["rt-multi-thread", "macros", "fs", "net"], optional = true }
tokio-util = { version = "0.6.0", features = ["compat"], optional = true }
libc = "0.2.86"

[features]
async_support = ["async-trait", "futures-channel", "futures-core", "futures-io", "futures-util", "futures-executor"]
Expand Down
4 changes: 2 additions & 2 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
image = "ossystems/rust-cross:armv7-unknown-linux-gnueabihf-libarchive-0.2.1a"
image = "ossystems/rust-cross:armv7-unknown-linux-gnueabihf-libarchive-0.2.1b"

[target.aarch64-unknown-linux-gnu]
image = "ossystems/rust-cross:aarch64-unknown-linux-gnu-libarchive-0.2.1a"
image = "ossystems/rust-cross:aarch64-unknown-linux-gnu-libarchive-0.2.1b"
5 changes: 3 additions & 2 deletions scripts/generate-ffi
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ bindgen \
--whitelist-function "archive_error_string" \
--whitelist-function "archive_errno" \
\
--output $basedir/src/ffi.rs \
--output $basedir/src/ffi/generated.rs \
\
$basedir/wrapper.h

rm $basedir/wrapper.h
sed -i 's,pub ,pub(crate) ,g' $basedir/src/ffi/generated.rs
cargo fmt --all
170 changes: 0 additions & 170 deletions src/ffi.rs

This file was deleted.

174 changes: 174 additions & 0 deletions src/ffi/generated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/* automatically generated by rust-bindgen 0.55.1 */

#![allow(non_camel_case_types)]
pub(crate) const ARCHIVE_EOF: i32 = 1;
pub(crate) const ARCHIVE_OK: i32 = 0;

pub(crate) const ARCHIVE_EXTRACT_OWNER: u32 = 1;
pub(crate) const ARCHIVE_EXTRACT_PERM: u32 = 2;
pub(crate) const ARCHIVE_EXTRACT_TIME: u32 = 4;
pub(crate) const ARCHIVE_EXTRACT_ACL: u32 = 32;
pub(crate) const ARCHIVE_EXTRACT_FFLAGS: u32 = 64;
pub(crate) const ARCHIVE_EXTRACT_XATTR: u32 = 128;
pub(crate) type __int64_t = ::std::os::raw::c_long;
pub(crate) type __ssize_t = ::std::os::raw::c_long;
pub(crate) type la_int64_t = i64;
pub(crate) type la_ssize_t = isize;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub(crate) struct archive {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub(crate) struct archive_entry {
_unused: [u8; 0],
}
pub(crate) type archive_read_callback = ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut archive,
_client_data: *mut ::std::os::raw::c_void,
_buffer: *mut *const ::std::os::raw::c_void,
) -> la_ssize_t,
>;
pub(crate) type archive_seek_callback = ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut archive,
_client_data: *mut ::std::os::raw::c_void,
offset: la_int64_t,
whence: ::std::os::raw::c_int,
) -> la_int64_t,
>;
pub(crate) type archive_open_callback = ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut archive,
_client_data: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int,
>;
pub(crate) type archive_close_callback = ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut archive,
_client_data: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int,
>;
extern "C" {
pub(crate) fn archive_read_new() -> *mut archive;
}
extern "C" {
pub(crate) fn archive_read_support_filter_all(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_support_format_all(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_support_format_raw(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_set_seek_callback(
arg1: *mut archive,
arg2: archive_seek_callback,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_open(
arg1: *mut archive,
_client_data: *mut ::std::os::raw::c_void,
arg2: archive_open_callback,
arg3: archive_read_callback,
arg4: archive_close_callback,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_next_header(
arg1: *mut archive,
arg2: *mut *mut archive_entry,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_data_block(
a: *mut archive,
buff: *mut *const ::std::os::raw::c_void,
size: *mut usize,
offset: *mut la_int64_t,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_close(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_read_free(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_header(
arg1: *mut archive,
arg2: *mut archive_entry,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_data_block(
arg1: *mut archive,
arg2: *const ::std::os::raw::c_void,
arg3: usize,
arg4: la_int64_t,
) -> la_ssize_t;
}
extern "C" {
pub(crate) fn archive_write_finish_entry(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_close(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_free(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_disk_new() -> *mut archive;
}
extern "C" {
pub(crate) fn archive_write_disk_set_options(
arg1: *mut archive,
flags: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_write_disk_set_standard_lookup(
arg1: *mut archive,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_errno(arg1: *mut archive) -> ::std::os::raw::c_int;
}
extern "C" {
pub(crate) fn archive_error_string(arg1: *mut archive) -> *const ::std::os::raw::c_char;
}
extern "C" {
pub(crate) fn archive_set_error(
arg1: *mut archive,
_err: ::std::os::raw::c_int,
fmt: *const ::std::os::raw::c_char,
...
);
}
extern "C" {
pub(crate) fn archive_entry_free(arg1: *mut archive_entry);
}
extern "C" {
pub(crate) fn archive_entry_hardlink(arg1: *mut archive_entry)
-> *const ::std::os::raw::c_char;
}
extern "C" {
pub(crate) fn archive_entry_pathname(arg1: *mut archive_entry)
-> *const ::std::os::raw::c_char;
}
extern "C" {
pub(crate) fn archive_entry_set_hardlink(
arg1: *mut archive_entry,
arg2: *const ::std::os::raw::c_char,
);
}
extern "C" {
pub(crate) fn archive_entry_set_pathname(
arg1: *mut archive_entry,
arg2: *const ::std::os::raw::c_char,
);
}
Loading