{"action":"opened","issue":{"url":"https://api.github.com/repos/getnikola/nikola/issues/1672","labels_url":"https://api.github.com/repos/getnikola/nikola/issues/1672/labels{/name}","comments_url":"https://api.github.com/repos/getnikola/nikola/issues/1672/comments","events_url":"https://api.github.com/repos/getnikola/nikola/issues/1672/events","html_url":"https://github.com/getnikola/nikola/issues/1672","id":71934224,"number":1672,"title":"Race condition building site from a clean state when there is a page with a `post-list` directive.","user":{"login":"chaghi","id":6282941,"avatar_url":"https://avatars.githubusercontent.com/u/6282941?v=3","gravatar_id":"","url":"https://api.github.com/users/chaghi","html_url":"https://github.com/chaghi","followers_url":"https://api.github.com/users/chaghi/followers","following_url":"https://api.github.com/users/chaghi/following{/other_user}","gists_url":"https://api.github.com/users/chaghi/gists{/gist_id}","starred_url":"https://api.github.com/users/chaghi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaghi/subscriptions","organizations_url":"https://api.github.com/users/chaghi/orgs","repos_url":"https://api.github.com/users/chaghi/repos","events_url":"https://api.github.com/users/chaghi/events{/privacy}","received_events_url":"https://api.github.com/users/chaghi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-29T17:17:01Z","updated_at":"2015-04-29T17:17:01Z","closed_at":null,"body":"When a site has a page with a `post-list` directive, (re)building the site from a clean state generates a `FileNotFoundError` exception similar to this:\r\n```console\r\n(nikola)mariano@arya:~/Devel/test$ nikola build\r\nScanning posts....done!\r\n.  render_listings:output/listings/index.html\r\n.  render_sources:output/stories/first-page.rst\r\n.  render_sources:output/posts/first-post.rst\r\n.  render_tags:output/categories/index.html\r\n.  render_tags:output/assets/js/tag_cloud_data.json\r\n.  render_posts:cache/stories/first-page.html\r\nTraceback (most recent call last):\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/doit_cmd.py\", line 121, in run\r\n    return command.parse_execute(args)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/cmd_base.py\", line 84, in parse_execute\r\n    return self.execute(params, args)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/cmd_base.py\", line 278, in execute\r\n    return self._execute(**exec_params)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/cmd_run.py\", line 215, in _execute\r\n    return runner.run_all(self.control.task_dispatcher())\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/runner.py\", line 237, in run_all\r\n    self.run_tasks(task_dispatcher)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/runner.py\", line 204, in run_tasks\r\n    self.process_task_result(node, catched_excp)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/runner.py\", line 175, in process_task_result\r\n    self.dep_manager.save_success(task)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/dependency.py\", line 413, in save_success\r\n    timestamp = os.path.getmtime(dep)\r\n  File \"/home/mariano/.virtualenvs/nikola/lib/python3.4/genericpath.py\", line 55, in getmtime\r\n    return os.stat(filename).st_mtime\r\nFileNotFoundError: [Errno 2] No such file or directory: 'cache/posts/first-post.html'\r\n```\r\n\r\n*Steps to reproduce*\r\n\r\n* `nikola init test` (accept all the defaults)\r\n* add a post\r\n* add a page with a `post-list` directive\r\n* `nikola build`\r\n\r\n*Expected result*\r\n\r\n* The site should be built for the first time.\r\n\r\n*Actual result*\r\n\r\n* `FileNotFoundError` exception.\r\n\r\n*Remarks*\r\n\r\n* The error is always triggered when building from a clean state, i.e., first build, or first build after a `clean`/`forget`, or a manual delete of `cache/`, `output/` and `.doit.db`.\r\n* Subsequent builds after the error run ok, until the state is cleared again.\r\n\r\n*Known workaround*\r\n\r\nSetting the date of the page with the `post-list` to a past value (like `1970-01-01 00:00:00`) avoids the race condition. This was suggested in the mailing-list: https://groups.google.com/d/msg/nikola-discuss/ULhZ3mIG0yk/3740m_9ItLYJ\r\n\r\n*Environment*\r\n\r\nUbuntu 14.04, Python 3.4.0, Nikola 7.3.1.1, with the following packages:\r\n```console\r\nblinker (1.3)\r\ncertifi (14.5.14)\r\ndocutils (0.12)\r\ndoit (0.27.0)\r\nghp-import (0.4.1)\r\nipython (3.1.0)\r\nJinja2 (2.7.3)\r\njsonschema (2.4.0)\r\nlivereload (2.3.2)\r\nLogbook (0.9.0)\r\nlxml (3.4.3)\r\nMako (1.0.1)\r\nMarkdown (2.6.2)\r\nMarkupSafe (0.23)\r\nmicawber (0.3.2)\r\nmistune (0.5.1)\r\nnatsort (3.5.6)\r\nNikola (7.3.1.1)\r\nphpserialize (1.3)\r\nPillow (2.8.1)\r\npip (6.1.1)\r\nptyprocess (0.4)\r\npygal (1.7.0)\r\nPygments (2.0.2)\r\npyinotify (0.9.5)\r\nPyphen (0.9.1)\r\nPyRSS2Gen (1.1)\r\npython-dateutil (2.4.2)\r\npyzmq (14.6.0)\r\nrequests (2.6.2)\r\nsetuptools (15.1)\r\nsix (1.9.0)\r\nsmartypants (1.8.6)\r\nterminado (0.5)\r\ntornado (4.1)\r\ntypogrify (2.0.7)\r\nUnidecode (0.4.17)\r\nwebassets (0.10.1)\r\nYapsy (1.11.23)\r\n```"}}