Page MenuHomePhabricator

Bug 1649611: Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions
ClosedPublic

Authored by emalysz on Dec 14 2020, 10:38 PM.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Lint Not Applicable
Unit
Tests Not Applicable
Build Status
Buildable 282695
Build 375437: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
toolkit/components/downloads/test/unit/common_test_Download.js
340

@barret Rerequesting review for my changes to this test file.

This comment here suggests that we do honor the umask value: https://searchfox.org/mozilla-central/rev/8d722de75886d6bffc116772a1db8854e34ee6a7/toolkit/components/downloads/DownloadIntegration.jsm#670, but I'm not sure we're doing that. The permissions can either be 0o400 or 0o666, so I'm not sure why this value is included in the test

barret requested changes to this revision.Jan 12 2021, 6:46 PM
barret added inline comments.
toolkit/components/downloads/test/unit/common_test_Download.js
340

The old version did respect the umask, the new one does not.

IOUtils implementation uses nsIFile::SetPermissions() which does not respect umask:
https://searchfox.org/mozilla-central/rev/8f4f3e6fea43f5920f05907e5e477bcd04d1134e/xpcom/io/nsLocalFileUnix.cpp#1111

OS.File.setPermissions *does* respect umask:
https://searchfox.org/mozilla-central/source/toolkit/components/osfile/modules/osfile_unix_front.jsm#216

We should probably add an option to setPermissions to respect umask, defaulting to true

This revision now requires changes to proceed.Jan 12 2021, 6:46 PM
emalysz retitled this revision from Bug 1649611: Remove OS.File usage from DownloadIntegration.jsm to Bug 1649611: Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions.
emalysz marked an inline comment as done.

Code analysis found 1 defect in the diff 386048:

  • 1 defect found by eslint (Mozlint)

You can run this analysis locally with:

  • ./mach lint --warnings --outgoing

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

Code analysis found 1 defect in the diff 386049:

  • 1 defect found by eslint (Mozlint)

You can run this analysis locally with:

  • ./mach lint --warnings --outgoing

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

barret requested changes to this revision.Jan 14 2021, 12:19 AM
barret added inline comments.
dom/system/tests/ioutils/test_ioutils_set_permissions.html
38

Why aren't we checking against the system umask here?

47–48

nit: blank line between these

59

And here?

This revision now requires changes to proceed.Jan 14 2021, 12:19 AM
emalysz marked 3 inline comments as done.
This revision is now accepted and ready to land.Jan 14 2021, 7:05 PM
This revision is now accepted and ready to land.Jan 15 2021, 3:42 AM
This revision is now accepted and ready to land.Jan 16 2021, 10:52 AM

Hey @barret ! Missed this failure before - the windows zone information relies on winAllowLengthBeyondMaxPathWithCaveats. DownloadIntegration seems to be the only place that uses that arg, but I figured it may make more sense too add this to PathUtils. Requesting review for those changes :)

barret added inline comments.
dom/chrome-webidl/PathUtils.webidl
68

This should be called "toExtendedWindowsPath" or similar

dom/system/PathUtils.cpp
220

This should throw on non-Windows platforms.

236

"uncPath"

237

"normalPath" or "nonUNCPath"

This revision is now accepted and ready to land.Jan 27 2021, 6:24 PM
emalysz marked 4 inline comments as done.

Code analysis found 1 defect in the diff 391628:

  • 1 defect found by Coverity

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

Code analysis found 1 defect in the diff 391718:

  • 1 defect found by Coverity

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

This revision is now accepted and ready to land.Jan 27 2021, 11:17 PM

Code analysis found 1 defect in the diff 391748:

  • 1 defect found by Coverity

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

Code analysis found 1 defect in the diff 391786:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

This revision is now accepted and ready to land.Jan 29 2021, 10:02 AM
emalysz edited the summary of this revision. (Show Details)

Code analysis found 1 defect in the diff 392907:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

This revision is now accepted and ready to land.Jan 30 2021, 12:50 AM