Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v6.7.1 #1028

Merged
merged 17 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ steps:
plugins:
artifacts#v1.3.0:
download: ["features/fixtures/macos/output/macOSTestApp.zip"]
upload: ["macOSTestApp.log"]
commands:
- bundle install
- bundle exec maze-runner
Expand All @@ -103,6 +104,7 @@ steps:
plugins:
artifacts#v1.3.0:
download: ["features/fixtures/macos/output/macOSTestApp.zip"]
upload: ["macOSTestApp.log"]
commands:
- bundle install
- bundle exec maze-runner
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipeline.quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ steps:
plugins:
artifacts#v1.3.0:
download: ["features/fixtures/macos/output/macOSTestApp.zip"]
upload: ["macOSTestApp.log"]
commands:
- bundle install
- bundle exec maze-runner
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ steps:
plugins:
artifacts#v1.3.0:
download: ["features/fixtures/macos/output/macOSTestApp.zip"]
upload: ["macOSTestApp.log"]
commands:
- bundle install
- bundle exec maze-runner
Expand Down
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
author: "Bugsnag Inc"
clean: false # avoid deleting docs/.git
framework_root: "Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.7.0/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.7.1/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa"
hide_documentation_coverage: true
module: "Bugsnag"
module_version: "6.7.0"
module_version: "6.7.1"
objc: true
output: "docs"
readme: "README.md"
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "6.7.0",
"version": "6.7.1",
"summary": "The Bugsnag crash reporting framework for Apple platforms.",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v6.7.0"
"tag": "v6.7.1"
},
"frameworks": [
"Foundation",
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (void)startNewSessionWithAutoCaptureValue:(BOOL)isAutoCaptured {
BugsnagApp *app = [BugsnagApp appWithDictionary:@{@"system": systemInfo}
config:self.config
codeBundleId:self.codeBundleId];
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:@{@"system": systemInfo}];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:@{@"system": systemInfo}];
[device appendRuntimeInfo:self.extraRuntimeInfo];

BugsnagSession *newSession = [[BugsnagSession alloc] initWithId:[[NSUUID UUID] UUIDString]
Expand Down
6 changes: 5 additions & 1 deletion Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,10 @@ - (void)metadataChanged:(BugsnagMetadata *)metadata {
*/
#if BSG_PLATFORM_IOS
- (void)batteryChanged:(NSNotification *)notification {
if (![UIDEVICE currentDevice]) {
return;
}

NSNumber *batteryLevel = @([UIDEVICE currentDevice].batteryLevel);
BOOL charging = [UIDEVICE currentDevice].batteryState == UIDeviceBatteryStateCharging ||
[UIDEVICE currentDevice].batteryState == UIDeviceBatteryStateFull;
Expand Down Expand Up @@ -1163,7 +1167,7 @@ - (BugsnagAppWithState *)generateAppWithState:(NSDictionary *)systemInfo {
}

- (BugsnagDeviceWithState *)generateDeviceWithState:(NSDictionary *)systemInfo {
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:@{@"system": systemInfo}];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:@{@"system": systemInfo}];
device.time = [NSDate date]; // default to current time for handled errors
[device appendRuntimeInfo:self.extraRuntimeInfo];
device.orientation = _lastOrientation;
Expand Down
37 changes: 23 additions & 14 deletions Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,25 +371,34 @@ + (NSDictionary *)systemInfo {
#ifdef __clang_version__
sysInfo[@BSG_KSSystemField_ClangVersion] = @__clang_version__;
#endif
#if BSG_HAS_UIDEVICE
sysInfo[@BSG_KSSystemField_SystemName] = [UIDEVICE currentDevice].systemName;
sysInfo[@BSG_KSSystemField_SystemVersion] = [UIDEVICE currentDevice].systemVersion;
#else
#if TARGET_OS_IOS
// Note: This does not match UIDevice.currentDevice.systemName for versions
// prior to (and some versions of) iOS 9 where the systemName was reported
// as "iPhone OS". UIDevice gets its data from MobileGestalt which is a
// private API. /System/Library/CoreServices/SystemVersion.plist contains
// the information we need but will contain the macOS information when
// running on the Simulator.
sysInfo[@BSG_KSSystemField_SystemName] = @"iOS";
#elif TARGET_OS_OSX
sysInfo[@BSG_KSSystemField_SystemName] = @"Mac OS";
#elif TARGET_OS_TV
sysInfo[@BSG_KSSystemField_SystemName] = @"tvOS";
#endif
NSOperatingSystemVersion version =
[NSProcessInfo processInfo].operatingSystemVersion;
NSString *systemVersion;
if (version.patchVersion == 0) {
systemVersion =
[NSString stringWithFormat:@"%ld.%ld", version.majorVersion,
version.minorVersion];
[NSString stringWithFormat:@"%ld.%ld",
(long)version.majorVersion, (long)version.minorVersion];
} else {
systemVersion = [NSString
stringWithFormat:@"%ld.%ld.%ld", version.majorVersion,
version.minorVersion, version.patchVersion];
systemVersion =
[NSString stringWithFormat:@"%ld.%ld.%ld",
(long)version.majorVersion, (long)version.minorVersion,
(long)version.patchVersion];
}
sysInfo[@BSG_KSSystemField_SystemVersion] = systemVersion;
#endif

if ([self isSimulatorBuild]) {
NSString *model = [NSProcessInfo processInfo]
.environment[BSGKeySimulatorModelId];
Expand Down Expand Up @@ -429,11 +438,11 @@ + (NSDictionary *)systemInfo {
sysInfo[@BSG_KSSystemField_DeviceAppHash] = [self deviceAndAppHash];
sysInfo[@BSG_KSSystemField_BuildType] = [BSG_KSSystemInfo buildType];

NSDictionary *memory = @{
@BSG_KSSystemField_Size: [self int64Sysctl:@"hw.memsize"],
@BSG_KSCrashField_Usable: @(bsg_ksmachusableMemory())
sysInfo[@(BSG_KSSystemField_Memory)] = @{
@(BSG_KSCrashField_Free): @(bsg_ksmachfreeMemory()),
@(BSG_KSCrashField_Usable): @(bsg_ksmachusableMemory()),
@(BSG_KSSystemField_Size): [self int64Sysctl:@"hw.memsize"]
};
sysInfo[@BSG_KSSystemField_Memory] = memory;

NSDictionary *statsInfo = [[BSG_KSCrash sharedInstance] captureAppStats];
sysInfo[@BSG_KSCrashField_AppStats] = statsInfo;
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <mach/mach_time.h>
#include <sys/sysctl.h>

#if __has_include(<os/proc.h>) && TARGET_OS_IPHONE
#if __has_include(<os/proc.h>) && TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST
#include <os/proc.h>
#endif

Expand Down Expand Up @@ -71,7 +71,7 @@ static pthread_t bsg_g_topThread;
static size_t (* get_available_memory)(void);

static void bsg_ksmachfreeMemory_init(void) {
#if __has_include(<os/proc.h>) && TARGET_OS_IPHONE
#if __has_include(<os/proc.h>) && TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST
if (__builtin_available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
// Only use `os_proc_available_memory` if it appears to be working.
// 0 is returned if the calling process is not an app or is running
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagDevice+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface BugsnagDevice ()

+ (instancetype)deviceWithDictionary:(NSDictionary *)event;
+ (instancetype)deviceWithKSCrashReport:(NSDictionary *)event;

+ (instancetype)deserializeFromJson:(NSDictionary *)json;

Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ + (BugsnagDevice *)deserializeFromJson:(NSDictionary *)json {
return device;
}

+ (BugsnagDevice *)deviceWithDictionary:(NSDictionary *)event {
+ (BugsnagDevice *)deviceWithKSCrashReport:(NSDictionary *)event {
BugsnagDevice *device = [BugsnagDevice new];
[self populateFields:device dictionary:event];
return device;
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagDeviceWithState+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN

+ (instancetype)deviceFromJson:(NSDictionary *)json;

+ (instancetype)deviceWithDictionary:(NSDictionary *)event;
+ (instancetype)deviceWithKSCrashReport:(NSDictionary *)event;

+ (instancetype)deviceWithOomData:(NSDictionary *)data;

Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/Payload/BugsnagDeviceWithState.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ + (BugsnagDeviceWithState *)deviceWithOomData:(NSDictionary *)data {
return device;
}

+ (BugsnagDeviceWithState *)deviceWithDictionary:(NSDictionary *)event {
+ (BugsnagDeviceWithState *)deviceWithKSCrashReport:(NSDictionary *)event {
BugsnagDeviceWithState *device = [BugsnagDeviceWithState new];
[self populateFields:device dictionary:event];
device.orientation = [event valueForKeyPath:@"user.state.deviceState.orientation"];
device.freeMemory = [event valueForKeyPath:@"system.memory.free"] ?: [event valueForKeyPath:@"system.memory.usable"];
device.freeMemory = [event valueForKeyPath:@"system.memory.free"];
device.freeDisk = BSGDeviceFreeSpace(NSCachesDirectory);

NSString *val = [event valueForKeyPath:@"report.timestamp"];
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ - (instancetype)initWithKSCrashData:(NSDictionary *)event {
}
}
NSString *deviceAppHash = [event valueForKeyPath:@"system.device_app_hash"];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:event];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:event];
BugsnagUser *user = [self parseUser:event deviceAppHash:deviceAppHash deviceId:device.id];
BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithDictionaryRepresentation:[event valueForKeyPath:@"user.config"]];
BugsnagAppWithState *app = [BugsnagAppWithState appWithDictionary:event config:config codeBundleId:self.codeBundleId];
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
#else
self.name = @"Bugsnag Objective-C";
#endif
self.version = @"6.7.0";
self.version = @"6.7.1";
self.url = @"https://github.com/bugsnag/bugsnag-cocoa";
self.dependencies = [NSMutableArray new];
}
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
=========

## 6.7.1 (2021-03-10)

### Bug fixes

* Fix `os_proc_available_memory` runtime link error on Mac Catalyst.
[#1025](https://github.com/bugsnag/bugsnag-cocoa/pull/1025)

* Fix missing `osName` and `osVersion` for errors reported from app extensions that do not link against UIKit.
[#1022](https://github.com/bugsnag/bugsnag-cocoa/pull/1022)

* Fix incorrect `freeMemory` for errors reported via `notify()`
[#1021](https://github.com/bugsnag/bugsnag-cocoa/pull/1021)

## 6.7.0 (2021-03-03)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.7.0</string>
<string>6.7.1</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ GEM
kramdown (~> 2.0)
liferaft (0.0.6)
mini_portile2 (2.5.0)
minitest (5.14.3)
minitest (5.14.4)
molinillo (0.6.6)
multi_json (1.15.0)
multi_test (0.1.2)
Expand Down
22 changes: 14 additions & 8 deletions Tests/BugsnagDeviceTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

#import <XCTest/XCTest.h>
#import "BugsnagConfiguration.h"
#import "BugsnagDeviceWithState+Private.h"

#import "BSG_KSSystemInfo.h"
#import "BugsnagDevice+Private.h"
#import "BugsnagTestConstants.h"
#import "BugsnagDeviceWithState+Private.h"

@interface BugsnagDeviceTest : XCTestCase
@property NSDictionary *data;
Expand Down Expand Up @@ -49,7 +49,7 @@ - (void)setUp {
}

- (void)testDevice {
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data];

// verify stateless fields
XCTAssertTrue(device.jailbroken);
Expand All @@ -69,7 +69,7 @@ - (void)testDevice {
}

- (void)testDeviceWithState {
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:self.data];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:self.data];

// verify stateless fields
XCTAssertTrue(device.jailbroken);
Expand Down Expand Up @@ -98,8 +98,14 @@ - (void)testDeviceWithState {
XCTAssertEqualObjects([formatter dateFromString:@"2014-12-02T01:56:13Z"], device.time);
}

- (void)testDeviceWithRealSystemInfo {
NSDictionary *systemInfo = [BSG_KSSystemInfo systemInfo];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:@{@"system": systemInfo}];
XCTAssertLessThan(device.freeMemory.unsignedLongLongValue, device.totalMemory.unsignedLongLongValue);
}

- (void)testDeviceToDict {
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data];
device.locale = @"en-US";
NSDictionary *dict = [device toDictionary];

Expand All @@ -122,7 +128,7 @@ - (void)testDeviceToDict {
}

- (void)testDeviceWithStateToDict {
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:self.data];
BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:self.data];
device.locale = @"en-US";
NSDictionary *dict = [device toDictionary];

Expand Down Expand Up @@ -185,7 +191,7 @@ - (void)testDeviceFreeSpaceShouldBeNilWhenFailsToRetrieveIt {
}

- (void)testDeviceRuntimeInfoAppended {
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data];
XCTAssertEqual(2, [device.runtimeVersions count]);
XCTAssertEqualObjects(@"14B25", device.runtimeVersions[@"osBuild"]);
XCTAssertEqualObjects(@"10.0.0 (clang-1000.11.45.5)", device.runtimeVersions[@"clangVersion"]);
Expand Down
2 changes: 1 addition & 1 deletion Tests/BugsnagSessionTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (BugsnagDevice *)generateDevice {
}
}
};
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:deviceData];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:deviceData];
device.locale = @"en-US";
return device;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/BugsnagSessionTrackingPayloadTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ - (BugsnagDevice *)generateDevice {
}
}
};
BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:deviceData];
BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:deviceData];
device.locale = @"en-US";
return device;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>6.7.0</string>
<string>6.7.1</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.7.0
6.7.1
Loading