importd: change untar logic to be based on libarchive rather than shelling out to gnu tar (#39143)
Let's use libarchive consistently everywhere, both for tarring and untarring. Note that there's an existing test case that validates untarring. Now, it will validate libarchive rather than gnu tar. Split out of #38728
This commit is contained in:
@@ -108,6 +108,10 @@ int stat_verify_symlink(const struct stat *st) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fd_verify_symlink(int fd) {
|
||||
return verify_stat_at(fd, /* path= */ NULL, /* follow= */ false, stat_verify_symlink, /* verify= */ true);
|
||||
}
|
||||
|
||||
int is_symlink(const char *path) {
|
||||
assert(!isempty(path));
|
||||
return verify_stat_at(AT_FDCWD, path, false, stat_verify_symlink, false);
|
||||
|
||||
@@ -16,6 +16,7 @@ int is_dir_at(int fd, const char *path, bool follow);
|
||||
int is_dir(const char *path, bool follow);
|
||||
|
||||
int stat_verify_symlink(const struct stat *st);
|
||||
int fd_verify_symlink(int fd);
|
||||
int is_symlink(const char *path);
|
||||
|
||||
int stat_verify_linked(const struct stat *st);
|
||||
@@ -110,3 +111,10 @@ static inline bool stat_is_set(const struct stat *st) {
|
||||
static inline bool statx_is_set(const struct statx *sx) {
|
||||
return sx && sx->stx_mask != 0;
|
||||
}
|
||||
|
||||
static inline bool inode_type_can_hardlink(mode_t m) {
|
||||
/* returns true for all inode types that support hardlinks on linux. Note this is effectively all
|
||||
* inode types except for directories (and those weird misc fds such as eventfds() that have no inode
|
||||
* type). */
|
||||
return IN_SET(m & S_IFMT, S_IFSOCK, S_IFLNK, S_IFREG, S_IFBLK, S_IFCHR, S_IFIFO);
|
||||
}
|
||||
|
||||
@@ -477,3 +477,14 @@ int fd_setcrtime(int fd, usec_t usec) {
|
||||
"user.crtime_usec", (const char*) &le, sizeof(le),
|
||||
/* xattr_flags = */ 0);
|
||||
}
|
||||
|
||||
bool xattr_is_acl(const char *name) {
|
||||
return STR_IN_SET(
|
||||
ASSERT_PTR(name),
|
||||
"system.posix_acl_access",
|
||||
"system.posix_acl_default");
|
||||
}
|
||||
|
||||
bool xattr_is_selinux(const char *name) {
|
||||
return streq(ASSERT_PTR(name), "security.selinux");
|
||||
}
|
||||
|
||||
@@ -54,3 +54,6 @@ int getcrtime_at(int fd, const char *path, int at_flags, usec_t *ret);
|
||||
static inline int fd_getcrtime(int fd, usec_t *ret) {
|
||||
return getcrtime_at(fd, NULL, 0, ret);
|
||||
}
|
||||
|
||||
bool xattr_is_acl(const char *name);
|
||||
bool xattr_is_selinux(const char *name);
|
||||
|
||||
Reference in New Issue
Block a user