1 | Mon Jul 12 03:55:37 GMT Daylight Time 2010 david-sarah@jacaranda.org |
---|
2 | * SFTP: address some of the comments in zooko's review (#1106). |
---|
3 | |
---|
4 | New patches: |
---|
5 | |
---|
6 | [SFTP: address some of the comments in zooko's review (#1106). |
---|
7 | david-sarah@jacaranda.org**20100712025537 |
---|
8 | Ignore-this: c3921638a2d4f1de2a776ae78e4dc37e |
---|
9 | ] { |
---|
10 | hunk ./src/allmydata/frontends/sftpd.py 81 |
---|
11 | |
---|
12 | |
---|
13 | def _convert_error(res, request): |
---|
14 | + """If res is not a Failure, return it, otherwise reraise the appropriate |
---|
15 | + SFTPError.""" |
---|
16 | + |
---|
17 | if not isinstance(res, Failure): |
---|
18 | logged_res = res |
---|
19 | if isinstance(res, str): logged_res = "<data of length %r>" % (len(res),) |
---|
20 | hunk ./src/allmydata/frontends/sftpd.py 94 |
---|
21 | logmsg("RAISE %r %r" % (request, err.value), level=OPERATIONAL) |
---|
22 | try: |
---|
23 | if noisy: logmsg(traceback.format_exc(err.value), level=NOISY) |
---|
24 | - except: # pragma: no cover |
---|
25 | + except Exception: # pragma: no cover |
---|
26 | pass |
---|
27 | |
---|
28 | # The message argument to SFTPError must not reveal information that |
---|
29 | hunk ./src/allmydata/frontends/sftpd.py 98 |
---|
30 | - # might compromise anonymity. |
---|
31 | + # might compromise anonymity, if we are running over an anonymous network. |
---|
32 | |
---|
33 | if err.check(SFTPError): |
---|
34 | # original raiser of SFTPError has responsibility to ensure anonymity |
---|
35 | hunk ./src/allmydata/frontends/sftpd.py 146 |
---|
36 | st_gid = "tahoe" |
---|
37 | st_mtime = attrs.get("mtime", 0) |
---|
38 | st_mode = attrs["permissions"] |
---|
39 | - # TODO: check that clients are okay with this being a "?". |
---|
40 | - # (They should be because the longname is intended for human |
---|
41 | - # consumption.) |
---|
42 | st_size = attrs.get("size", "?") |
---|
43 | # We don't know how many links there really are to this object. |
---|
44 | st_nlink = 1 |
---|
45 | hunk ./src/allmydata/frontends/sftpd.py 392 |
---|
46 | self.overwrite(self.current_size, "\x00" * (size - self.current_size)) |
---|
47 | self.current_size = size |
---|
48 | |
---|
49 | - # invariant: self.download_size <= self.current_size |
---|
50 | + # make the invariant self.download_size <= self.current_size be true again |
---|
51 | if size < self.download_size: |
---|
52 | self.download_size = size |
---|
53 | hunk ./src/allmydata/frontends/sftpd.py 395 |
---|
54 | + |
---|
55 | if self.downloaded >= self.download_size: |
---|
56 | self.finish() |
---|
57 | |
---|
58 | hunk ./src/allmydata/frontends/sftpd.py 401 |
---|
59 | def registerProducer(self, p, streaming): |
---|
60 | if noisy: self.log(".registerProducer(%r, streaming=%r)" % (p, streaming), level=NOISY) |
---|
61 | + if self.producer is not None: |
---|
62 | + raise RuntimeError("producer is already registered") |
---|
63 | + |
---|
64 | self.producer = p |
---|
65 | if streaming: |
---|
66 | # call resumeProducing once to start things off |
---|
67 | hunk ./src/allmydata/frontends/sftpd.py 477 |
---|
68 | return |
---|
69 | if noisy: self.log("MILESTONE %r %r" % (next, d), level=NOISY) |
---|
70 | heapq.heappop(self.milestones) |
---|
71 | - eventually_callback(d)(None) |
---|
72 | + eventually(d.callback, None) |
---|
73 | |
---|
74 | if milestone >= self.download_size: |
---|
75 | self.finish() |
---|
76 | hunk ./src/allmydata/frontends/sftpd.py 550 |
---|
77 | return self.done |
---|
78 | |
---|
79 | def finish(self): |
---|
80 | + """Called by the producer when it has finished producing, or when we have |
---|
81 | + received enough bytes, or as a result of a close. Defined by IFinishableConsumer.""" |
---|
82 | + |
---|
83 | while len(self.milestones) > 0: |
---|
84 | (next, d) = self.milestones[0] |
---|
85 | if noisy: self.log("MILESTONE FINISH %r %r" % (next, d), level=NOISY) |
---|
86 | hunk ./src/allmydata/frontends/sftpd.py 560 |
---|
87 | # The callback means that the milestone has been reached if |
---|
88 | # it is ever going to be. Note that the file may have been |
---|
89 | # truncated to before the milestone. |
---|
90 | - eventually_callback(d)(None) |
---|
91 | + eventually(d.callback, None) |
---|
92 | |
---|
93 | def close(self): |
---|
94 | if not self.is_closed: |
---|
95 | hunk ./src/allmydata/frontends/sftpd.py 567 |
---|
96 | self.is_closed = True |
---|
97 | try: |
---|
98 | self.f.close() |
---|
99 | - except BaseException, e: |
---|
100 | + except Exception, e: |
---|
101 | self.log("suppressed %r from close of temporary file %r" % (e, self.f), level=WEIRD) |
---|
102 | self.finish() |
---|
103 | |
---|
104 | hunk ./src/allmydata/frontends/sftpd.py 582 |
---|
105 | implements(ISFTPFile) |
---|
106 | """I represent a file handle to a particular file on an SFTP connection. |
---|
107 | I am used only for short immutable files opened in read-only mode. |
---|
108 | - The file contents are downloaded to memory when I am created.""" |
---|
109 | + When I am created, the file contents start to be downloaded to memory. |
---|
110 | + self.async is used to delay read requests until the download has finished.""" |
---|
111 | |
---|
112 | def __init__(self, userpath, filenode, metadata): |
---|
113 | PrefixingLogMixin.__init__(self, facility="tahoe.sftp", prefix=userpath) |
---|
114 | hunk ./src/allmydata/frontends/sftpd.py 617 |
---|
115 | # i.e. we respond with an EOF error iff offset is already at EOF. |
---|
116 | |
---|
117 | if offset >= len(data): |
---|
118 | - eventually_errback(d)(SFTPError(FX_EOF, "read at or past end of file")) |
---|
119 | + eventually(d.errback, SFTPError(FX_EOF, "read at or past end of file")) |
---|
120 | else: |
---|
121 | hunk ./src/allmydata/frontends/sftpd.py 619 |
---|
122 | - eventually_callback(d)(data[offset:min(offset+length, len(data))]) |
---|
123 | + eventually(d.callback, data[offset:offset+length]) # truncated if offset+length > len(data) |
---|
124 | return data |
---|
125 | self.async.addCallbacks(_read, eventually_errback(d)) |
---|
126 | d.addBoth(_convert_error, request) |
---|
127 | hunk ./src/allmydata/frontends/sftpd.py 714 |
---|
128 | else: |
---|
129 | assert IFileNode.providedBy(filenode), filenode |
---|
130 | |
---|
131 | - # TODO: use download interface described in #993 when implemented. |
---|
132 | if filenode.is_mutable(): |
---|
133 | self.async.addCallback(lambda ign: filenode.download_best_version()) |
---|
134 | def _downloaded(data): |
---|
135 | hunk ./src/allmydata/frontends/sftpd.py 731 |
---|
136 | filenode.read(self.consumer, 0, None) |
---|
137 | self.async.addCallback(_read) |
---|
138 | |
---|
139 | - eventually_callback(self.async)(None) |
---|
140 | + eventually(self.async.callback, None) |
---|
141 | |
---|
142 | if noisy: self.log("open done", level=NOISY) |
---|
143 | return self |
---|
144 | hunk ./src/allmydata/frontends/sftpd.py 919 |
---|
145 | |
---|
146 | # self.filenode might be None, but that's ok. |
---|
147 | attrs = _populate_attrs(self.filenode, self.metadata, size=self.consumer.get_current_size()) |
---|
148 | - eventually_callback(d)(attrs) |
---|
149 | + eventually(d.callback, attrs) |
---|
150 | return None |
---|
151 | self.async.addCallbacks(_get, eventually_errback(d)) |
---|
152 | d.addBoth(_convert_error, request) |
---|
153 | hunk ./src/allmydata/frontends/sftpd.py 957 |
---|
154 | # TODO: should we refuse to truncate a file opened with FXF_APPEND? |
---|
155 | # <http://allmydata.org/trac/tahoe-lafs/ticket/1037#comment:20> |
---|
156 | self.consumer.set_current_size(size) |
---|
157 | - eventually_callback(d)(None) |
---|
158 | + eventually(d.callback, None) |
---|
159 | return None |
---|
160 | self.async.addCallbacks(_set, eventually_errback(d)) |
---|
161 | d.addBoth(_convert_error, request) |
---|
162 | } |
---|
163 | |
---|
164 | Context: |
---|
165 | |
---|
166 | [upcase_since_on_welcome |
---|
167 | terrellrussell@gmail.com**20100708193903] |
---|
168 | [server_version_on_welcome_page.dpatch.txt |
---|
169 | freestorm77@gmail.com**20100605191721 |
---|
170 | Ignore-this: b450c76dc875f5ac8cca229a666cbd0a |
---|
171 | |
---|
172 | |
---|
173 | - The storage server version is 0 for all storage nodes in the Welcome Page |
---|
174 | |
---|
175 | |
---|
176 | ] |
---|
177 | [NEWS: add NEWS snippets about two recent patches |
---|
178 | zooko@zooko.com**20100708162058 |
---|
179 | Ignore-this: 6c9da6a0ad7351a960bdd60f81532899 |
---|
180 | ] |
---|
181 | [directory_html_top_banner.dpatch |
---|
182 | freestorm77@gmail.com**20100622205301 |
---|
183 | Ignore-this: 1d770d975e0c414c996564774f049bca |
---|
184 | |
---|
185 | The div tag with the link "Return to Welcome page" on the directory.xhtml page is not correct |
---|
186 | |
---|
187 | ] |
---|
188 | [tahoe_css_toolbar.dpatch |
---|
189 | freestorm77@gmail.com**20100622210046 |
---|
190 | Ignore-this: 5b3ebb2e0f52bbba718a932f80c246c0 |
---|
191 | |
---|
192 | CSS modification to be correctly diplayed with Internet Explorer 8 |
---|
193 | |
---|
194 | The links on the top of page directory.xhtml are not diplayed in the same line as display with Firefox. |
---|
195 | |
---|
196 | ] |
---|
197 | [runnin_test_tahoe_css.dpatch |
---|
198 | freestorm77@gmail.com**20100622214714 |
---|
199 | Ignore-this: e0db73d68740aad09a7b9ae60a08c05c |
---|
200 | |
---|
201 | Runnin test for changes in tahoe.css file |
---|
202 | |
---|
203 | ] |
---|
204 | [runnin_test_directory_xhtml.dpatch |
---|
205 | freestorm77@gmail.com**20100622201403 |
---|
206 | Ignore-this: f8962463fce50b9466405cb59fe11d43 |
---|
207 | |
---|
208 | Runnin test for diretory.xhtml top banner |
---|
209 | |
---|
210 | ] |
---|
211 | [stringutils.py: tolerate sys.stdout having no 'encoding' attribute. |
---|
212 | david-sarah@jacaranda.org**20100626040817 |
---|
213 | Ignore-this: f42cad81cef645ee38ac1df4660cc850 |
---|
214 | ] |
---|
215 | [quickstart.html: python 2.5 -> 2.6 as recommended version |
---|
216 | david-sarah@jacaranda.org**20100705175858 |
---|
217 | Ignore-this: bc3a14645ea1d5435002966ae903199f |
---|
218 | ] |
---|
219 | [SFTP: don't call .stopProducing on the producer registered with OverwriteableFileConsumer (which breaks with warner's new downloader). |
---|
220 | david-sarah@jacaranda.org**20100628231926 |
---|
221 | Ignore-this: 131b7a5787bc85a9a356b5740d9d996f |
---|
222 | ] |
---|
223 | [docs/how_to_make_a_tahoe-lafs_release.txt: trivial correction, install.html should now be quickstart.html. |
---|
224 | david-sarah@jacaranda.org**20100625223929 |
---|
225 | Ignore-this: 99a5459cac51bd867cc11ad06927ff30 |
---|
226 | ] |
---|
227 | [setup: in the Makefile, refuse to upload tarballs unless someone has passed the environment variable "BB_BRANCH" with value "trunk" |
---|
228 | zooko@zooko.com**20100619034928 |
---|
229 | Ignore-this: 276ddf9b6ad7ec79e27474862e0f7d6 |
---|
230 | ] |
---|
231 | [trivial: tiny update to in-line comment |
---|
232 | zooko@zooko.com**20100614045715 |
---|
233 | Ignore-this: 10851b0ed2abfed542c97749e5d280bc |
---|
234 | (I'm actually committing this patch as a test of the new eager-annotation-computation of trac-darcs.) |
---|
235 | ] |
---|
236 | [docs: about.html link to home page early on, and be decentralized storage instead of cloud storage this time around |
---|
237 | zooko@zooko.com**20100619065318 |
---|
238 | Ignore-this: dc6db03f696e5b6d2848699e754d8053 |
---|
239 | ] |
---|
240 | [docs: update about.html, especially to have a non-broken link to quickstart.html, and also to comment out the broken links to "for Paranoids" and "for Corporates" |
---|
241 | zooko@zooko.com**20100619065124 |
---|
242 | Ignore-this: e292c7f51c337a84ebfeb366fbd24d6c |
---|
243 | ] |
---|
244 | [TAG allmydata-tahoe-1.7.0 |
---|
245 | zooko@zooko.com**20100619052631 |
---|
246 | Ignore-this: d21e27afe6d85e2e3ba6a3292ba2be1 |
---|
247 | ] |
---|
248 | Patch bundle hash: |
---|
249 | 90a0f8f93d2ebf7fac7b5a8277dc7347be41ba38 |
---|