)]}'
{"swift/common/utils.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"7fbb8631bf82633c7a7554703d244d7ec55032b6","unresolved":false,"context_lines":[{"line_number":174,"context_line":"# The values were copied from the Linux 3.x kernel headers."},{"line_number":175,"context_line":"AF_ALG \u003d getattr(socket, \u0027AF_ALG\u0027, 38)"},{"line_number":176,"context_line":"F_SETPIPE_SZ \u003d getattr(fcntl, \u0027F_SETPIPE_SZ\u0027, 1031)"},{"line_number":177,"context_line":"O_TMPFILE \u003d getattr(os, \u0027O_TMPFILE\u0027, 0o20000000 | os.O_DIRECTORY)"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"# Used by the parse_socket_string() function to validate IPv6 addresses"},{"line_number":180,"context_line":"IPV6_RE \u003d re.compile(\"^\\[(?P\u003caddress\u003e.*)\\](:(?P\u003cport\u003e[0-9]+))?$\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_83fa7d72","side":"PARENT","line":177,"updated":"2018-04-11 11:03:38.000000000","message":"OIC. This is.\n\nI checked the value will be 4259840 in my py2 env that is same as os.O_TMPFILE in my py35 env.","commit_id":"bbf5e5c7f3fd46f6474301beaf3885a61e423379"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"7fbb8631bf82633c7a7554703d244d7ec55032b6","unresolved":false,"context_lines":[{"line_number":4404,"context_line":"    hasO_TMPFILE \u003d True"},{"line_number":4405,"context_line":"    fd \u003d None"},{"line_number":4406,"context_line":"    try:"},{"line_number":4407,"context_line":"        fd \u003d os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_TMPFILE)"},{"line_number":4408,"context_line":"    except OSError as e:"},{"line_number":4409,"context_line":"        if e.errno \u003d\u003d errno.EINVAL:"},{"line_number":4410,"context_line":"            hasO_TMPFILE \u003d False"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_63ede9b5","side":"PARENT","line":4407,"range":{"start_line":4407,"start_character":58,"end_line":4407,"end_character":60},"updated":"2018-04-11 11:03:38.000000000","message":"OK. Use O_TMPFILE defined in this module, not from os module.","commit_id":"bbf5e5c7f3fd46f6474301beaf3885a61e423379"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"7fbb8631bf82633c7a7554703d244d7ec55032b6","unresolved":false,"context_lines":[{"line_number":4398,"context_line":"def o_tmpfile_in_path_supported(dirpath):"},{"line_number":4399,"context_line":"    fd \u003d None"},{"line_number":4400,"context_line":"    try:"},{"line_number":4401,"context_line":"        fd \u003d os.open(dirpath, os.O_WRONLY | O_TMPFILE)"},{"line_number":4402,"context_line":"        return True"},{"line_number":4403,"context_line":"    except OSError as e:"},{"line_number":4404,"context_line":"        if e.errno in (errno.EINVAL, errno.EISDIR, errno.EOPNOTSUPP):"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_9afadb72","line":4401,"range":{"start_line":4401,"start_character":21,"end_line":4401,"end_character":29},"updated":"2018-04-11 11:03:38.000000000","message":"Linux man page clearly say that the path is a directory so this looks to go right thing.","commit_id":"b0b3ed03096e800f37eee7826e76029a8a00bbab"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"7fbb8631bf82633c7a7554703d244d7ec55032b6","unresolved":false,"context_lines":[{"line_number":4401,"context_line":"        fd \u003d os.open(dirpath, os.O_WRONLY | O_TMPFILE)"},{"line_number":4402,"context_line":"        return True"},{"line_number":4403,"context_line":"    except OSError as e:"},{"line_number":4404,"context_line":"        if e.errno in (errno.EINVAL, errno.EISDIR, errno.EOPNOTSUPP):"},{"line_number":4405,"context_line":"            return False"},{"line_number":4406,"context_line":"        else:"},{"line_number":4407,"context_line":"            raise Exception(\"Error on \u0027%(path)s\u0027 while checking \""}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_1a7a4bf0","line":4404,"updated":"2018-04-11 11:03:38.000000000","message":"Looking at the man page[1], can ENOENT occur as well if the dirpath does not exist?\n\n1: http://man7.org/linux/man-pages/man2/open.2.html","commit_id":"b0b3ed03096e800f37eee7826e76029a8a00bbab"},{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"9293e0c93db460dec6692a7d2fca33dc75a3a3a1","unresolved":false,"context_lines":[{"line_number":4401,"context_line":"        fd \u003d os.open(dirpath, os.O_WRONLY | O_TMPFILE)"},{"line_number":4402,"context_line":"        return True"},{"line_number":4403,"context_line":"    except OSError as e:"},{"line_number":4404,"context_line":"        if e.errno in (errno.EINVAL, errno.EISDIR, errno.EOPNOTSUPP):"},{"line_number":4405,"context_line":"            return False"},{"line_number":4406,"context_line":"        else:"},{"line_number":4407,"context_line":"            raise Exception(\"Error on \u0027%(path)s\u0027 while checking \""}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_772b5594","line":4404,"in_reply_to":"bf659307_1a7a4bf0","updated":"2018-04-11 17:02:13.000000000","message":"Yes, open() can return ENOENT, but dirpath here is the result of tempfile.gettempdir(), and that directory is guaranteed to exist.\n\nhttps://docs.python.org/2/library/tempfile.html#tempfile.tempdir","commit_id":"b0b3ed03096e800f37eee7826e76029a8a00bbab"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"24e022a4844151e7a93eea6d7eb9c64b76a94605","unresolved":false,"context_lines":[{"line_number":4401,"context_line":"        fd \u003d os.open(dirpath, os.O_WRONLY | O_TMPFILE)"},{"line_number":4402,"context_line":"        return True"},{"line_number":4403,"context_line":"    except OSError as e:"},{"line_number":4404,"context_line":"        if e.errno in (errno.EINVAL, errno.EISDIR, errno.EOPNOTSUPP):"},{"line_number":4405,"context_line":"            return False"},{"line_number":4406,"context_line":"        else:"},{"line_number":4407,"context_line":"            raise Exception(\"Error on \u0027%(path)s\u0027 while checking \""}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_b03fb323","line":4404,"in_reply_to":"bf659307_772b5594","updated":"2018-04-11 18:35:27.000000000","message":"Further, I think we could *still* get ENOENT even if O_TMPFILE *is* supported, just based on\n\n\u003e ENOENT -- O_CREAT is not set and the named file does not exist.\n\nSo ENOENT doesn\u0027t really tell us much either way -- our best option is to just raise. A little experimentation:\n\n \u003e\u003e\u003e import os\n \u003e\u003e\u003e O_TMPFILE \u003d getattr(os, \u0027O_TMPFILE\u0027, 0o20000000 | os.O_DIRECTORY)\n \u003e\u003e\u003e def t(d):\n ...     fd \u003d None\n ...     try:\n ...         fd \u003d os.open(d, os.O_WRONLY | O_TMPFILE)\n ...     finally:\n ...         if fd is not None:\n ...             os.close(fd)\n ...\n \u003e\u003e\u003e t(\u0027/mnt/swift-disk/tmp\u0027)\n Traceback (most recent call last):\n   File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n   File \"\u003cstdin\u003e\", line 4, in t\n OSError: [Errno 95] Operation not supported: \u0027/mnt/swift-disk/tmp\u0027\n \u003e\u003e\u003e t(\u0027/mnt/swift-disk/tmpadsf\u0027)\n Traceback (most recent call last):\n   File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n   File \"\u003cstdin\u003e\", line 4, in t\n OSError: [Errno 2] No such file or directory: \u0027/mnt/swift-disk/tmpadsf\u0027\n \u003e\u003e\u003e t(\u0027/tmp\u0027)\n \u003e\u003e\u003e t(\u0027/tmpasdf\u0027)\n Traceback (most recent call last):\n   File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n   File \"\u003cstdin\u003e\", line 4, in t\n OSError: [Errno 2] No such file or directory: \u0027/tmpasdf\u0027","commit_id":"b0b3ed03096e800f37eee7826e76029a8a00bbab"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"4c96e3316e445fa0e3bfa9127086e0108efa7941","unresolved":false,"context_lines":[{"line_number":4401,"context_line":"        fd \u003d os.open(dirpath, os.O_WRONLY | O_TMPFILE)"},{"line_number":4402,"context_line":"        return True"},{"line_number":4403,"context_line":"    except OSError as e:"},{"line_number":4404,"context_line":"        if e.errno in (errno.EINVAL, errno.EISDIR, errno.EOPNOTSUPP):"},{"line_number":4405,"context_line":"            return False"},{"line_number":4406,"context_line":"        else:"},{"line_number":4407,"context_line":"            raise Exception(\"Error on \u0027%(path)s\u0027 while checking \""}],"source_content_type":"text/x-python","patch_set":1,"id":"bf659307_bf5c5419","line":4404,"in_reply_to":"bf659307_b03fb323","updated":"2018-04-12 06:24:42.000000000","message":"Make sense.\n\nI\u0027m realizing we would just move this into o_tmpfile_in_tmpdir_supported because it just calls o_tmpfile_in_path_supported with gettmpdir() but this version is not broken on anything so it\u0027s ok with the current version to get it merged.","commit_id":"b0b3ed03096e800f37eee7826e76029a8a00bbab"}]}
