Rev 6588: (vila) Make .netrc 0600 in tests so python-2.7.5-8's netrc is happy. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 4 09:37:29 UTC 2013


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6588 [merge]
revision-id: pqm at pqm.ubuntu.com-20131004093729-to7tbu9w6ws03wge
parent: pqm at pqm.ubuntu.com-20130810150930-5heu5saz1ovys4wo
parent: v.ladeuil+lp at free.fr-20131001163620-veufq3ugmczyrcef
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2013-10-04 09:37:29 +0000
message:
  (vila) Make .netrc 0600 in tests so python-2.7.5-8's netrc is happy.
   (Vincent Ladeuil)
modified:
  bzrlib/plugins/netrc_credential_store/tests/test_netrc.py test_netrc.py-20081006090414-vm3or4tz6c9wk2oi-1
  doc/en/release-notes/bzr-2.7.txt bzr2.7.txt-20130727124539-wnx897hy9l2h9f7x-1
=== modified file 'bzrlib/plugins/netrc_credential_store/tests/test_netrc.py'
--- a/bzrlib/plugins/netrc_credential_store/tests/test_netrc.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/plugins/netrc_credential_store/tests/test_netrc.py	2013-10-01 16:36:20 +0000
@@ -43,11 +43,12 @@
 machine host login joe password secret
 default login anonymous password joe at home
 """
-        f = open(osutils.pathjoin(self.test_home_dir, '.netrc'), 'wb')
-        try:
+        netrc_path = osutils.pathjoin(self.test_home_dir, '.netrc')
+        with open(netrc_path, 'wb') as f:
             f.write(netrc_content)
-        finally:
-            f.close()
+        # python's netrc will complain about access permissions starting with
+        # 2.7.5-8 so we restrict the access unconditionally
+        osutils.chmod_if_possible(netrc_path, 0600)
 
     def _get_netrc_cs(self):
         return  config.credential_store_registry.get_credential_store('netrc')

=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- a/doc/en/release-notes/bzr-2.7.txt	2013-07-27 12:53:28 +0000
+++ b/doc/en/release-notes/bzr-2.7.txt	2013-10-01 13:13:46 +0000
@@ -56,6 +56,8 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* Restrict access to '.netrc' in tests or recent python (2.7.5-8) will
+  complain. (Vincent Ladeuil, #1233413)
 
 ..
    vim: tw=74 ft=rst ff=unix




More information about the bazaar-commits mailing list