Closed Bug 1736331 Opened 3 years ago Closed 2 years ago

Reimplement in IOUtils or find an alternative for OS.File.macSetXAttr/OS.File.macGetXAttr

Categories

(Toolkit Graveyard :: OS.File, task)

Tracking

(firefox97 fixed)

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: standard8, Assigned: barret)

References

Details

Attachments

(2 files, 2 obsolete files)

OS.File.macSetXAttr and OS.File.macGetXAttr are used in the attribution code.

We should find a way to replace that, as part of the effort to drop OS.File.

Summary: Reimplement in IOUtils or find an alternative for OS.File.macSetXAttr → Reimplement in IOUtils or find an alternative for OS.File.macSetXAttr/OS.File.macGetXAttr
Assignee: nobody → brennie
Blocks: 1745356

This patch adds support for setting, getting, and reading extended filesystem
attributes on macOS, with helpers for dealing with the "com.apple.quarantine"
attribute, which is the only one we care about.

We cannot get away with not including setXAttr because it is needed in tests
in the attribution code.

Depends on D133835

Depends on D133838

Blocks: 1746675
Blocks: 1746676
Blocks: 1231711

Comment on attachment 9255412 [details]
Bug 1736331 - Replace OS.File Mac extended attribute APIs with IOUtils r?mixedpuppy

Revision D133838 was moved to bug 1745356. Setting attachment 9255412 [details] to obsolete.

Attachment #9255412 - Attachment is obsolete: true

Comment on attachment 9255413 [details]
Bug 1736331 - Remove OS.File.mac{Get,Set,Remove}XAttr r?gijs

Revision D133839 was moved to bug 1746676. Setting attachment 9255413 [details] to obsolete.

Attachment #9255413 - Attachment is obsolete: true
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/275621f46891
Add nsILocalFileMac methods for interacting with extended attributes r=nika
https://hg.mozilla.org/integration/autoland/rev/293085bdd5a1
Add IOUtils methods for dealing with macOS extended filesystem attributes r=Gijs

Backed out for causing bustage on IOUtils.webidl

[task 2021-12-22T16:57:01.779Z] 16:57:01    ERROR -  Traceback (most recent call last):
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 2551, in complete
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      obj = scope._lookupIdentifier(self.name)
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 339, in _lookupIdentifier
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      return self._dict[identifier.name]
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -  KeyError: 'bool'
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -  During handling of the above exception, another exception occurred:
[task 2021-12-22T16:57:01.781Z] 16:57:01    ERROR -  Traceback (most recent call last):
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      return _run_code(code, main_globals, None,
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      exec(code, run_globals)
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/action/webidl.py", line 20, in <module>
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      sys.exit(log_build_task(main, sys.argv[1:]))
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/action/util.py", line 18, in log_build_task
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      return f(*args, **kwargs)
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/action/webidl.py", line 16, in main
[task 2021-12-22T16:57:01.781Z] 16:57:01     INFO -      manager.generate_build_files()
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/mozwebidlcodegen/__init__.py", line 293, in generate_build_files
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      self._parse_webidl()
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/mozwebidlcodegen/__init__.py", line 412, in _parse_webidl
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      self._parser_results = parser.finish()
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 8651, in finish
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      production.finish(self.globalScope())
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 1166, in finish
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      self.finishMembers(scope)
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 818, in finishMembers
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      member.finish(scope)
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 6025, in finish
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      returnType = returnType.complete(scope)
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 3379, in complete
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      self.inner = self.promiseInnerType().complete(scope)
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    File "/builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py", line 2553, in complete
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -      raise WebIDLError("Unresolved type '%s'." % self.name, [self.location])
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -  WebIDL.WebIDLError: error: Unresolved type '<unresolved scope>::bool'., /builds/worker/workspace/obj-build/dom/bindings/IOUtils.webidl line 227:10
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -    Promise<bool> hasMacXAttr(DOMString path, UTF8String attr);
[task 2021-12-22T16:57:01.782Z] 16:57:01     INFO -            ^
[task 2021-12-22T16:57:01.782Z] 16:57:01    ERROR -  gmake[4]: *** [Makefile:54: webidl.stub] Error 1
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0a34c502e65f
Add nsILocalFileMac methods for interacting with extended attributes r=nika
https://hg.mozilla.org/integration/autoland/rev/5745c2669e88
Add IOUtils methods for dealing with macOS extended filesystem attributes r=Gijs

Backed out for causing build bustages in IOUtils

Backout link: https://hg.mozilla.org/integration/autoland/rev/729ebf78a8e1f8b48afab1883ed6994ec5ebf8fc

Push with failures

Failure log

 INFO -  In file included from Unified_cpp_dom_system0.cpp:2:
[task 2021-12-22T19:53:23.740Z] 19:53:23    ERROR -  /builds/worker/checkouts/gecko/dom/system/IOUtils.cpp:801:44: error: too few arguments to function call, expected 3, have 2
[task 2021-12-22T19:53:23.740Z] 19:53:23     INFO -            return HasMacXAttrSync(file, attr);
[task 2021-12-22T19:53:23.740Z] 19:53:23     INFO -                   ~~~~~~~~~~~~~~~           ^
[task 2021-12-22T19:53:23.740Z] 19:53:23     INFO -  /builds/worker/checkouts/gecko/dom/system/IOUtils.h:419:32: note: 'HasMacXAttrSync' declared here
[task 2021-12-22T19:53:23.741Z] 19:53:23     INFO -    static Result<bool, IOError> HasMacXAttrSync(GlobalObject& aGlobal,
[task 2021-12-22T19:53:23.741Z] 19:53:23     INFO -                                 ^
[task 2021-12-22T19:53:23.741Z] 19:53:23     INFO -  In file included from Unified_cpp_dom_system0.cpp:2:
[task 2021-12-22T19:53:23.743Z] 19:53:23    ERROR -  /builds/worker/checkouts/gecko/dom/system/IOUtils.cpp:1634:10: error: no viable conversion from returned value of type 'bool' to function return type 'Result<nsTArray<uint8_t>, IOUtils::IOError>' (aka 'Result<nsTArray<unsigned char>, mozilla::dom::IOUtils::IOError>')
[task 2021-12-22T19:53:23.743Z] 19:53:23     INFO -    return hasAttr;
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0df890ed09e
Add nsILocalFileMac methods for interacting with extended attributes r=nika
https://hg.mozilla.org/integration/autoland/rev/3d627a038faa
Add IOUtils methods for dealing with macOS extended filesystem attributes r=Gijs
Regressions: 1747511
Regressions: 1747510
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c7c570bc463
Add nsILocalFileMac methods for interacting with extended attributes r=nika
https://hg.mozilla.org/integration/autoland/rev/a09866b619ee
Add IOUtils methods for dealing with macOS extended filesystem attributes r=Gijs
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: