)]}'
{"oslo_rootwrap/filters.py":[{"author":{"_account_id":24791,"name":"Maciej Jozefczyk","email":"jeicam.pl@gmail.com","username":"maciej.jozefczyk"},"change_message_id":"f2e923292bdff6f9dce1b8f6fe5c89bcfba0ff50","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_c473cce4","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"updated":"2020-02-21 08:05:36.000000000","message":"This shouldn\u0027t be raised even while file not found. I think its not necessary. I tested it on py3:\n\n\u003e\u003e\u003e path\u003d\u0027/var/log/foo\u0027\n\u003e\u003e\u003e os.path.isfile(path)\nFalse\n\u003e\u003e\u003e os.path.isabs(path)\nTrue","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"c48aafedbdebf573149f2504fdf7f1b215694a56","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_487b6af2","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_05d31bd6","updated":"2020-02-21 15:42:36.000000000","message":"\u003e Thanks for the analysis. Please, read my comment at 11:43. I was\n \u003e wrong reading the logs. isbas() do not call realpath(), this method\n \u003e is called in the generator raising the exception [1]\n \u003e \n \u003e [1] https://github.com/openstack/oslo.rootwrap/blob/master/oslo_rootwrap/filters.py#L131\n\nYes thanks I seen.","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"c48aafedbdebf573149f2504fdf7f1b215694a56","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_687e66e3","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_4554b356","updated":"2020-02-21 15:42:36.000000000","message":"\u003e Maciej is right: isabs() does not raise this exception. When I\n \u003e reviewed the logs, I saw this:\n \u003e \n \u003e File \"/home/zuul/src/opendev.org/openstack/neutron/.tox/dsvm-functional/lib/python3.6/site-packages/oslo_rootwrap/filters.py\",\n \u003e line 133, in \u003cgenexpr\u003e\n \u003e if os.path.isabs(arg)  # arguments specifying abs paths\n \u003e File \"/usr/lib/python3.6/posixpath.py\", line 396, in realpath\n \u003e return abspath(path)\n \u003e File \"/usr/lib/python3.6/posixpath.py\", line 383, in abspath\n \u003e cwd \u003d os.getcwd()\n \u003e FileNotFoundError: [Errno 2] No such file or directory\n \u003e \n \u003e \n \u003e But is realpath(), called in this generator, the one raising the\n \u003e exception.\n \u003e \n \u003e I\u0027ll push a new PS.\n\nOkay thanks for your feedback.","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e18b3e969f566fc5d16ffd8e4c4189a26aa60c71","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_4554b356","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_4de85f7d","updated":"2020-02-21 15:09:50.000000000","message":"Maciej is right: isabs() does not raise this exception. When I reviewed the logs, I saw this:\n\nFile \"/home/zuul/src/opendev.org/openstack/neutron/.tox/dsvm-functional/lib/python3.6/site-packages/oslo_rootwrap/filters.py\", line 133, in \u003cgenexpr\u003e\n    if os.path.isabs(arg)  # arguments specifying abs paths\n  File \"/usr/lib/python3.6/posixpath.py\", line 396, in realpath\n    return abspath(path)\n  File \"/usr/lib/python3.6/posixpath.py\", line 383, in abspath\n    cwd \u003d os.getcwd()\nFileNotFoundError: [Errno 2] No such file or directory\n\n\nBut is realpath(), called in this generator, the one raising the exception.\n\nI\u0027ll push a new PS.","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"5ae6d8528efc11af76040e1d7e18bd5e753e3197","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_982d3392","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_6d2c3bb1","updated":"2020-02-21 12:29:54.000000000","message":"This is how it\u0027s work (will raise the exception):\n\n```\npython3.6 -c \"import os;os.mkdir(\u0027/tmp/boom\u0027);print(os.listdir(\u0027/tmp\u0027));os.chdir(\u0027/tmp/boom\u0027);print(os.getcwd());os.rmdir(\u0027/tmp/boom\u0027);print(os.listdir(\u0027/tmp\u0027));print(os.getcwd())\"\n```\n\nBut weird things if I use `isabs` then it return False:\n\n```\npython3.6 -c \"import os;os.mkdir(\u0027/tmp/boom\u0027);print(os.listdir(\u0027/tmp\u0027));os.chdir(\u0027/tmp/boom\u0027);print(os.getcwd());os.rmdir(\u0027/tmp/boom\u0027);print(os.listdir(\u0027/tmp\u0027));print(os.path.isabs(\u0027boom\u0027))\"     \n```","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e18b3e969f566fc5d16ffd8e4c4189a26aa60c71","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_05d31bd6","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_7832b7c1","updated":"2020-02-21 15:09:50.000000000","message":"Thanks for the analysis. Please, read my comment at 11:43. I was wrong reading the logs. isbas() do not call realpath(), this method is called in the generator raising the exception [1]\n\n[1] https://github.com/openstack/oslo.rootwrap/blob/master/oslo_rootwrap/filters.py#L131","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"735b01d5cafed6bd3a43f0a6515dea5ad1fbd247","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_4de85f7d","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_8da417a6","updated":"2020-02-21 12:03:28.000000000","message":"I\u0027m confused... So realpath() does raise this in some condition (deleting the directory as u suggested) but isabs() do not, is that it ?\n\nIf so, Maciej\u0027s comment is still valid. Or, does isabs() invokes realpath() underneath which raises this exception?","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"e49fa983a3841521e120d7f785c1f52a751b771b","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_7832b7c1","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_982d3392","updated":"2020-02-21 12:41:41.000000000","message":"`isabs` just return if arg `startswith` start with file separator [1]\n\n[1] https://github.com/python/cpython/blob/3.6/Lib/posixpath.py#L64,L68\n\nI don\u0027t seen where isabs call realpath I suppose through the call to `fspath` [2][3]\n\n[2] https://github.com/python/cpython/blob/3.6/Lib/posixpath.py#L66\n[3] https://github.com/python/cpython/blob/master/Lib/os.py#L1012","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"29b817a125881425099a1a6063a02f7055f51ada","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_8da417a6","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_c473cce4","updated":"2020-02-21 11:43:13.000000000","message":"Ahhh no, this is not the method affected. That was a mistake reading the logs. The method which can raise this exception is os.path.realpath() [1]\n\nTry to execute this with the debugger enabled.\npath\u003d\u0027log/fistro\u0027\nprint(os.path.realpath(path))\n\nIf you call this script from a directory (not the one containing this script) and before executing the second line you delete this directory, then you\u0027ll have this exception.\n\nThis is easier with Pycharm, for example, where you can define the working directory (what os.getcwd() will return) and you can set breaking points.\n\n\n[1] https://github.com/openstack/oslo.rootwrap/blob/master/oslo_rootwrap/filters.py#L131","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"7a4da12fb7ebed9e8cd261d3bbb466e9976b0d41","unresolved":false,"context_lines":[{"line_number":37,"context_line":"    \"\"\"Return if a path is absolute.\"\"\""},{"line_number":38,"context_line":"    try:"},{"line_number":39,"context_line":"        return os.path.isabs(path)"},{"line_number":40,"context_line":"    except FileNotFoundError:"},{"line_number":41,"context_line":"        return False"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_6d2c3bb1","line":40,"range":{"start_line":40,"start_character":11,"end_line":40,"end_character":28},"in_reply_to":"3fa7e38b_c473cce4","updated":"2020-02-21 12:18:00.000000000","message":"Caution, it\u0027s never raised because you should test the following scenario:\n\n- create a dir;\n- move to this one during execution;\n- delete this dir during execution;\n- try to call isabs\n\nThe issue here is that if the path is not an absolute path then posixpath try to return one by calling `os.getcwd()` [3] to join to arg given and return a normalized path.\n\nYou tested the following scenario which is not the same of the previously described and fixed by Rodolfo:\n\n```\n# (`/tmp/boom` doesn\u0027t exist locally)\npython2.7 -c \"import os;print(os.path.isabs(\u0027/tmp/boom\u0027))\"\nTrue\npython3.6 -c \"import os;print(os.path.isabs(\u0027/tmp/boom\u0027))\"\nTrue\npython3.7 -c \"import os;print(os.path.isabs(\u0027/tmp/boom\u0027))\"\nTrue\npython3.8 -c \"import os;print(os.path.isabs(\u0027/tmp/boom\u0027))\"\nTrue\n```\n\nEven by calling the posixpath [2] module directly to emulate the behavior described in [1] I can\u0027t reproduce the issue:\n\n```\npython3.6 -c \"import posixpath;print(posixpath.abspath(\u0027/tmp/boom\u0027))\"\n/tmp/boom\n```\n\nThis work because I don\u0027t remove my current working directory during execution.\n\n[1] http://paste.openstack.org/show/789807/\n[2] https://github.com/python/cpython/blob/3.6/Lib/posixpath.py#L376,L385\n[3] https://github.com/python/cpython/blob/3.6/Lib/posixpath.py#L381","commit_id":"718a3db71c3b1ba02bd5c4b1cea694039964bfa3"}]}
