char symlink_mode;
struct filesystem *current_filesystem;
struct filesystem *filesystem_table;
+ int initial_filesystem_id;
int current_filesystem_id;
int max_filesystem_id;
int allocated_filesytem;
a->lookup_uname = trivial_lookup_uname;
a->lookup_gname = trivial_lookup_gname;
a->enable_copyfile = 1;
- a->traversal_mount_points = 1;
+ a->traverse_mount_points = 1;
a->entry_wd_fd = -1;
return (&a->archive);
}
else
a->enable_copyfile = 0;
if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
- a->traversal_mount_points = 0;
+ a->traverse_mount_points = 0;
else
- a->traversal_mount_points = 1;
+ a->traverse_mount_points = 1;
return (r);
}
tree_enter_initial_dir(t);
return (ARCHIVE_FATAL);
}
+ if (t->initial_filesystem_id == -1)
+ t->initial_filesystem_id = t->current_filesystem_id;
+ if (!a->traverse_mount_points) {
+ if (t->initial_filesystem_id != t->current_filesystem_id) {
+ archive_entry_clear(entry);
+ goto next_entry;
+ }
+ }
t->descend = descend;
/*
t->entry_fd = -1;
t->entry_eof = 0;
t->entry_remaining_bytes = 0;
+ t->initial_filesystem_id = -1;
/* First item is set up a lot like a symlink traversal. */
tree_push(t, path, 0, 0, 0, NULL);
int honor_nodump;
/* Set 1 if users request to enable mac copyfile. */
int enable_copyfile;
- /* Set 1 if users request to traversal mount points. */
- int traversal_mount_points;
+ /* Set 1 if users request to traverse mount points. */
+ int traverse_mount_points;
int entry_wd_fd;
char symlink_mode;
struct filesystem *current_filesystem;
struct filesystem *filesystem_table;
+ int initial_filesystem_id;
int current_filesystem_id;
int max_filesystem_id;
int allocated_filesytem;
a->lookup_uname = trivial_lookup_uname;
a->lookup_gname = trivial_lookup_gname;
a->enable_copyfile = 1;
- a->traversal_mount_points = 1;
+ a->traverse_mount_points = 1;
a->entry_wd_fd = -1;
return (&a->archive);
}
else
a->enable_copyfile = 0;
if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
- a->traversal_mount_points = 0;
+ a->traverse_mount_points = 0;
else
- a->traversal_mount_points = 1;
+ a->traverse_mount_points = 1;
return (r);
}
a->archive.state = ARCHIVE_STATE_FATAL;
return (ARCHIVE_FATAL);
}
+ if (t->initial_filesystem_id == -1)
+ t->initial_filesystem_id = t->current_filesystem_id;
+ if (!a->traverse_mount_points) {
+ if (t->initial_filesystem_id != t->current_filesystem_id) {
+ archive_entry_clear(entry);
+ goto next_entry;
+ }
+ }
t->descend = descend;
tree_archive_entry_copy_bhfi(entry, t, st);
t->entry_fh = INVALID_HANDLE_VALUE;
t->entry_eof = 0;
t->entry_remaining_bytes = 0;
+ t->initial_filesystem_id = -1;
/* Get wchar_t strings from char strings. */
archive_string_init(&ws);
option_o = 1; /* Record it and resolve it later. */
break;
case OPTION_ONE_FILE_SYSTEM: /* GNU tar */
- bsdtar->option_dont_traverse_mounts = 1;
+ bsdtar->readdisk_flags |=
+ ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS;
break;
case OPTION_OPTIONS:
bsdtar->option_options = bsdtar->argument;
"Must specify one of -c, -r, -t, -u, -x");
/* Check boolean options only permitted in certain modes. */
- if (bsdtar->option_dont_traverse_mounts)
+ if (bsdtar->readdisk_flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
only_mode(bsdtar, "--one-file-system", "cru");
if (bsdtar->option_fast_read)
only_mode(bsdtar, "--fast-read", "xt");
const char *compress_program;
char option_absolute_paths; /* -P */
char option_chroot; /* --chroot */
- char option_dont_traverse_mounts; /* --one-file-system */
char option_fast_read; /* --fast-read */
const char *option_options; /* --options */
char option_interactive; /* -w */
return;
if (!archive_read_disk_can_descend(a))
return;
- if (bsdtar->option_dont_traverse_mounts) {
- if (bsdtar->first_fs == -1)
- bsdtar->first_fs =
- archive_read_disk_current_filesystem(a);
- else if (bsdtar->first_fs !=
- archive_read_disk_current_filesystem(a))
- return;
- }
if (bsdtar->option_interactive &&
!yes("add '%s'", archive_entry_pathname(entry)))
return;
{
struct bsdtar *bsdtar = (struct bsdtar *)_data;
- if (bsdtar->option_dont_traverse_mounts) {
- if (bsdtar->first_fs == -1)
- bsdtar->first_fs =
- archive_read_disk_current_filesystem(a);
- else if (bsdtar->first_fs !=
- archive_read_disk_current_filesystem(a))
- return (0);
- /* XXX TODO: check whether this filesystem is
- * synthetic and/or local. Add a new
- * --local-only option to skip non-local
- * filesystems. Skip synthetic filesystems
- * regardless.
- *
- * The results should be cached, since
- * tree.c doesn't usually visit a directory
- * and the directory contents together. A simple
- * move-to-front list should perform quite well.
- *
- * Use archive_read_disk_current_filesystem_is_remote().
- */
- }
+ /* XXX TODO: check whether this filesystem is
+ * synthetic and/or local. Add a new
+ * --local-only option to skip non-local
+ * filesystems. Skip synthetic filesystems
+ * regardless.
+ *
+ * The results should be cached, since
+ * tree.c doesn't usually visit a directory
+ * and the directory contents together. A simple
+ * move-to-front list should perform quite well.
+ *
+ * Use archive_read_disk_current_filesystem_is_remote().
+ */
/*
* If the user vetoes this file/directory, skip it.