"tarfile.StreamError: seeking backwards is not allowed" error during Windows bootstrap
Categories
(Firefox Build System :: Toolchains, defect)
Tracking
(firefox-esr115 unaffected, firefox-esr128 unaffected, firefox130 unaffected, firefox131 unaffected, firefox132 fixed)
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr128 | --- | unaffected |
| firefox130 | --- | unaffected |
| firefox131 | --- | unaffected |
| firefox132 | --- | fixed |
People
(Reporter: RyanVM, Assigned: glandium)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(1 external file)
With MozillaBuild 4.1, I'm seeing this when trying to build today:
0:12.70 Installing bootstrapped toolchain in C:/Users/Ryan/.mozbuild/clang
0:14.77 Setting up artifact clang.tar.zst
0:14.77 Using artifact from local cache: C:\Users\Ryan\.mozbuild\toolchains\cd6531dfc6f033fd-clang.tar.zst
0:15.72 untarring "C:\Users\Ryan\.mozbuild\clang.tar.zst"
0:20.46 Error running mach:
0:20.46
0:20.46 mach --log-no-times artifact toolchain --from-task IHqLzZq2TsKGzKF_EjUDbQ:public/build/clang.tar.zst
0:20.46
0:20.46 The error occurred in code that was called by the mach command. This is either
0:20.46 a bug in the called code itself or in the way that mach is calling it.
0:20.46 You can invoke ``./mach busted`` to check if this issue is already on file. If it
0:20.46 isn't, please use ``./mach busted file artifact`` to report it. If ``./mach busted`` is
0:20.46 misbehaving, you can also inspect the dependencies of bug 1543241.
0:20.46
0:20.46 If filing a bug, please include the full output of mach, including this error
0:20.46 message.
0:20.46
0:20.46 The details of the failure are as follows:
0:20.46
0:20.46 tarfile.StreamError: seeking backwards is not allowed
0:20.46
0:20.46 File "C:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\artifact_commands.py", line 590, in artifact_toolchain
0:20.46 unpack_file(local)
0:20.46 File "c:\users\ryan\repos\mozilla\python\mozbuild\mozbuild\action\tooltool.py", line 996, in unpack_file
0:20.47 safe_extract(tar)
0:20.47 File "c:\users\ryan\repos\mozilla\python\mozbuild\mozbuild\action\tooltool.py", line 972, in safe_extract
0:20.47 tar.extractall(path, members=_files(tar, path), numeric_owner=numeric_owner)
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2264, in extractall
0:20.47 self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2327, in _extract_one
0:20.47 self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2418, in _extract_member
0:20.47 self.makelink(tarinfo, targetpath)
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2519, in makelink
0:20.47 self._extract_member(self._find_link_target(tarinfo),
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2410, in _extract_member
0:20.47 self.makefile(tarinfo, targetpath)
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2453, in makefile
0:20.47 source.seek(tarinfo.offset_data)
0:20.47 File "C:\mozilla-build\python3\Lib\tarfile.py", line 520, in seek
0:20.47 raise StreamError("seeking backwards is not allowed")
Comment 1•2 years ago
|
||
Set release status flags based on info from the regressing bug 1915778
:glandium, since you are the author of the regressor, bug 1915778, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 2•2 years ago
|
||
Before bug 1915568, we didn't have symbolic links in the clang artifact.
That was an unexpected side effect, but supporting unpacking toolchain
artifacts with symbolic links has been a longstanding thing I've wanted
to fix, unlocking Linux and Mac cross-compiles on Windows (e.g. sysroot
artifacts contain symbolic links).
The clang situation is a good occasion to finally do it. It's also
somehow desirable to keep clang with symbolic links, as it makes the
toolchain artifact smaller.
When a tarball contains symbolic links, the python tarfile module ends
up trying to seek in the tar, which doesn't quite work when the tar is
a stream (which it is when decompressing at the same time).
We wrap TarFile so as to handle the symbolic link situation ourselves,
and when we can't create symbolic links, we instead create a copy of
the file the link points to.
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Comment 3•2 years ago
|
||
FWIW, I applied this patch, but now I get this error:
ValueError: too many values to unpack (expected 3)
File "C:\Users\jamie\src\gecko\python\mozbuild\mozbuild\artifact_commands.py", line 590, in artifact_toolchain
unpack_file(local)
File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1043, in unpack_file
safe_extract(tar)
File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1019, in safe_extract
tar.extractall(path, members=_files(tar, path), numeric_owner=numeric_owner)
File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1007, in extractall
for tarinfo, linkpath, numeric_owner in self._defered_links:
| Assignee | ||
Comment 4•2 years ago
|
||
(In reply to James Teh [:Jamie] from comment #3)
FWIW, I applied this patch, but now I get this error:
ValueError: too many values to unpack (expected 3) File "C:\Users\jamie\src\gecko\python\mozbuild\mozbuild\artifact_commands.py", line 590, in artifact_toolchain unpack_file(local) File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1043, in unpack_file safe_extract(tar) File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1019, in safe_extract tar.extractall(path, members=_files(tar, path), numeric_owner=numeric_owner) File "c:\users\jamie\src\gecko\python\mozbuild\mozbuild\action\tooltool.py", line 1007, in extractall for tarinfo, linkpath, numeric_owner in self._defered_links:
When getting what toolchain?
Comment 5•2 years ago
•
|
||
Sorry:
Using artifact from local cache: C:\Users\jamie.mozbuild\toolchains\cd6531dfc6f033fd-clang.tar.zst
untarring "C:\Users\jamie.mozbuild\clang.tar.zst"
| Assignee | ||
Comment 6•2 years ago
|
||
(In reply to James Teh [:Jamie] from comment #5)
Sorry:
Using artifact from local cache: C:\Users\jamie.mozbuild\toolchains\cd6531dfc6f033fd-clang.tar.zst
untarring "C:\Users\jamie.mozbuild\clang.tar.zst"
Try the last version of the patch.
Comment 7•2 years ago
|
||
Working now, thank you.
Comment 9•2 years ago
|
||
Odd, I still see the bug even applying the latest patch.]
untarring "C:\Users\toybox\.mozbuild\clang.tar.zst"
Error running mach:
mach --log-no-times artifact toolchain --from-task IHqLzZq2TsKGzKF_EjUDbQ:public/build/clang.tar.zst
<snip>
tarfile.StreamError: seeking backwards is not allowed
File "M:\src\python\mozbuild\mozbuild\artifact_commands.py", line 590, in artifact_toolchain
unpack_file(local)
File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1046, in unpack_file
safe_extract(tar)
File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1022, in safe_extract
tar.extractall(path, members=_files(tar, path), numeric_owner=numeric_owner)
File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1008, in extractall
super(TarFile, self).extractall(*args, **kwargs)
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2264, in extractall
self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2327, in _extract_one
self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2418, in _extract_member
self.makelink(tarinfo, targetpath)
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2519, in makelink
self._extract_member(self._find_link_target(tarinfo),
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2410, in _extract_member
self.makefile(tarinfo, targetpath)
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2453, in makefile
source.seek(tarinfo.offset_data)
File "C:\mozilla-build\python3\Lib\tarfile.py", line 520, in seek
raise StreamError("seeking backwards is not allowed")
| Assignee | ||
Comment 10•2 years ago
|
||
File "C:\mozilla-build\python3\Lib\tarfile.py", line 2264, in extractall
self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
gah, looks like python changed its implementation of extractall not to use extract... are you using 3.12?
| Assignee | ||
Comment 11•2 years ago
|
||
huh, yeah, it was changed in https://github.com/python/cpython/commit/af530469954e8ad49f1e071ef31c844b9bfda414, in 3.12 :(
Comment 12•2 years ago
|
||
No, ./mach python3 shows 3.11.7. Did I change the version by myself??
| Assignee | ||
Comment 13•2 years ago
|
||
Can you try this patch on top?
diff --git a/python/mozbuild/mozbuild/action/tooltool.py b/python/mozbuild/mozbuild/action/tooltool.py
index adf6422c2ac58..6f506dedf5df2 100755
--- a/python/mozbuild/mozbuild/action/tooltool.py
+++ b/python/mozbuild/mozbuild/action/tooltool.py
@@ -964,7 +964,7 @@ def validate_tar_member(member, path):
class TarFile(tarfile.TarFile):
- def extract(self, member, path="", set_attrs=True, numeric_owner=False, **kwargs):
+ def _extract_one(self, member, path="", set_attrs=True, numeric_owner=False, **kwargs):
defered_links = getattr(self, "_defered_links", None)
if not isinstance(member, tarfile.TarInfo):
member = self.getmember(member)
@@ -1002,6 +1002,8 @@ class TarFile(tarfile.TarFile):
self.chown(tarinfo, linkpath, numeric_owner)
self._extracted_members.add(targetpath)
+ extract = _extract_one
+
def extractall(self, *args, **kwargs):
self._defered_links = {}
self._extracted_members = set()
| Assignee | ||
Comment 14•2 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #12)
No,
./mach python3shows3.11.7. Did I change the version by myself??
It was backported to 3.11 too https://github.com/python/cpython/commit/241f2e54a6a2801a1d2022f0fa56309e124866c3
Comment 15•2 years ago
|
||
Hmm, I got "maximum recursion depth exceeded in comparison" error.
0:11.42 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1048, in unpack_file
0:11.42 safe_extract(tar)
0:11.42 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1024, in safe_extract
0:11.42 tar.extractall(path, members=_files(tar, path), numeric_owner=numeric_owner)
0:11.42 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 1010, in extractall
0:11.42 super(TarFile, self).extractall(*args, **kwargs)
0:11.42 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2264, in extractall
0:11.43 self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
0:11.43 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 996, in _extract_one
0:11.43 super(TarFile, self).extract(
0:11.43 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2297, in extract
0:11.43 self._extract_one(tarinfo, path, set_attrs, numeric_owner)
0:11.43 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 996, in _extract_one
0:11.43 super(TarFile, self).extract(
| Assignee | ||
Comment 16•2 years ago
|
||
0:11.42 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2264, in extractall
0:11.43 self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
0:11.43 File "m:\src\python\mozbuild\mozbuild\action\tooltool.py", line 996, in _extract_one
0:11.43 super(TarFile, self).extract(
0:11.43 File "C:\mozilla-build\python3\Lib\tarfile.py", line 2297, in extract
0:11.43 self._extract_one(tarinfo, path, set_attrs, numeric_owner)
facepalm, of course...
| Assignee | ||
Comment 17•2 years ago
|
||
Latest version on phabricator should work, now.
| Reporter | ||
Comment 19•2 years ago
|
||
Latest patch also worked for me, thanks!
Comment 22•2 years ago
|
||
Comment 23•2 years ago
|
||
| bugherder | ||
Comment 25•2 years ago
|
||
Backed out as requested by Glandium wrong patch was landed.
Comment 26•2 years ago
|
||
Just confirming that the latest patch in https://phabricator.services.mozilla.com/D221282, when applied locally, does fix the bug for me.
| Assignee | ||
Updated•2 years ago
|
Comment 27•2 years ago
|
||
Comment 28•2 years ago
|
||
| bugherder | ||
Description
•