Closed Bug 1164290 Opened 10 years ago Closed 10 years ago

ZipUtils.extractFiles() breaks with symbolic links

Categories

(Toolkit :: General, defect)

defect
Not set
normal

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)

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.
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)
Including a symlink into the zip file used by xpcshell tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d82717a835ae
Including a symlink into the zip file used by xpcshell tests, and the fix: https://treeherder.mozilla.org/#/jobs?repo=try&revision=decc92d298f7
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+
Thanks. I do have a test that should do the job :)
Attachment #8604962 - Attachment is obsolete: true
Attachment #8605233 - Flags: review?(janx)
and of course, symlink fails on windows ...
But we see the failures on linux that gets fixed :)
And that should skip symlink testing on Windows ... :)
Attachment #8605233 - Attachment is obsolete: true
Attachment #8605233 - Flags: review?(janx)
Attachment #8605276 - Flags: review+
Attachment #8605276 - Flags: review+ → review?(janx)
(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 :(
Attachment #8605276 - Attachment is obsolete: true
Attachment #8605276 - Flags: review?(janx)
Attachment #8605290 - Flags: review?(janx)
Attachment #8605290 - Attachment is obsolete: true
Attachment #8605290 - Flags: review?(janx)
Attachment #8605296 - Flags: review?(janx)
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+
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+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Blocks: 1168562
Whiteboard: [systemsfe]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: