aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Grey <lgrey@chromium.org>2024-02-13 17:09:01 -0500
committerLeonard Grey <lgrey@chromium.org>2024-02-13 22:45:12 +0000
commit55036ddccf04ba096c2d133f80a7baf9c0b91e1d (patch)
treeb98e79428c67158022ec6848751a0a9c69a951f9
parent6b871f4bd8b6e28191289d19e8ef074a11648a18 (diff)
downloadgoogle-breakpad-55036ddccf04ba096c2d133f80a7baf9c0b91e1d.tar.gz
Mac: Installer extraction bug fixes
- Mark `RawImagePatch` weak - Fix reversed condition in disk image unmounting - Ensure source files are closed when copying - Use 0-based indexing when determining installer OS version Bug: None Change-Id: I015f2b0d9c88a5ec128822d55c974e22723a1a6e Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5291963 Reviewed-by: Mark Mentovai <mark@chromium.org>
-rw-r--r--src/tools/mac/upload_system_symbols/extract.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/mac/upload_system_symbols/extract.go b/src/tools/mac/upload_system_symbols/extract.go
index acd674ef..f991e3aa 100644
--- a/src/tools/mac/upload_system_symbols/extract.go
+++ b/src/tools/mac/upload_system_symbols/extract.go
@@ -17,7 +17,7 @@ package main
// uint32_t verbose;
// } RawImage;
//
-// extern int32_t RawImagePatch(RawImage *);
+// extern int32_t RawImagePatch(RawImage *) __attribute__((weak));
import "C"
import (
@@ -125,7 +125,7 @@ func (e *Extractor) vlog(format string, args ...interface{}) {
func (e *Extractor) mountDMG(dmgPath string, mountpoint string) error {
cmd := exec.Command("hdiutil", "attach", dmgPath, "-mountpoint", mountpoint, "-quiet", "-nobrowse", "-readonly")
err := cmd.Run()
- if err != nil {
+ if err == nil {
e.dmgMountPaths = append(e.dmgMountPaths, mountpoint)
}
return err
@@ -299,7 +299,7 @@ func (e *installAssistantExtractor) expandInstaller(installerPath string, destin
// hasCryptexes returns true if the installer containing the plist at `plistPath` is for
// macOS version 13 or higher, and accordingly stores dyld shared caches inside cryptexes.
func (e *installAssistantExtractor) hasCryptexes(plistPath string) (bool, error) {
- print_cmd := "print :Assets:1:OSVersion"
+ print_cmd := "print :Assets:0:OSVersion"
result, err := exec.Command("PlistBuddy", "-c", print_cmd, plistPath).Output()
if err != nil {
return false, fmt.Errorf("couldn't read OS version from %s: %v", plistPath, err)
@@ -502,6 +502,7 @@ func copyFile(src, dst string) error {
if err != nil {
return err
}
+ defer reader.Close()
if _, err := io.Copy(w, reader); err != nil {
return err
}