{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/xcbuild/issues/195","repository_url":"https://api.github.com/repos/facebook/xcbuild","labels_url":"https://api.github.com/repos/facebook/xcbuild/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/facebook/xcbuild/issues/195/comments","events_url":"https://api.github.com/repos/facebook/xcbuild/issues/195/events","html_url":"https://github.com/facebook/xcbuild/issues/195","id":189548866,"number":195,"title":"xcbuild: infinite loop when inheriting specifications","user":{"login":"Ktwu","id":470651,"avatar_url":"https://avatars.githubusercontent.com/u/470651?v=3","gravatar_id":"","url":"https://api.github.com/users/Ktwu","html_url":"https://github.com/Ktwu","followers_url":"https://api.github.com/users/Ktwu/followers","following_url":"https://api.github.com/users/Ktwu/following{/other_user}","gists_url":"https://api.github.com/users/Ktwu/gists{/gist_id}","starred_url":"https://api.github.com/users/Ktwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ktwu/subscriptions","organizations_url":"https://api.github.com/users/Ktwu/orgs","repos_url":"https://api.github.com/users/Ktwu/repos","events_url":"https://api.github.com/users/Ktwu/events{/privacy}","received_events_url":"https://api.github.com/users/Ktwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-16T00:32:36Z","updated_at":"2016-11-17T20:36:43Z","closed_at":null,"body":"On Linux, if I run xcbuild without any input, I can get a crash that looks something like:\r\n\r\n(gdb) bt\r\n#0  0x00007ffff7d7013c in pbxspec::Manager::inheritSpecification(std::shared_ptr<pbxspec::PBX::Specification> const&) (this=0x402af0, specification=..., this=<optimized out>)\r\n    at ../xcbuild/Libraries/pbxspec/Sources/Manager.cpp:332\r\n#1  0x00007ffff7d73b9f in pbxspec::Manager::registerDomains(libutil::Filesystem const*, std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > > const&) (this=0x0, filesystem=\r\n    0x7fffffffdcd0, domains=...) at ../xcbuild/Libraries/pbxspec/Sources/Manager.cpp:435\r\n#2  0x00007ffff7f8d553 in pbxbuild::Build::Environment::Default(process::Context const*, libutil::Filesystem const*) (processContext=processContext@entry=0x7fffffffdce0, filesystem=filesystem@entry=0x7fffffffdcd0)\r\n    at ../xcbuild/Libraries/pbxbuild/Sources/Build/Environment.cpp:73\r\n#3  0x00007ffff7fe78ab in xcdriver::BuildAction::Run(process::Context const*, process::Launcher*, libutil::Filesystem*, xcdriver::Options const&) (processContext=processContext@entry=0x7fffffffdce0, processLauncher=processLauncher@entry=0x7fffffffdcf0, filesystem=filesystem@entry=0x7fffffffdcd0, options=...) at ../xcbuild/Libraries/xcdriver/Sources/BuildAction.cpp:152\r\n#4  0x00007ffff7fe4e58 in xcdriver::Driver::Run(process::Context const*, process::Launcher*, libutil::Filesystem*) (processContext=processContext@entry=0x7fffffffdce0, processLauncher=processLauncher@entry=0x7fffffffdcf0, filesystem=filesystem@entry=0x7fffffffdcd0) at ../xcbuild/Libraries/xcdriver/Sources/Driver.cpp:56\r\n#5  0x0000000000400c43 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ../xcbuild/Libraries/xcdriver/Tools/xcbuild.cpp:23\r\n\r\nWhen I enable debug logging, I see repeated ad-nauseum:\r\n\r\ndebug: inheriting my-linux:com.apple.compilers.gcc (Compiler) from my-linux:com.apple.compilers.gcc (Compiler)\r\n\r\nThe relevant .xcspec file contains:\r\n\r\n\t{\r\n\t\tClass = \"PBXCompilerSpecificationGcc\";\r\n\t\tBasedOn = \"default:com.apple.compilers.gcc\";\r\n\t\tType = Compiler;\r\n\t\tName = \"GCC System Version\";\r\n\t\tIdentifier = \"com.apple.compilers.gcc\";\r\n\t\tArchitectures = (\r\n\t\t\tARCHITECTURES\r\n\t\t);\r\n\t},\r\n\r\nSo what looks like is happening is that the inheritance code is looking for whatever default is and defaulting to the current specification.  So it's trying to inherit from itself.\r\n\r\nIf this fix is as simple as I think it is -- basically just checking whether:\r\n\r\nauto base = this->specification(specification->type(), *specification->basedOnIdentifier(), domains);\r\nif (base == specificationTryingToFindBase) ...\r\n\r\nThen let me know and I can upload the fix."},"comment":{"url":"https://api.github.com/repos/facebook/xcbuild/issues/comments/261362176","html_url":"https://github.com/facebook/xcbuild/issues/195#issuecomment-261362176","issue_url":"https://api.github.com/repos/facebook/xcbuild/issues/195","id":261362176,"user":{"login":"grp","id":163390,"avatar_url":"https://avatars.githubusercontent.com/u/163390?v=3","gravatar_id":"","url":"https://api.github.com/users/grp","html_url":"https://github.com/grp","followers_url":"https://api.github.com/users/grp/followers","following_url":"https://api.github.com/users/grp/following{/other_user}","gists_url":"https://api.github.com/users/grp/gists{/gist_id}","starred_url":"https://api.github.com/users/grp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grp/subscriptions","organizations_url":"https://api.github.com/users/grp/orgs","repos_url":"https://api.github.com/users/grp/repos","events_url":"https://api.github.com/users/grp/events{/privacy}","received_events_url":"https://api.github.com/users/grp/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T20:36:43Z","updated_at":"2016-11-17T20:36:43Z","body":"Did it load `com.apple.compilers.gcc.xcspec`?"}}
{"actor":{"display_login":"grp"}}