From e1191b3adb22e0b406db87691b13ddab2c236267 Mon Sep 17 00:00:00 2001 From: Collin Fijalkovich Date: Tue, 18 Feb 2020 10:57:32 -0800 Subject: Open temporary cookie file as writable in sync.py Named Temporary file defaults to mode 'w+b' which causes repo sync to fail. By opening the tmpcookiefile in PersistentTransport.request as writable, we are able to run sync successfully. Bug: https://crbug.com/gerrit/12370 Test: Ran smartsync successfully Change-Id: I01ddf915fc30eb3ff0e4d440a6f1aa261c63e88d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255692 Tested-by: Jonathan Nieder Reviewed-by: Jonathan Nieder --- subcmds/sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index cb285290..849e878c 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -1202,7 +1202,7 @@ class PersistentTransport(xmlrpc.client.Transport): # Since we're only using them for HTTP, copy the file temporarily, # stripping those prefixes away. if cookiefile: - tmpcookiefile = tempfile.NamedTemporaryFile() + tmpcookiefile = tempfile.NamedTemporaryFile(mode='w') tmpcookiefile.write("# HTTP Cookie File") try: with open(cookiefile) as f: -- cgit v1.2.3-54-g00ecf