Skip to content

Commit

Permalink
fix(core): error with rsync v3.2.3 and later on certain OSes
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald authored and eysi09 committed Aug 11, 2020
1 parent d23ddbc commit 3cb4da6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion garden-service/src/build-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Profile } from "./util/profiling"
import { syncWithOptions } from "./util/sync"

const minRsyncVersion = "3.1.0"
const versionRegex = /rsync version ([\d\.]+) /
const versionRegex = /rsync version [v]*([\d\.]+) /

// FIXME: We don't want to keep special casing this module type so we need to think
// of a better way around this.
Expand Down
14 changes: 14 additions & 0 deletions garden-service/test/data/dummy-rsync/min-version/rsync
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

echo "rsync version 3.1.0 protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
"
3 changes: 2 additions & 1 deletion garden-service/test/data/dummy-rsync/new-version/rsync
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

echo "rsync version 3.1.3 protocol version 31
# Note: version 3.2.3 adds a "v" prefix on the version string
echo "rsync version v3.2.3 protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
Expand Down
22 changes: 22 additions & 0 deletions garden-service/test/unit/src/build-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,28 @@ describe("BuildDir", () => {
}
})

it("should work with rsync v3.1.0", async () => {
const orgPath = process.env.PATH

try {
process.env.PATH = getDataDir("dummy-rsync", "min-version")
await BuildDir.factory(garden.projectRoot, garden.gardenDirPath)
} finally {
process.env.PATH = orgPath
}
})

it("should work with rsync v3.2.3", async () => {
const orgPath = process.env.PATH

try {
process.env.PATH = getDataDir("dummy-rsync", "new-version")
await BuildDir.factory(garden.projectRoot, garden.gardenDirPath)
} finally {
process.env.PATH = orgPath
}
})

it("should throw if rsync is too old", async () => {
const orgPath = process.env.PATH

Expand Down

0 comments on commit 3cb4da6

Please sign in to comment.