Ticket #1241: exclude-from-tilde-expansion.darcs.patch

File exclude-from-tilde-expansion.darcs.patch, 12.9 KB (added by davidsarah, at 2010-10-31T04:03:59Z)

tahoe backup: perform tilde expansion in exclude-from filename. fixes #1241

Line 
11 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk:
2
3Sun Oct 31 03:37:54 GMT Standard Time 2010  david-sarah@jacaranda.org
4  * tahoe backup: perform tilde expansion in exclude-from filename. fixes #1241
5
6New patches:
7
8[tahoe backup: perform tilde expansion in exclude-from filename. fixes #1241
9david-sarah@jacaranda.org**20101031033754
10 Ignore-this: dd5d3e37413944a95dcaab49b953c9cc
11] {
12hunk ./src/allmydata/scripts/cli.py 4
13 import os.path, re, sys, fnmatch
14 from twisted.python import usage
15 from allmydata.scripts.common import BaseOptions, get_aliases, get_default_nodedir, DEFAULT_ALIAS
16-from allmydata.util.encodingutil import argv_to_unicode, argv_to_abspath, quote_output
17+from allmydata.util.encodingutil import argv_to_unicode, argv_to_abspath, \
18+    quote_output, abspath_expanduser_unicode
19 
20 NODEURL_RE=re.compile("http(s?)://([^:]*)(:([1-9][0-9]*))?")
21 
22hunk ./src/allmydata/scripts/cli.py 312
23         """Ignore file matching glob patterns listed in file, one per
24         line. The file is assumed to be in the argv encoding."""
25         try:
26-            exclude_file = file(filepath)
27+            exclude_file = file(abspath_expanduser_unicode(argv_to_unicode(filepath)))
28         except:
29             raise BackupConfigurationError('Error opening exclude file %r.' % filepath)
30         try:
31hunk ./src/allmydata/test/test_cli.py 8
32 import urllib, re
33 import simplejson
34 
35+from mock import patch
36+
37 from allmydata.util import fileutil, hashutil, base32
38 from allmydata import uri
39 from allmydata.immutable import upload
40hunk ./src/allmydata/test/test_cli.py 1872
41         self._check_filtering(filtered, root_listdir, (u'lib.a', u'_darcs', u'subdir'),
42                               (nice_doc,))
43 
44+    @patch('__builtin__.file')
45+    def test_exclude_from_tilde_expansion(self, mock):
46+        basedir = "cli/Backup/exclude_from_tilde_expansion"
47+        fileutil.make_dirs(basedir)
48+        nodeurl_path = os.path.join(basedir, 'node.url')
49+        fileutil.write(nodeurl_path, 'http://example.net:2357/')
50+
51+        # ensure that tilde expansion is performed on exclude-from argument
52+        exclude_file = u'~/.tahoe/excludes.dummy'
53+        backup_options = cli.BackupOptions()
54+
55+        mock.return_value = StringIO()
56+        backup_options.parseOptions(['--exclude-from', unicode_to_argv(exclude_file),
57+                                     '--node-directory', basedir, 'from', 'to'])
58+        self.failUnlessIn(((abspath_expanduser_unicode(exclude_file),), {}), mock.call_args_list)
59+
60     def test_ignore_symlinks(self):
61         if not hasattr(os, 'symlink'):
62             raise unittest.SkipTest("Symlinks are not supported by Python on this platform.")
63}
64
65Context:
66
67[NEWS: add news entry for #1223
68Francois Deppierraz <francois@ctrlaltdel.ch>**20101030111130
69 Ignore-this: 6b6afd4b0f0527a3c9784c1db95d083
70]
71[NEWS: add a NEWS entry about bug #1045
72Francois Deppierraz <francois@ctrlaltdel.ch>**20101030101351
73 Ignore-this: 7e758afbbd0f1d22a5d0b4fc38661c1d
74]
75[setup: run require_auto_deps() before attempting to import any deps in __init__.py
76zooko@zooko.com**20101030081035
77 Ignore-this: ffcaf2450628543e020e9919e455f691
78 For one thing, this makes missing-dependency failures into DistributionNotFound errors instead of ImportErrors, which might be more useful to the user. For another thing, if someone is using distributions that were installed with --multi-version, then they might be not importable until after require_auto_deps() has been run. (The docs claim that this would be the case, but we don't have an example of this happening at this time.)
79]
80[setup: show-tool-versions: emit module and __version__ information even when module name != distribution (package) name, and add TwistedCore, TwistedWeb, and TwistedConch
81zooko@zooko.com**20101030070233
82 Ignore-this: 3df19910090d44502ddeeef5d9c29a7
83]
84[misc/build_helpers/test-with-fake-pkg.py: look for eggs in the parent of the src directory. refs #1190
85david-sarah@jacaranda.org**20101030034303
86 Ignore-this: 4a3cf286272cdb5d06aac15fb5998b33
87]
88[scripts/runner.py: fix unused import of allmydata. refs #1190
89david-sarah@jacaranda.org**20101030003149
90 Ignore-this: b2fc67f6192ea7ccf8a5ad010ce74a64
91]
92[scripts/runner.py: remove pkg_resources.require() calls. These are at best redundant because we have already called _auto_deps.require_auto_deps() (from allmydata.__init__) at that point, and they are causing failure of the test-from-prefixdir step on some buildslaves. refs #1190
93david-sarah@jacaranda.org**20101029235328
94 Ignore-this: e00dee63acc7b76a5755025d75abf524
95]
96[misc/build_helpers/run_trial.py: look for zetuptoolz egg in the parent directory, not the cwd of run_trial. refs #1190
97david-sarah@jacaranda.org**20101029230329
98 Ignore-this: 1596fb8c290d1c706f079701b1857db8
99]
100[scripts/tahoe_backup.py: oops, fix missing import, thanks pyflakes
101Brian Warner <warner@lothar.com>**20101029094223
102 Ignore-this: 285c35af824935641a5be35c008b080c
103 
104 test_cli.py: hush minor pyflakes complaint
105]
106[mutable/servermap.py: update comment. Closes #1231.
107Brian Warner <warner@lothar.com>**20101029091424
108 Ignore-this: 80bf854123fc254e097a81b82bdf4990
109]
110[tahoe_cp.py: Don't call urllib.quote with an Unicode argument, fix #1224
111Brian Warner <warner@lothar.com>**20101029084520
112 Ignore-this: 5524722d5e5babbb73ca0969d54967f6
113 tahoe_backup.py: Fix another (potential) occurrence of calling urllib.quote()
114 with an Unicode parameter
115]
116[fix #1223, crash+inefficiency during repair due to read overrun
117Brian Warner <warner@lothar.com>**20101029082036
118 Ignore-this: e6aa0295ad254544da3b5cc41b33d862
119 
120 * repairer (really the uploader) reads beyond end of input file (Uploadable)
121 * new-downloader does not tolerate overreads
122 * uploader does lots of tiny reads (inefficient)
123 
124 This fixes the last two. The uploader still does a single overread at the end
125 of the input file, but now that's ok so we can leave it in place. The
126 uploader now expects the Uploadable to behave like a normal disk
127 file (reading beyond EOF will return less data than was asked for), and now
128 the new-downloadable behaves that way.
129]
130[add misc/build_helpers/test-with-fake-pkg.py. refs #1190
131david-sarah@jacaranda.org**20101029025150
132 Ignore-this: 995f220962708f1bad83092161130f67
133]
134[bundled zetuptoolz: if __main__.__requires__ exists then do not add packages to the working set if they provide an incompatible version of a package. Also put a complete __requires__ listing the transitive closure of dependencies at the beginning of generated scripts, rather than a shallow __requires__ specifying only the application version. refs #1190
135david-sarah@jacaranda.org**20101029223111
136 Ignore-this: a95f1967884340e53bf3adf90db40cfc
137]
138[setup.py, misc/build_helpers/run_trial.py: use undocumented __requires__ variable to cause setuptools/zetuptoolz to put the correct versions of dependencies on sys.path. Also ensure that run_trial adds the bundled zetuptoolz egg at the start of sys.path if present. Make the source directory comparison work correctly for the test-with-fake-pkg build step. refs #1190
139david-sarah@jacaranda.org**20101029222825
140 Ignore-this: 8b09366eb6ce3d55c7db5239077a0fac
141]
142[test_runner.py: fix error in BinTahoe.test_version_no_noise introduced by last patch. refs #1235
143david-sarah@jacaranda.org**20101029221123
144 Ignore-this: 4bf21ea34768e8e6adf104e56f939fd0
145]
146[test_runner.py: also allow 'from pkg_resources import load_entry_point' as noise. refs #1235.
147david-sarah@jacaranda.org**20101029204246
148 Ignore-this: a47440aa2cdd29ce55ac7c6c7f4bcaf2
149]
150[test_runner.py: if the only noise is 'UserWarning: Unbuilt egg for setuptools', skip instead of failing the no_noise tests. This version avoids 'any' to be compatible with Python < 2.5. refs #1235.
151david-sarah@jacaranda.org**20101029191804
152 Ignore-this: 83ca1543fc9673e664a8eeefe1eba429
153]
154[NEWS: clarify (strengthen) description of what backdoors.rst declares, and add bugfix entries for 'tahoe cp' and Windows console bugs. refs #1216, #1224, #1232
155david-sarah@jacaranda.org**20101028180046
156 Ignore-this: 1c3eef3cd353b06b6ee00ce87c5ef59a
157]
158[startstop_node.py: pyflakes import fix. refs #1190
159david-sarah@jacaranda.org**20101028014805
160 Ignore-this: 369ef5022c8ee5a0d8341af01553bcef
161]
162['tahoe start': use import+call rather than find+spawn
163"Brian Warner <warner@lothar.com>"**20101027061342
164 
165 This removes the need to use a locally-built (dependency) bin/twistd, and
166 removes a big chunk of behavior differences between unix and windows. It
167 also happens to resolve the "client node probably started" uncertainty.
168 Might help with #1190, #602, and #71.
169]
170[make ResponseCache smarter to avoid memory leaks: don't record timestamps, use DataSpans to merge entries, and clear the cache when we see a new seqnum. refs #1045, #1229
171david-sarah@jacaranda.org**20101027043302
172 Ignore-this: 88fd6fba7f35a2f8af1693b92718f5f3
173]
174[windows/fixups.py: limit length of string passed in a single call to WriteConsoleW. fixes #1232.
175david-sarah@jacaranda.org**20101027021636
176 Ignore-this: fbd99e0d22493974696d37925d97c7d6
177]
178[docs/known_issues.rst: Add section on traffic analysis. Fix URL for current version of file.
179david-sarah@jacaranda.org**20101024234259
180 Ignore-this: f3416e79d3bb833f5118da23e85723ad
181]
182[test_mutable.py: add test for ResponseCache memory leak. refs #1045, #1129
183david-sarah@jacaranda.org**20101024193409
184 Ignore-this: 3aee7f0677956cc6deaccb4d5b8e415f
185]
186[docs/running.html: fix missing end-quote, and change frontends/ doc references to .rst.
187david-sarah@jacaranda.org**20101024171500
188 Ignore-this: 47c645a6595e1790b1d1adfa71af0e1d
189]
190[docs/running.html: 'tahoe create-client' now creates a node with storage disabled. Also change configuration.txt references to configuration.rst.
191david-sarah@jacaranda.org**20101024170431
192 Ignore-this: e5b048055494ba3505bb8a506610681c
193]
194[test_encodingutil.py: test_argv_to_unicode modified the wrong encoding variable. fixes #1214
195david-sarah@jacaranda.org**20101023035810
196 Ignore-this: e5f1f849931b96939facc53d93ff61c5
197]
198[doc: add explanation of the motivation for the surprising and awkward API to erasure coding
199zooko@zooko.com**20101015060202
200 Ignore-this: 428913ff6e1bf5b393deffb1f20b949b
201]
202[setup: catch and log ValueError from locale.getdefaultlocale() in show-tool-versions.py
203zooko@zooko.com**20101015054440
204 Ignore-this: 827d91490562c32ed7cf6526dfded773
205 I got a bug report from Mathias Baert showing that locale.getdefaultlocale() raises an exception on his Mac OS X system. Heh.
206]
207[docs: update how-to-make-a-release doc with a few tweaks from the 1.8.0 process
208zooko@zooko.com**20101015054413
209 Ignore-this: ca5e9478531a3393792ae283239549dd
210]
211[docs: update NEWS ref: #1216
212zooko@zooko.com**20101015053719
213 Ignore-this: 2e0b92e4145d667cdf075e64b7965530
214]
215[docs: fix tab-vs-spaces, make some CLI examples <tt>/"literal", wrap some to
216Brian Warner <warner@lothar.com>**20101015060606
217 Ignore-this: eae08bdf0afb19a2fbf41c31e70a8122
218 80-cols, remove spurious whitespace. Add rst2html.py rule to Makefile.
219]
220[docs: add Peter Secor, Shawn Willden, and Terrell Russell as signatories to docs/backdoors.rst
221zooko@zooko.com**20101015053242
222 Ignore-this: c77adf819d664f673e17c4aaeb353f33
223]
224[docs: convert all .txt docs to .rst thanks to Ravi Pinjala
225zooko@zooko.com**20101015052913
226 Ignore-this: 178a5122423189ecfc45b142314a78ec
227 fixes #1225
228]
229[docs: add statement on our refusal to insert backdoors
230zooko@zooko.com**20101006051147
231 Ignore-this: 644d308319a7b80c4434bdff9760404a
232]
233[setup: add --multi-version to the "setup.py develop" command-line
234zooko@zooko.com**20101005182350
235 Ignore-this: 709155cc21caff29826b8d41a8c8d63d
236 fixes #530. I earlier tried this twice (see #530 for history) and then twice rolled it back due to some problems that arose. However, I didn't write down what the problems were in enough detail on the ticket that I can tell today whether those problems are still issues, so here goes the third attempt. (I did write down on the ticket that it would not create site.py or .pth files in the target directory with --multi-version mode, but I didn't explain why *that* was a problem.)
237]
238[setup: use execfile to access _auto_deps.py in its proper location of src/allmydata/ instead of copying it into place when setup.py is executed
239zooko@zooko.com**20100906055714
240 Ignore-this: c179b42672d775580afad40121f86812
241]
242[trivial: M-x whitespace-cleanup
243zooko@zooko.com**20100903144712
244 Ignore-this: 1bb764d11ac69b4a35ea091cfb13158a
245]
246[minor: remove unused interface declaration, change allmydata.org to tahoe-lafs.org in email address, fix wording in relnotes.txt
247zooko@zooko.com**20100930153708
248 Ignore-this: a452969228afed2774de375e29fa3048
249]
250[immutable/repairer.py: don't use the default happiness setting when repairing
251Kevan Carstensen <kevan@isnotajoke.com>**20100927200102
252 Ignore-this: bd704d9744b970849da8d46a16b8089a
253]
254[NEWS: note dependency updates to pycryptopp and pycrypto.
255david-sarah@jacaranda.org**20100924191207
256 Ignore-this: eeaf5c9c9104f24c450c2ec4482ac1ee
257]
258[TAG allmydata-tahoe-1.8.0
259zooko@zooko.com**20100924021631
260 Ignore-this: 494ca0a885c5e20c883845fc53e7ab5d
261]
262Patch bundle hash:
263f764f7dbc260629687de69d83e30387cd4911eea