Closed
Bug 1164290
Opened 10 years ago
Closed 10 years ago
ZipUtils.extractFiles() breaks with symbolic links
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: gerard-majax, Assigned: gerard-majax)
References
Details
(Whiteboard: [systemsfe])
Attachments
(1 file, 5 obsolete files)
3.57 KB,
patch
|
gerard-majax
:
review+
|
Details | Diff | Splinter Review |
STR:
0. Produce a zip file that contains at least one symlink
1. ZipUtils.extractFiles() this file
Expected:
Extraction is completed successfully and we get proper symlinks created
Actual:
Extraction aborts with promise error pointing to https://hg.mozilla.org/mozilla-central/annotate/617dbce26726/toolkit/modules/ZipUtils.jsm#l214
Problem is just ... the string used in the catch() block. Using target.permissions fixes this for me.
Assignee | ||
Comment 1•10 years ago
|
||
Jan, I'm asking you review because you landed this, but feel free to redirect
to anyone which is better suited :)
Attachment #8604962 -
Flags: review?(janx)
Assignee | ||
Comment 2•10 years ago
|
||
Assignee | ||
Comment 3•10 years ago
|
||
Including a symlink into the zip file used by xpcshell tests:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d82717a835ae
Assignee | ||
Comment 4•10 years ago
|
||
Including a symlink into the zip file used by xpcshell tests, and the fix:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=decc92d298f7
Comment 5•10 years ago
|
||
Comment on attachment 8604962 [details] [diff] [review]
Fix error code path of ZipUtils.extractFiles()
Review of attachment 8604962 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for fixing this! I must have missed that error when moving the code around. One nit.
Also, if you have a patch that adds a symlink to a test archive, and you feel it would be valuable, I'd be happy to review it as well.
::: toolkit/modules/ZipUtils.jsm
@@ +210,5 @@
> try {
> target.permissions |= FileUtils.PERMS_FILE;
> }
> catch (e) {
> + dump("Failed to set permissions " + target.permissions.toString(8) + " on " + target.path + ":" + e + "\n");
If modifying `target.permissions` fails, this error message will be wrong. Please replace `target.permissions.toString(8)` with `FileUtils.PERMS_FILE.toString(8)`, or simply remove it (i.e. "Failed to set permissions on [...]").
Attachment #8604962 -
Flags: review?(janx) → review+
Assignee | ||
Comment 6•10 years ago
|
||
Thanks. I do have a test that should do the job :)
Assignee | ||
Comment 7•10 years ago
|
||
test case, that should fail: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3aa3a35a1092
Assignee | ||
Comment 8•10 years ago
|
||
test case with the fix, that should pass: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6962ffccec7a
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8604962 -
Attachment is obsolete: true
Attachment #8605233 -
Flags: review?(janx)
Assignee | ||
Comment 10•10 years ago
|
||
and of course, symlink fails on windows ...
Assignee | ||
Comment 11•10 years ago
|
||
But we see the failures on linux that gets fixed :)
Assignee | ||
Comment 12•10 years ago
|
||
And that should skip symlink testing on Windows ... :)
Attachment #8605233 -
Attachment is obsolete: true
Attachment #8605233 -
Flags: review?(janx)
Attachment #8605276 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Attachment #8605276 -
Flags: review+ → review?(janx)
Assignee | ||
Comment 13•10 years ago
|
||
Assignee | ||
Comment 14•10 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #13)
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=3c1ddb789e83
And I've forgot to commit :(
Assignee | ||
Comment 15•10 years ago
|
||
Attachment #8605276 -
Attachment is obsolete: true
Attachment #8605276 -
Flags: review?(janx)
Attachment #8605290 -
Flags: review?(janx)
Assignee | ||
Comment 16•10 years ago
|
||
Assignee | ||
Comment 17•10 years ago
|
||
Attachment #8605290 -
Attachment is obsolete: true
Attachment #8605290 -
Flags: review?(janx)
Attachment #8605296 -
Flags: review?(janx)
Comment 18•10 years ago
|
||
Comment on attachment 8605296 [details] [diff] [review]
Adding symbolic link into test zip file
Review of attachment 8605296 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good! Thanks for adding the symlink to the tests.
::: toolkit/modules/ZipUtils.jsm
@@ +210,5 @@
> try {
> target.permissions |= FileUtils.PERMS_FILE;
> }
> catch (e) {
> + dump("Failed to set permissions " + FileUtils.PERMS_FILE.toString(8) + " on " + target.path + " (" + e + ")\n");
Nit: Maybe you don't need the "()" around the exception, because it will already surround itself with "[]":
(pid:23854) "Failed to set permissions 644 on /tmp/tmp2QJ34I/test_ZipUtils/test_extractFiles/zen/beyond_link ([Exception... "Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIFile.permissions]" nsresult: "0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)" location: "JS frame :: resource://gre/modules/ZipUtils.jsm :: ZipUtils_extractFiles :: line 211" data: no])"
::: toolkit/modules/tests/xpcshell/test_ZipUtils.js
@@ +32,5 @@
> }
> }
>
> +function ensureHasSymlink(target) {
> + // Just bail out if running on Windows, since symlink do not exists there.
Nit: "since symlinks do not exist there."
Attachment #8605296 -
Flags: review?(janx) → review+
Assignee | ||
Comment 19•10 years ago
|
||
Addressed the remaining nits.
We have green try on https://treeherder.mozilla.org/#/jobs?repo=try&revision=e2a3b7a835a5
Attachment #8605296 -
Attachment is obsolete: true
Attachment #8605373 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 20•10 years ago
|
||
Keywords: checkin-needed
Comment 21•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Updated•10 years ago
|
Whiteboard: [systemsfe]
You need to log in
before you can comment on or make changes to this bug.
Description
•