Closed Bug 1727624 Opened 3 years ago Closed 2 years ago

When launched from the command line, Firefox detects the macOS version as 10.16 (only applies to Intel arch, which is built with 10.12 SDK)

Categories

(Core :: Widget: Cocoa, defect, P3)

defect

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- fixed
firefox94 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox101 --- wontfix
firefox102 --- fixed

People

(Reporter: mstange, Assigned: glandium)

References

(Blocks 1 open bug)

Details

Steps to reproduce:

  1. Compile a local Firefox build with the 10.12 SDK.
  2. Capture a profile in it.
  3. Check the macOS version number that is displayed in the top left corner.

Expected results:
On macOS 12 Beta, you should see 12.0.0

Actual results:
In local builds, it says 10.16.0. https://share.firefox.dev/3gwbOYS
Regular Nightly seems to be fine.

This indicates that nsCocoaFeatures::GetSystemVersion gets the wrong version, which indicates that the contents of /System/Library/CoreServices/SystemVersion.plist are spoofed to contain "10.16" instead of "12.0".

Detecting the wrong version can cause various breakage; for example it'll break this check in IsAppRunningFromDmg().

I'm not sure why regular Nightly doesn't have this problem. Maybe the OS behaves differently based on the bundle name.

/System/Library/CoreServices/SystemVersionCompat.plist lists the ProductVersion as 10.16 -- exactly the same as on macOS 11. This means that nsCocoaFeatures::GetSystemVersion sees the system version as 10.16 when Firefox is run from the command line (again, exactly as on macOS 11).

But, as of bug 1690604, this doesn't happen when you run Firefox by double-clicking on its icon, or by using open /Applications/Firefox.app from the command line.

Mozilla should complain to Apple about this. Besides the workaround implemented at bug 1690604, there's not much we can do about it.

I got the same results in both the current Firefox release and today's mozilla-central nightly. I tested by doing about:crashparent, then looking at the crash report that was generated.

Ah indeed, starting from the command line was the difference! Thanks.

This will probably be fixed if we build with the macOS 11 SDK, would you agree? We can just do that.

This will probably be fixed if we build with the macOS 11 SDK, would you agree?

I don't know. You might need to build with the macOS 12 SDK :-(

I'll give it a try.

I built locally with the 11.1 SDK (that's the only 11+ SDK I had) and the build indeed now detects 12.0.0 when launched from the command line.

Summary: Local builds on macOS 12 think they're running on 10.16, regular Nightly is fine → When launched from the command line, Firefox detects the macOS version as 10.16 (only applies to Intel arch, which is built with 10.12 SDK)

Setting initial priority and severity.

Severity: -- → S3
Priority: -- → P3

Now that the minimum SDK has been bumped to 11 in bug 1696504 I guess this can be closed?

Flags: needinfo?(mstange.moz)

Yup, this is fixed by bug 1696504.

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(mstange.moz)
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch

... which got backed out.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1696504
No longer depends on: 1696513
Target Milestone: 96 Branch → ---

(In reply to Markus Stange [:mstange] from comment #11)

... which got backed out.

Bug 1696504 landed again in 102.

Assignee: mstange.moz → mh+mozilla
Status: REOPENED → RESOLVED
Closed: 3 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch

mstange: This appears to still be broken. When running locally:

if (@available(macOS 10.15, *)) {
  printf("This should detect macOS 10.15\n");
}
if (@available(macOS 10.16, *)) {
  printf("This should detect macOS 10.16\n");
}
if (@available(macOS 11.0, *)) {
  printf("This should detect macOS 11.0\n");
}
 0:11.30 GECKO(57247) This should detect macOS 10.15
 0:11.30 GECKO(57247) This should detect macOS 10.16

My macOS version: 12.2.1 (21D62)
Processor: 2.4 GHz 8-Core Intel Core i9

I can work around this for implementing Bug 1782574, but there is a small amount of risk using raw values rather than named variables from macOS header files.

Status: RESOLVED → REOPENED
Flags: needinfo?(mstange.moz)
Resolution: FIXED → ---

This is surprising to me. Since you're building with the 11.1 SDK (i.e. 11 or newer), I'd have expected @available(macOS 11.0, *) to work.
Stephen, can you take a look?

Flags: needinfo?(mstange.moz) → needinfo?(spohl.mozilla.bugs)

(In reply to Greg Tatum [:gregtatum] from comment #13)

mstange: This appears to still be broken. When running locally:

if (@available(macOS 10.15, *)) {
  printf("This should detect macOS 10.15\n");
}
if (@available(macOS 10.16, *)) {
  printf("This should detect macOS 10.16\n");
}
if (@available(macOS 11.0, *)) {
  printf("This should detect macOS 11.0\n");
}
 0:11.30 GECKO(57247) This should detect macOS 10.15
 0:11.30 GECKO(57247) This should detect macOS 10.16

My macOS version: 12.2.1 (21D62)
Processor: 2.4 GHz 8-Core Intel Core i9

I can work around this for implementing Bug 1782574, but there is a small amount of risk using raw values rather than named variables from macOS header files.

I'm unable to reproduce this. All three available checks get handled correctly and all three printf statements get executed, as expected. Greg, can you check your .mozconfig file to see if you have a path to a specific SDK set?

Flags: needinfo?(spohl.mozilla.bugs) → needinfo?(gtatum)

(In reply to Stephen A Pohl [:spohl] from comment #15)

I'm unable to reproduce this. All three available checks get handled correctly and all three printf statements get executed, as expected. Greg, can you check your .mozconfig file to see if you have a path to a specific SDK set?

I missed your comment in #macdev that said that you didn't have this set in .mozconfig (or rather, that it was set to an 11.1 SDK). Does removing that line from the .mozconfig change anything for you?

Flags: needinfo?(gtatum)
Flags: needinfo?(gtatum)

Ah nice, removing the SDK override actually fixed it! I got the 11.0 check working.

This should detect macOS 10.15
This should detect macOS 10.16
This should detect macOS 11.0
Flags: needinfo?(gtatum)

Great!

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.