From 57c4462ff6ef9dc70ecf11c5912c0882a445f126 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 12:50:37 -0700 Subject: [PATCH 01/10] Use correct slash (fwd slash) for server side paths. Fix path separator bug. The command line converts path into local filesystem paths, then uses that to build server-side paths. This fixes the slashes to the format used on the server, even if the client uses a different format .(E.g. Windows uses a backslash.) --- cmd/drive/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/drive/main.go b/cmd/drive/main.go index c2bda6da..0d1f7ef5 100644 --- a/cmd/drive/main.go +++ b/cmd/drive/main.go @@ -2057,6 +2057,10 @@ func relativePathsOpt(root string, args []string, leastNonExistant bool) ([]stri relPath = "" } + // This function appears to be meant to return server-side (/-separated) paths. + // But its input is client side (maybe / or \) separted paths. + // filepath.ToSlash fixes that. + relPath = filepath.ToSlash(relPath) relPath = "/" + relPath relPaths = append(relPaths, relPath) } From 4f8b2e09d89197a665aab65d0538e7959cf23676 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 12:52:46 -0700 Subject: [PATCH 02/10] Update Readme to remove known issues Removed two known issues: Doesn't work on Windows. But it does, though there may be some bugs. It does handle files which have the same name on the server. In a crude if functional fashion (errors out, or renames server-side). --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d27e06f7..0756c117 100644 --- a/README.md +++ b/README.md @@ -1420,8 +1420,6 @@ Background sync is not just hard, it is stupid. Here are my technical and philos ## Known Issues -* It probably doesn't work on Windows. -* Google Drive allows a directory to contain files/directories with the same name. Client doesn't handle these cases yet. We don't recommend you to use `drive` if you have such files/directories to avoid data loss. * Racing conditions occur if remote is being modified while we're trying to update the file. Google Drive provides resource versioning with ETags, use Etags to avoid racy cases. * drive rejects reading from namedPipes because they could infinitely hang. See [issue #208](https://github.com/odeke-em/drive/issues/208). From 9bdc979a196c4a5bd4a346898493994d5cd41f10 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 13:02:39 -0700 Subject: [PATCH 03/10] Prompt for Y/N should indicate default. Various yes/no promptes use Y/N but don't specify that the default is Y (yes). Change them to indicate that in the customary manner for command line programs, also used elsewhere in this program. --- config/config.go | 2 +- src/clashes.go | 2 +- src/trash.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 8a150445..8a0ac8e4 100644 --- a/config/config.go +++ b/config/config.go @@ -299,7 +299,7 @@ func (c *Context) DeInitialize(prompter func(...interface{}) bool, returnOnAnyEr } for _, p := range pathsToRemove { - if !prompter("remove: ", p, ". This operation is permanent (Y/N) ") { + if !prompter("remove: ", p, ". This operation is permanent (Y/n) ") { continue } diff --git a/src/clashes.go b/src/clashes.go index 57c3bec7..70cdce8c 100644 --- a/src/clashes.go +++ b/src/clashes.go @@ -274,7 +274,7 @@ func autoRenameClashes(g *Commands, clashes []*Change) error { for _, r := range renames { g.log.Logf("%v %v -> %v\n", r.originalPath, r.change.Src.Id, r.newName) } - status := promptForChanges("Proceed with the changes [Y/N] ? ") + status := promptForChanges("Proceed with the changes [Y/n] ? ") if !accepted(status) { return ErrClashFixingAborted } diff --git a/src/trash.go b/src/trash.go index 1883840f..b3b63750 100644 --- a/src/trash.go +++ b/src/trash.go @@ -234,7 +234,7 @@ func (g *Commands) reduceForTrash(args []string, opt *trashOpt) error { } if opt.permanent && g.opts.canPrompt() { - status := promptForChanges("This operation is irreversible. Continue [Y/N] ") + status := promptForChanges("This operation is irreversible. Continue [Y/n] ") if !accepted(status) { return status.Error() } From 68b5899ef20e395cdf6e136afd61be53353ce929 Mon Sep 17 00:00:00 2001 From: Devin Alvaro Date: Sun, 2 Jul 2017 17:48:05 +0700 Subject: [PATCH 04/10] Add a space in "Proceed with the changes ..." prompt --- src/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.go b/src/misc.go index 7316c410..5ccdffe6 100644 --- a/src/misc.go +++ b/src/misc.go @@ -321,7 +321,7 @@ func nextPage() bool { func promptForChanges(args ...interface{}) Agreement { argv := []interface{}{ - "Proceed with the changes? [Y/n]:", + "Proceed with the changes? [Y/n]: ", } if len(args) >= 1 { argv = args From e00b5140fd03107fd42bab7ac2559158c31e5011 Mon Sep 17 00:00:00 2001 From: Igor Vuk Date: Sat, 15 Jul 2017 12:26:57 +0200 Subject: [PATCH 05/10] Fix typos in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d27e06f7..aa19be20 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ Optionally set the `GOOGLE_API_CLIENT_ID` and `GOOGLE_API_CLIENT_SECRET` environ ### Hyphens: - vs -- -A single hypen `-` can be used to specify options. However two hypens `--` can be used with any options in the provided examples below. +A single hyphen `-` can be used to specify options. However two hyphens `--` can be used with any options in the provided examples below. ### Initializing @@ -198,7 +198,7 @@ The opposite of `drive init`, it will remove your credentials locally as well as drive deinit [-no-prompt] ``` -For a complete deinit-ialization, don't forget to revoke account access, [please see revoking account access](#revoking-account-access) +For a complete deinitialization, don't forget to revoke account access, [please see revoking account access](#revoking-account-access) ### Traversal Depth From 08ef171674e04babd8da74e52aa9fa9aebefbf1f Mon Sep 17 00:00:00 2001 From: Emmanuel Odeke Date: Sun, 23 Jul 2017 23:50:05 -0600 Subject: [PATCH 06/10] changes: properly send back nil if no file is found Ensure that nil is properly sent back after remote change/file resolution. This regression was caused by forgetting to send back that nil. This regression was caused by PR https://github.com/odeke-em/drive/pull/741. The consequence of the bug was that trying to push from non-existent folders would erraneously give back ```shell Resolving... Everything is up-to-date. ``` since the remotesChan channel would get closed after resolution without sending notifying whoever was resolving that the file or parent didn't exist remotely. Fixes #933 --- src/remote.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/remote.go b/src/remote.go index b39bd945..eebfa02c 100644 --- a/src/remote.go +++ b/src/remote.go @@ -1096,8 +1096,14 @@ func (r *Remote) findByPathRecvRawM(parentId string, p []string, trashed bool) * working = false break } + if f != nil { chanOChan <- r.findByPathRecvRawM(f.Id, rest, trashed) + } else { + // Ensure that we properly send + // back nil even if files were not found. + // See https://github.com/odeke-em/drive/issues/933. + chanOChan <- wrapInPaginationPair(nil, nil) } } } From 8bfdde0a6d569a57388163a2a8e559760d3233dc Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 12:50:37 -0700 Subject: [PATCH 07/10] Use correct slash (fwd slash) for server side paths. Fix path separator bug. The command line converts path into local filesystem paths, then uses that to build server-side paths. This fixes the slashes to the format used on the server, even if the client uses a different format .(E.g. Windows uses a backslash.) --- cmd/drive/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/drive/main.go b/cmd/drive/main.go index c2bda6da..0d1f7ef5 100644 --- a/cmd/drive/main.go +++ b/cmd/drive/main.go @@ -2057,6 +2057,10 @@ func relativePathsOpt(root string, args []string, leastNonExistant bool) ([]stri relPath = "" } + // This function appears to be meant to return server-side (/-separated) paths. + // But its input is client side (maybe / or \) separted paths. + // filepath.ToSlash fixes that. + relPath = filepath.ToSlash(relPath) relPath = "/" + relPath relPaths = append(relPaths, relPath) } From aad796bae9a4e90c37bd70e823ca0ea82a765f32 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 12:52:46 -0700 Subject: [PATCH 08/10] Update Readme to remove known issues Removed two known issues: Doesn't work on Windows. But it does, though there may be some bugs. It does handle files which have the same name on the server. In a crude if functional fashion (errors out, or renames server-side). --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index aa19be20..1ac2d5e7 100644 --- a/README.md +++ b/README.md @@ -1420,8 +1420,6 @@ Background sync is not just hard, it is stupid. Here are my technical and philos ## Known Issues -* It probably doesn't work on Windows. -* Google Drive allows a directory to contain files/directories with the same name. Client doesn't handle these cases yet. We don't recommend you to use `drive` if you have such files/directories to avoid data loss. * Racing conditions occur if remote is being modified while we're trying to update the file. Google Drive provides resource versioning with ETags, use Etags to avoid racy cases. * drive rejects reading from namedPipes because they could infinitely hang. See [issue #208](https://github.com/odeke-em/drive/issues/208). From 0c0b65779267e3226d8ad17d40366a40b86c91a4 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sun, 4 Jun 2017 13:02:39 -0700 Subject: [PATCH 09/10] Prompt for Y/N should indicate default. Various yes/no promptes use Y/N but don't specify that the default is Y (yes). Change them to indicate that in the customary manner for command line programs, also used elsewhere in this program. --- config/config.go | 2 +- src/clashes.go | 2 +- src/trash.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 8a150445..8a0ac8e4 100644 --- a/config/config.go +++ b/config/config.go @@ -299,7 +299,7 @@ func (c *Context) DeInitialize(prompter func(...interface{}) bool, returnOnAnyEr } for _, p := range pathsToRemove { - if !prompter("remove: ", p, ". This operation is permanent (Y/N) ") { + if !prompter("remove: ", p, ". This operation is permanent (Y/n) ") { continue } diff --git a/src/clashes.go b/src/clashes.go index 57c3bec7..70cdce8c 100644 --- a/src/clashes.go +++ b/src/clashes.go @@ -274,7 +274,7 @@ func autoRenameClashes(g *Commands, clashes []*Change) error { for _, r := range renames { g.log.Logf("%v %v -> %v\n", r.originalPath, r.change.Src.Id, r.newName) } - status := promptForChanges("Proceed with the changes [Y/N] ? ") + status := promptForChanges("Proceed with the changes [Y/n] ? ") if !accepted(status) { return ErrClashFixingAborted } diff --git a/src/trash.go b/src/trash.go index 1883840f..b3b63750 100644 --- a/src/trash.go +++ b/src/trash.go @@ -234,7 +234,7 @@ func (g *Commands) reduceForTrash(args []string, opt *trashOpt) error { } if opt.permanent && g.opts.canPrompt() { - status := promptForChanges("This operation is irreversible. Continue [Y/N] ") + status := promptForChanges("This operation is irreversible. Continue [Y/n] ") if !accepted(status) { return status.Error() } From 677b4847732364efd5b589dbb5988aff002e9863 Mon Sep 17 00:00:00 2001 From: matthewblain Date: Sat, 30 Sep 2017 14:07:25 -0700 Subject: [PATCH 10/10] Update readme Update readme to be more accurate. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ac2d5e7..2d65fa6c 100644 --- a/README.md +++ b/README.md @@ -1420,8 +1420,10 @@ Background sync is not just hard, it is stupid. Here are my technical and philos ## Known Issues -* Racing conditions occur if remote is being modified while we're trying to update the file. Google Drive provides resource versioning with ETags, use Etags to avoid racy cases. +* Race conditions occur if remote is being modified while we're trying to update the file. Google Drive provides resource versioning with ETags, use Etags to avoid racy cases. * drive rejects reading from namedPipes because they could infinitely hang. See [issue #208](https://github.com/odeke-em/drive/issues/208). +* It is unsupported on Windows. Some functionality works but it has not been thoroughly tested. +* Google Drive allows a directory to contain files/directories with the same name. Client doesn't handle these cases gracefully but can offer to 'fix clashes'. See #detecting-and-fixing-clashes . We don't recommend you to use `drive` if you have such files/directories to avoid data loss. ## Reaching Out