Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

bisync: fix integration tests passing raw control characters as names

nielash60f97ef6337d
diff --git a/cmd/bisync/bisync_test.go b/cmd/bisync/bisync_test.go
index f41fdc58d..12aebe46d 100644
--- a/cmd/bisync/bisync_test.go
+++ b/cmd/bisync/bisync_test.go
@@ -979,6 +979,10 @@ func splitLine(line string) (args []string) {
b := []byte(whitespaceReplacer.Replace(s))
b = regexChar.ReplaceAllFunc(b, func(b []byte) []byte {
c, _ := strconv.ParseUint(string(b[5:7]), 16, 8)
+ if c <= 0x1f || c == 0x7f {
+ // control characters are spelled with their glyph in rclone names
+ return []byte(encoder.Standard.Encode(string(rune(c))))
+ }
return []byte{byte(c)}
})
args = append(args, string(b))
@@ -988,8 +992,8 @@ func splitLine(line string) (args []string) {
var whitespaceReplacer = strings.NewReplacer(
"{spc}", " ",
- "{tab}", "\t",
- "{eol}", eol,
+ "{tab}", "␉",
+ "{eol}", "␊",
)
var regexChar = regexp.MustCompile(`\{chr:([0-9a-f]{2})\}`)
diff --git a/cmd/bisync/testdata/test_extended_filenames/scenario.txt b/cmd/bisync/testdata/test_extended_filenames/scenario.txt
index c2c948114..b9e0eadd7 100644
--- a/cmd/bisync/testdata/test_extended_filenames/scenario.txt
+++ b/cmd/bisync/testdata/test_extended_filenames/scenario.txt
@@ -3,8 +3,9 @@ test extended-filenames
# that contain UTF-8 code points or whitespace.
#
# Notes:
-# - All rclone backends including local return "\n" aka {eol} in file names
-# as a pseudographic unicode glyph, thus we don't see `\n` in golden logs.
+# - Names are rclone names, so a control character such as "\n" aka {eol}
+# is spelled with its glyph (␊) in listings and golden logs. The local
+# backend decodes it to a real newline on disk.
# - File names with "\t" aka {tab} pass with local, dropbox, and drive
# backends, but fail with FTP. As a workaround, the test currently uses
# `name{spc}with{eol}white{spc}space` instead of