diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2020-12-02 13:58:10 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-12-09 12:27:25 +0000 |
commit | 221dc50cde88977907a58aa23a6efd8c289113da (patch) | |
tree | fb6757968729dc0aece7fcb7ccda266791123a96 /bitbake | |
parent | bf1521fbf1572c823d98ce2cf00f26fb6447262f (diff) | |
download | poky-221dc50cde88977907a58aa23a6efd8c289113da.tar.gz |
bitbake: hashserv: client: Fix AF_UNIX path length limits
Restores a fix for unix domain socket path length limits when using the
synchronous hash equivalence client that was accidentally removed when
the async client was added.
Unfortunately, it's much more difficult to fix the same problem when
using the async client directly due to the interaction of chdir() and
async code, but this will at least restore the old behavior in the
synchronous case.
(Bitbake rev: 53e85022a8b1c8f407c9418260c59beffb96f0f9)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/hashserv/client.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py index ae5875d1b3..7bbf0865d5 100644 --- a/bitbake/lib/hashserv/client.py +++ b/bitbake/lib/hashserv/client.py | |||
@@ -40,7 +40,7 @@ class AsyncClient(object): | |||
40 | 40 | ||
41 | self._connect_sock = connect_sock | 41 | self._connect_sock = connect_sock |
42 | 42 | ||
43 | async def _connect(self): | 43 | async def connect(self): |
44 | if self.reader is None or self.writer is None: | 44 | if self.reader is None or self.writer is None: |
45 | (self.reader, self.writer) = await self._connect_sock() | 45 | (self.reader, self.writer) = await self._connect_sock() |
46 | 46 | ||
@@ -62,7 +62,7 @@ class AsyncClient(object): | |||
62 | count = 0 | 62 | count = 0 |
63 | while True: | 63 | while True: |
64 | try: | 64 | try: |
65 | await self._connect() | 65 | await self.connect() |
66 | return await proc() | 66 | return await proc() |
67 | except ( | 67 | except ( |
68 | OSError, | 68 | OSError, |
@@ -190,7 +190,6 @@ class Client(object): | |||
190 | 190 | ||
191 | for call in ( | 191 | for call in ( |
192 | "connect_tcp", | 192 | "connect_tcp", |
193 | "connect_unix", | ||
194 | "close", | 193 | "close", |
195 | "get_unihash", | 194 | "get_unihash", |
196 | "report_unihash", | 195 | "report_unihash", |
@@ -209,6 +208,16 @@ class Client(object): | |||
209 | 208 | ||
210 | return wrapper | 209 | return wrapper |
211 | 210 | ||
211 | def connect_unix(self, path): | ||
212 | # AF_UNIX has path length issues so chdir here to workaround | ||
213 | cwd = os.getcwd() | ||
214 | try: | ||
215 | os.chdir(os.path.dirname(path)) | ||
216 | self.loop.run_until_complete(self.client.connect_unix(path)) | ||
217 | self.loop.run_until_complete(self.client.connect()) | ||
218 | finally: | ||
219 | os.chdir(cwd) | ||
220 | |||
212 | @property | 221 | @property |
213 | def max_chunk(self): | 222 | def max_chunk(self): |
214 | return self.client.max_chunk | 223 | return self.client.max_chunk |