{"action":"created","issue":{"url":"https://api.github.com/repos/ninja-build/ninja/issues/1497","repository_url":"https://api.github.com/repos/ninja-build/ninja","labels_url":"https://api.github.com/repos/ninja-build/ninja/issues/1497/labels{/name}","comments_url":"https://api.github.com/repos/ninja-build/ninja/issues/1497/comments","events_url":"https://api.github.com/repos/ninja-build/ninja/issues/1497/events","html_url":"https://github.com/ninja-build/ninja/issues/1497","id":381107268,"node_id":"MDU6SXNzdWUzODExMDcyNjg=","number":1497,"title":"Race condition when input file is updated while compiling","user":{"login":"egmontkob","id":5750745,"node_id":"MDQ6VXNlcjU3NTA3NDU=","avatar_url":"https://avatars3.githubusercontent.com/u/5750745?v=4","gravatar_id":"","url":"https://api.github.com/users/egmontkob","html_url":"https://github.com/egmontkob","followers_url":"https://api.github.com/users/egmontkob/followers","following_url":"https://api.github.com/users/egmontkob/following{/other_user}","gists_url":"https://api.github.com/users/egmontkob/gists{/gist_id}","starred_url":"https://api.github.com/users/egmontkob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egmontkob/subscriptions","organizations_url":"https://api.github.com/users/egmontkob/orgs","repos_url":"https://api.github.com/users/egmontkob/repos","events_url":"https://api.github.com/users/egmontkob/events{/privacy}","received_events_url":"https://api.github.com/users/egmontkob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T10:57:28Z","updated_at":"2018-11-15T20:29:49Z","closed_at":null,"author_association":"NONE","body":"I'm new to Meson+Ninja (ninja 1.8.2 on Ubuntu 18.10). As far as I understand, `meson` corresponds roughly to `autotools` and `ninja` to `make`. Please tell me if I'm wrong and this bugreport should be filed elsewhere.\r\n\r\nThis report is the same as the `make` issue at http://savannah.gnu.org/bugs/?46242 (see http://lists.gnu.org/archive/html/bug-make/2015-10/msg00016.html for followup discussions, developer responses).\r\n\r\n---\r\n\r\nThere's an inherent race condition in the way `ninja` handles timestamps. If you save a newer version of a file while `ninja` is running and is just compiling that input file, the change won't be picked up by subsequent runs of `ninja`, and you'll be left with an out-of-date binary.\r\n\r\nSteps to reproduce:\r\n\r\n1. Have some project.\r\n2. Open one of the large source files that takes noticeable time to compile.\r\n3. Edit this file in some valid way (changing the functionality) but do not save it yet.\r\n4. In a terminal, run `ninja` to compile your project.\r\n5. While `ninja` is running, go back to your editor, but keep your eyes on `ninja`'s output.\r\n6. When `ninja` launches that particular `gcc` (or whatever) that compiles this large file, save the new version.\r\n7. Go back to the terminal. `ninja` might have completed by now. If not, you might either – if it has finished processing that file – interrupt it, or wait for it to complete.\r\n8. Execute `ninja` again to catch up with the edits you performed. Wait for it to complete.\r\n9. Launch your app, notice that it does not include your recent changes.\r\n\r\nThe behavior is obvious from the way `ninja` checks the timestamps. The source of the file has an earlier timestamp than the compiled object file, since you saved the file before `gcc` wrote out its output. But these are not corresponding versions. \r\n\r\n---\r\n\r\nPlease see over there in the `make` bugreport and mailing list discussion for further thoughts on this issue."},"comment":{"url":"https://api.github.com/repos/ninja-build/ninja/issues/comments/439179508","html_url":"https://github.com/ninja-build/ninja/issues/1497#issuecomment-439179508","issue_url":"https://api.github.com/repos/ninja-build/ninja/issues/1497","id":439179508,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTE3OTUwOA==","user":{"login":"nico","id":3487,"node_id":"MDQ6VXNlcjM0ODc=","avatar_url":"https://avatars0.githubusercontent.com/u/3487?v=4","gravatar_id":"","url":"https://api.github.com/users/nico","html_url":"https://github.com/nico","followers_url":"https://api.github.com/users/nico/followers","following_url":"https://api.github.com/users/nico/following{/other_user}","gists_url":"https://api.github.com/users/nico/gists{/gist_id}","starred_url":"https://api.github.com/users/nico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nico/subscriptions","organizations_url":"https://api.github.com/users/nico/orgs","repos_url":"https://api.github.com/users/nico/repos","events_url":"https://api.github.com/users/nico/events{/privacy}","received_events_url":"https://api.github.com/users/nico/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T20:29:49Z","updated_at":"2018-11-15T20:29:49Z","author_association":"COLLABORATOR","body":"#1165 fixes this, but I'm not sure we want to merge it."}}
{"actor":{"display_login":"nico"}}