From a7d686086ca59beaf8df2793f42be8ec814e4167 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Tue, 18 Jun 2019 10:48:04 -0400 Subject: [PATCH] Mac upload_system_symbols: make dump of /Library/QuickTime optional /Library/QuickTime is gone in 10.15b2 19A487l. Change-Id: I927350a9cb383b93e8b18aef5f36c77bb67fede1 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1663996 Reviewed-by: Robert Sesek --- .../upload_system_symbols.go | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/tools/mac/upload_system_symbols/upload_system_symbols.go b/src/tools/mac/upload_system_symbols/upload_system_symbols.go index 0ff01a00..05a7764a 100644 --- a/src/tools/mac/upload_system_symbols/upload_system_symbols.go +++ b/src/tools/mac/upload_system_symbols/upload_system_symbols.go @@ -69,13 +69,18 @@ var ( var ( // pathsToScan are the subpaths in the systemRoot that should be scanned for shared libraries. pathsToScan = []string{ - "/Library/QuickTime", "/System/Library/Components", "/System/Library/Frameworks", "/System/Library/PrivateFrameworks", "/usr/lib", } + // optionalPathsToScan is just like pathsToScan, but the paths are permitted to be absent. + optionalPathsToScan = []string{ + // Gone in 10.15. + "/Library/QuickTime", + } + // uploadServers are the list of servers to which symbols should be uploaded. uploadServers = []string{ "https://clients2.google.com/cr/symbol", @@ -322,7 +327,11 @@ func findLibsInRoot(root string, dq *DumpQueue) { fq.WorkerPool = StartWorkerPool(12, fq.worker) for _, p := range pathsToScan { - fq.findLibsInPath(path.Join(root, p)) + fq.findLibsInPath(path.Join(root, p), true) + } + + for _, p := range optionalPathsToScan { + fq.findLibsInPath(path.Join(root, p), false) } close(fq.queue) @@ -332,9 +341,12 @@ func findLibsInRoot(root string, dq *DumpQueue) { // findLibsInPath recursively walks the directory tree, sending file paths to // test for being Mach-O to the findQueue. -func (fq *findQueue) findLibsInPath(loc string) { +func (fq *findQueue) findLibsInPath(loc string, mustExist bool) { d, err := os.Open(loc) if err != nil { + if !mustExist && os.IsNotExist(err) { + return + } log.Fatalf("Could not open %s: %v", loc, err) } defer d.Close() @@ -348,7 +360,7 @@ func (fq *findQueue) findLibsInPath(loc string) { for _, fi := range fis { fp := path.Join(loc, fi.Name()) if fi.IsDir() { - fq.findLibsInPath(fp) + fq.findLibsInPath(fp, true) continue } else if fi.Mode()&os.ModeSymlink != 0 { continue