Skip to content

Commit 80863f0

Browse files
committed
remote-run: Find rsync on path
The current remote-run implementation only works if rsync is located at `/usr/bin/`, which isn't always the case. FreeBSD installs rsync to `/usr/local/bin` as it is not installed in the base system by default. Relax the script to accept rsync on any path.
1 parent 705b1a6 commit 80863f0

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

test/remote-run/custom-options.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CHECK-SAME: 'cp'
2020

2121
CHECK-NEXT: {{^}}/bin/mkdir -p {{.+}}
2222

23-
CHECK-NEXT: /usr/bin/rsync
23+
CHECK-NEXT: rsync
2424
CHECK-DAG: '-p' '12345'
2525
CHECK-DAG: '-o' 'FIRST_OPT' '-o' 'SECOND_OPT'
2626
CHECK-SAME: some_user@some_host

test/remote-run/dry-run.test-sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN: test -z "`ls %t`"
66
RUN: test ! -e %t-REMOTE
77

88
CHECK-INPUT: /usr/bin/env /bin/mkdir -p {{.+}}-REMOTE/input
9-
CHECK-INPUT-NEXT: /usr/bin/rsync
9+
CHECK-INPUT-NEXT: rsync
1010
CHECK-INPUT: /usr/bin/env {{.*}}ls
1111

1212
RUN: %empty-directory(%t)
@@ -16,8 +16,8 @@ RUN: %debug-remote-run -n --output-prefix %t cp %t/nested/input %t/nested/output
1616
RUN: test ! -e %t-REMOTE
1717

1818
CHECK-OUTPUT: /usr/bin/env /bin/mkdir -p {{.+}}-REMOTE/output/nested
19-
CHECK-OUTPUT: /usr/bin/rsync
19+
CHECK-OUTPUT: rsync
2020
CHECK-OUTPUT: /usr/bin/env {{.*}}cp
2121
CHECK-OUTPUT-NEXT: {{^}}/bin/mkdir -p {{.+}}
22-
CHECK-OUTPUT-NEXT: /usr/bin/rsync
22+
CHECK-OUTPUT-NEXT: rsync
2323

test/remote-run/identity.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CHECK-SAME: some_user@some_host -- '/usr/bin/env' {{.*}}'cp'
1717

1818
CHECK-NEXT: {{^}}/bin/mkdir -p {{.+}}
1919

20-
CHECK-NEXT: /usr/bin/rsync
20+
CHECK-NEXT: rsync
2121
CHECK-DAG: '-p' '12345'
2222
CHECK-DAG: '-i' 'spiderman'
2323
CHECK-SAME: some_user@some_host

test/remote-run/port.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ RUN: %remote-run -n --remote-dir /xyz-REMOTE --output-prefix %/t some_user@some_
33
CHECK: /usr/bin/ssh -n -p 12345 some_user@some_host -- '/usr/bin/env' '/bin/mkdir' '-p' '{{.+}}-REMOTE/output/nested'
44
CHECK: /usr/bin/ssh -n -p 12345 some_user@some_host -- '/usr/bin/env' {{.*}}'cp'
55
CHECK-NEXT: {{^}}/bin/mkdir -p {{.+}}
6-
CHECK-NEXT: /usr/bin/rsync
6+
CHECK-NEXT: rsync
77
CHECK-SAME: '-p' '12345'
88
CHECK-SAME: some_user@some_host

test/remote-run/upload-and-download.test-sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ RUN: ls %t-REMOTE/output/nested/ | %FileCheck -check-prefix CHECK-REMOTE %s
2727
RUN: %debug-remote-run -v --output-prefix %t cp %t/nested/input %t/nested/output 2>&1 >/dev/null | %FileCheck -check-prefix VERBOSE %s
2828

2929
VERBOSE: /usr/bin/env /bin/mkdir -p {{.+}}-REMOTE/output/nested
30-
VERBOSE: /usr/bin/rsync
30+
VERBOSE: rsync
3131
VERBOSE: /usr/bin/env {{.*}}cp
3232
VERBOSE-NEXT: {{^}}/bin/mkdir -p {{.+}}
33-
VERBOSE-NEXT: /usr/bin/rsync
33+
VERBOSE-NEXT: rsync
3434

3535
RUN: %empty-directory(%t)
3636
RUN: touch %t/xyz-1before

test/remote-run/upload.test-sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ CHECK-NEXT: {{^3.txt$}}
3434
CHECK-NOT: BAD
3535

3636
VERBOSE-NESTED: /usr/bin/env /bin/mkdir -p {{.+}}-REMOTE/input
37-
VERBOSE-NESTED-NEXT: /usr/bin/rsync
37+
VERBOSE-NESTED-NEXT: rsync
3838
VERBOSE-NESTED: /usr/bin/env {{.*}}ls

utils/remote-run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class RemoteCommandRunner(CommandRunner):
203203
[quote(arg) for arg in command])
204204

205205
def rsync_invocation(self, source, dest):
206-
return ['/usr/bin/rsync', '-arRz', '--files-from=-',
206+
return ['rsync', '-arRz', '--files-from=-',
207207
'-e', ' '.join([quote(x) for x in
208208
['/usr/bin/ssh'] +
209209
self.common_options(port_flag='-p')]),
@@ -221,7 +221,7 @@ class LocalCommandRunner(CommandRunner):
221221
return command
222222

223223
def rsync_invocation(self, source, dest):
224-
return ['/usr/bin/rsync', '-arz', '--files-from=-', source, dest]
224+
return ['rsync', '-arz', '--files-from=-', source, dest]
225225

226226
def rsync_from_invocation(self, source, dest):
227227
return self.rsync_invocation(source, dest)

0 commit comments

Comments
 (0)