From b8a1fd6404054c8cea348e445d666050520e899b Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 9 Nov 2008 21:37:04 -0800 Subject: [PATCH] Fixed the use of a dot-dir path (foo/./bar) inside of a files-from file. --- flist.c | 6 +++--- testsuite/files-from.test | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 testsuite/files-from.test diff --git a/flist.c b/flist.c index 35efc8b1..6d39196d 100644 --- a/flist.c +++ b/flist.c @@ -1962,9 +1962,6 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) start_write = stats.total_written; gettimeofday(&start_tv, NULL); - if (!orig_dir) - orig_dir = strdup(curr_dir); - if (relative_paths && protocol_version >= 30) implied_dirs = 1; /* We send flagged implied dirs */ @@ -1990,6 +1987,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) use_ff_fd = 1; } + if (!orig_dir) + orig_dir = strdup(curr_dir); + while (1) { char fbuf[MAXPATHLEN], *fn, name_type; diff --git a/testsuite/files-from.test b/testsuite/files-from.test new file mode 100644 index 00000000..ea202025 --- /dev/null +++ b/testsuite/files-from.test @@ -0,0 +1,30 @@ +#!/bin/sh + +# Copyright (C) 2008 by Wayne Davison + +# This program is distributable under the terms of the GNU GPL (see +# COPYING). + +# Test that --files-from=FILE works right. + +. "$suitedir/rsync.fns" + +hands_setup + +# This list of files skips the contents of "subsubdir" but includes +# the contents of "subsubdir2" due to its trailing slash. +cat >"$scratchdir/filelist" <