Archive-Tar-Builder
view release on metacpan or search on metacpan
* Add missing POD for posix_extensions flag
* Implement support for saving device inode major and minor numbers
Version 2.0000
* Change to a versioning scheme more friendly to the mysterious
black box known as PAUSE
* Don't fail on EACCES when stat()ing file
Version 1.9
* Fix a bug in b_find() wherein some error recovery code tried to destroy
the same object twice, potentially
Version 1.8
[redacted for secret government purposes]
* Set $! to EINVAL when truncated files are detected
* Fix an issue in b_error_set() wherein the message actually got clobbered
due to a missing 'return' statement
* Retool $builder->archive_as() to display error names for archive members,
rather than their original filenames, in appropriate circumstances
Version 1.6
* Avoid stat() calls on files excluded from archive
Version 1.5
* Correct handling of files between 4 GiB & 8 GiB, inclusive
Version 1.4
* Do not croak() on a warning
Version 1.3
src/b_buffer.c view on Meta::CPAN
char *release, *kernel, *major, *minor;
int kernel_v, major_v, minor_v;
struct utsname unameData;
int uname_ok;
#endif
if (buf == NULL) return;
buf->fd = fd;
buf->can_splice = 0;
#ifdef __linux__
if (fstat(fd, &st) == 0) {
if (S_ISFIFO(st.st_mode)) {
uname_ok = uname(&unameData);
if (uname_ok != -1) {
release = unameData.release;
kernel = strtok(release, ".");
major = strtok(NULL, ".");
minor = strtok(NULL, ".");
if (release && major && minor) {
kernel_v = strtol(kernel,NULL,10);
major_v = strtol(major,NULL,10);
src/b_find.c view on Meta::CPAN
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include "b_builder.h"
#include "b_string.h"
#include "b_stack.h"
#include "b_path.h"
#include "b_find.h"
#include "b_error.h"
static inline int b_stat(b_string *path, struct stat *st, int flags) {
int (*statfn)(const char *, struct stat *) = (flags & B_FIND_FOLLOW_SYMLINKS)? stat: lstat;
return statfn(path->str, st);
}
typedef struct {
DIR * dp;
b_string * path;
} b_dir;
src/b_find.c view on Meta::CPAN
if ((clean_member_name = b_path_clean(member_name)) == NULL) {
goto error_path_clean_member_name;
}
if ((dirs = b_stack_new(0)) == NULL) {
goto error_stack_new;
}
b_stack_set_destructor(dirs, B_STACK_DESTRUCTOR(b_dir_destroy));
if (b_stat(clean_path, &st, flags) < 0) {
goto error_stat;
}
/*
* If the item we're dealing with is not a directory, or is not wanted by
* the callback, then do not bother with traversal code. Otherwise, all
* code after these guard clauses pertains to the case of 'path' being a
* directory.
*/
if ((st.st_mode & S_IFMT) == S_IFREG) {
src/b_find.c view on Meta::CPAN
*/
if (builder->match != NULL && lafe_excluded(builder->match, (const char *)item->path->str)) {
goto cleanup_item;
}
if ((item_fd = open(item->path->str, oflags)) < 0) {
/*
* If O_NOFOLLOW is used (which is default) to open() the current
* item, then check for ELOOP; this condition will occur when
* attempting to open a symlink. This means that we will need to
* simply use lstat() to retrieve information on the symlink inode
* itself.
*
* POSIX specifies ELOOP in this case, but FreeBSD uses EMLINK and
* NetBSD uses EFTYPE. Work around this bugginess.
*/
#ifndef EFTYPE
#define EFTYPE ELOOP
#endif
if ((oflags & O_NOFOLLOW) && (errno == ELOOP || errno == EMLINK || errno == EFTYPE)) {
if (lstat(item->path->str, &item_st) < 0) {
if (err) {
b_error_set(err, B_ERROR_WARN, errno, "Cannot lstat() file", item->path);
}
goto cleanup_item;
}
} else {
if( flags & B_FIND_IGNORE_SOCKETS ) {
if (stat(item->path->str, &item_st) < 0) {
if (err) {
b_error_set(err, B_ERROR_WARN, errno, "Cannot stat() file", item->path);
}
}
else {
if( err && (item_st.st_mode & S_IFMT) != S_IFSOCK ) {
b_error_set(err, B_ERROR_WARN, errno, "Cannot open file", item->path);
}
}
}
else {
if (err) {
b_error_set(err, B_ERROR_WARN, errno, "Cannot open file", item->path);
}
}
goto cleanup_item;
}
} else {
if (fcntl(fd, F_SETFL, oflags & ~O_NONBLOCK)) // previously clear_nonblock, however we know oflags so we can do it outselves
goto cleanup_item;
if (fstat(item_fd, &item_st) < 0) {
if (err) {
b_error_set(err, B_ERROR_WARN, errno, "Cannot fstat() file descriptor", item->path);
}
goto cleanup_item;
}
}
/*
* Attempt to obtain and use a substituted member name based on the
* real path, and use it, if possible.
*/
t/lib-Archive-Tar-Builder.t view on Meta::CPAN
$builder->finish;
exit 0;
}
close $in;
waitpid $writer_pid, 0 or die "Unable to waitpid() on $writer_pid: $!";
waitpid $reader_pid, 0 or die "Unable to waitpid() on $reader_pid: $!";
my @st1 = stat "$dest/foo" or die "Unable to stat() $dest/foo: $!";
my @st2 = stat "$dest/bar" or die "Unable to stat() $dest/bar: $!";
is( $st1[0] => $st2[0], "st_dev of $dest/foo matches $dest/bar" );
is( $st1[1] => $st2[1], "st_ino of $dest/foo matches $dest/bar" );
}
}
#
# Test for fix to CPANEL-29859; segfaulting when archiving certain numbers of
# hardlinked files
#
( run in 1.371 second using v1.01-cache-2.11-cpan-49f99fa48dc )