)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"66e551454e20f9327c9f44634345932f8e7e4424","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Rajath Agasthya \u003crajathagasthya@gmail.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-07-16 12:05:27 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add method to compute a file\u0027s checksum to fileutils"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I1b76ee1876771e7965fd5704ab6281318f36e810"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"df3967d1_8649738c","line":9,"range":{"start_line":7,"start_character":0,"end_line":9,"end_character":52},"updated":"2017-08-01 11:38:05.000000000","message":"Can you add more information: what\u0027s the current implements in projects and potential consuming project.","commit_id":"db81d3eb5bb40d0dc9e857023c8a3bc86f62b8c5"}],"oslo_utils/fileutils.py":[{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"66e551454e20f9327c9f44634345932f8e7e4424","unresolved":false,"context_lines":[{"line_number":114,"context_line":"     at once. Default is 65536 bytes or 64KB"},{"line_number":115,"context_line":"    :return: Hex digest string of the checksum"},{"line_number":116,"context_line":"    \"\"\""},{"line_number":117,"context_line":"    checksum \u003d hashlib.sha256()"},{"line_number":118,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":119,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":120,"context_line":"            checksum.update(chunk)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df3967d1_06034311","line":117,"range":{"start_line":117,"start_character":23,"end_line":117,"end_character":29},"updated":"2017-08-01 11:38:05.000000000","message":"Do we need pass algorithm name as argument to fit other case?","commit_id":"db81d3eb5bb40d0dc9e857023c8a3bc86f62b8c5"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"fbf3ae5114ebf2a522761f3d154391d1da8e6e3e","unresolved":false,"context_lines":[{"line_number":114,"context_line":"     at once. Default is 65536 bytes or 64KB"},{"line_number":115,"context_line":"    :return: Hex digest string of the checksum"},{"line_number":116,"context_line":"    \"\"\""},{"line_number":117,"context_line":"    checksum \u003d hashlib.sha256()"},{"line_number":118,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":119,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":120,"context_line":"            checksum.update(chunk)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df3967d1_403ec5da","line":117,"range":{"start_line":117,"start_character":23,"end_line":117,"end_character":29},"in_reply_to":"df3967d1_06034311","updated":"2017-08-01 18:09:42.000000000","message":"I\u0027m actually not sure if users really care if they use sha256 or md5 or others for checksum computation, but I\u0027m open to suggestions. I wanted to make this only md5 since that\u0027s the faster than sha256 and it has an impact if you pass a large file, but bandit flags if I use md5. md5 is what is used elsewhere in OpenStack too like glance and glance_store.","commit_id":"db81d3eb5bb40d0dc9e857023c8a3bc86f62b8c5"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"4a46d565696b8d9a1c78c3055af0f3993d7210be","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using sha256()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":2,"id":"df3967d1_1f9c4168","line":109,"range":{"start_line":109,"start_character":52,"end_line":109,"end_character":54},"updated":"2017-08-04 02:21:26.000000000","message":"suggest add parameter like algorithm　with default value like \u0027sha256\u0027. then caller can choose the algorithm. Need check the value of algorithm in [1].\n\n\n[1]https://docs.python.org/3/library/hashlib.html#hash-algorithms","commit_id":"3470c04165c706e2a6828f4d533296ec9ff381d5"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"d3a307a7d0abccdfa895ee62b05ec989ecbcc2c2","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using sha256()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":2,"id":"df3967d1_6a95ad86","line":109,"range":{"start_line":109,"start_character":52,"end_line":109,"end_character":54},"in_reply_to":"df3967d1_1f9c4168","updated":"2017-08-04 20:14:49.000000000","message":"Good idea.","commit_id":"3470c04165c706e2a6828f4d533296ec9ff381d5"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"4a46d565696b8d9a1c78c3055af0f3993d7210be","unresolved":false,"context_lines":[{"line_number":117,"context_line":"    checksum \u003d hashlib.sha256()"},{"line_number":118,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":119,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":120,"context_line":"            checksum.update(chunk)"},{"line_number":121,"context_line":"    return checksum.hexdigest()"}],"source_content_type":"text/x-python","patch_set":2,"id":"df3967d1_ff717d45","line":120,"range":{"start_line":120,"start_character":0,"end_line":120,"end_character":34},"updated":"2017-08-04 02:21:26.000000000","message":"suggest to give other greenthread a chance to run with\n        time.sleep(0)","commit_id":"3470c04165c706e2a6828f4d533296ec9ff381d5"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"f73329a0af64f470ed0580a2c88b2f9c84be6723","unresolved":false,"context_lines":[{"line_number":117,"context_line":"    checksum \u003d hashlib.sha256()"},{"line_number":118,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":119,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":120,"context_line":"            checksum.update(chunk)"},{"line_number":121,"context_line":"    return checksum.hexdigest()"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf3e73b7_6a18dbd2","line":120,"range":{"start_line":120,"start_character":0,"end_line":120,"end_character":34},"in_reply_to":"df3967d1_4ae54937","updated":"2017-08-05 04:04:10.000000000","message":"please see https://github.com/openstack/nova/blob/master/doc/source/reference/threading.rst#yielding-the-thread-in-long-running-tasks","commit_id":"3470c04165c706e2a6828f4d533296ec9ff381d5"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"d3a307a7d0abccdfa895ee62b05ec989ecbcc2c2","unresolved":false,"context_lines":[{"line_number":117,"context_line":"    checksum \u003d hashlib.sha256()"},{"line_number":118,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":119,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":120,"context_line":"            checksum.update(chunk)"},{"line_number":121,"context_line":"    return checksum.hexdigest()"}],"source_content_type":"text/x-python","patch_set":2,"id":"df3967d1_4ae54937","line":120,"range":{"start_line":120,"start_character":0,"end_line":120,"end_character":34},"in_reply_to":"df3967d1_ff717d45","updated":"2017-08-04 20:14:49.000000000","message":"Could you expand a little bit on this? Why do we need time.sleep(0)? Thanks.","commit_id":"3470c04165c706e2a6828f4d533296ec9ff381d5"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"518ae76fdd95a8413298f2030c2ba428d5f9e0a6","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"},{"line_number":130,"context_line":"            checksum.update(chunk)"},{"line_number":131,"context_line":"            # Context switch to give other threads a chance to run."},{"line_number":132,"context_line":"            time.sleep(0)"},{"line_number":133,"context_line":"    return checksum.hexdigest()"}],"source_content_type":"text/x-python","patch_set":4,"id":"bf57530f_98e6a116","line":132,"updated":"2017-09-20 19:03:23.000000000","message":"The read() call should be enough to let eventlet change contexts, since it\u0027s doing I/O.","commit_id":"34e23b4d24a22c4a2f5fc42864769340b30b8695"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"0ea1c7ada8843f81f539a181a646b8f651076b73","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027md5\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_5a2c6501","line":109,"range":{"start_line":109,"start_character":64,"end_line":109,"end_character":69},"updated":"2017-10-12 16:17:13.000000000","message":"I wonder if we should default to something else.  We had a conversation at the PTG that discussed how any reference to md5 in a codebase can be a headache because it triggers automated security warnings.  It might be better to default to a more secure algorithm and allow individual projects to decide if they want to use something insecure.\n\nBasically I\u0027d like to provide a \"safe\" default and make the choice to use an \"unsafe\" algorithm explicit.","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"32b4e49877f47c8d0b34431ac05a904e455114ab","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027md5\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_a8e78112","line":109,"range":{"start_line":109,"start_character":64,"end_line":109,"end_character":69},"in_reply_to":"5f4e5783_200f388a","updated":"2017-10-13 04:21:57.000000000","message":"Isn\u0027t sha1 \"insecure\" too following https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html? In fact, Bandit already flags sha1: https://github.com/openstack/bandit/blob/master/bandit/blacklists/calls.py#L64\n\nMy first patch had sha256 as default, I changed it to md5 since it was used across a few projects. What do you think about using that sha256? Or would you prefer not to have a default at all?","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"a2875fde0c00f8788800a8021a88457a2fe8ed28","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027md5\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_200f388a","line":109,"range":{"start_line":109,"start_character":64,"end_line":109,"end_character":69},"in_reply_to":"5f4e5783_5a2c6501","updated":"2017-10-12 17:31:14.000000000","message":"We should absolutely *not* default to md5. We have some efforts going on elsewhere to move off of md5 as a default for the reasons Ben points out. I would prefer we default to sha1 or not have a default and let the application choose.","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"52f7fbfaad591fb6808dec481a5e99686568b173","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    return path"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027md5\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_0f8c4934","line":109,"range":{"start_line":109,"start_character":64,"end_line":109,"end_character":69},"in_reply_to":"5f4e5783_a8e78112","updated":"2017-10-13 16:01:56.000000000","message":"sha256 seems OK as a default. I\u0027m not sure of the performance differences between that and sha1. I know the security standards restrict the use of md5 and allow sha1, for now.","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"a2875fde0c00f8788800a8021a88457a2fe8ed28","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        checksum \u003d hashlib.new(algorithm)"},{"line_number":122,"context_line":"    except ValueError as e:"},{"line_number":123,"context_line":"        msg \u003d \u0027{0} hash algorithm is either unrecognized or unavailable in \u0027 \\"},{"line_number":124,"context_line":"              \u0027the current python interpreter.\u0027.format(algorithm)"},{"line_number":125,"context_line":"        e.args \u003d (msg,)"},{"line_number":126,"context_line":"        raise"},{"line_number":127,"context_line":"    with open(path, \u0027rb\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_a077a802","line":124,"updated":"2017-10-12 17:31:14.000000000","message":"We don\u0027t need to say \"the current python interpreter\" here in this error. Python is an implementation detail of the stack. Just say that the algorithm is unrecognized.","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"32b4e49877f47c8d0b34431ac05a904e455114ab","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        checksum \u003d hashlib.new(algorithm)"},{"line_number":122,"context_line":"    except ValueError as e:"},{"line_number":123,"context_line":"        msg \u003d \u0027{0} hash algorithm is either unrecognized or unavailable in \u0027 \\"},{"line_number":124,"context_line":"              \u0027the current python interpreter.\u0027.format(algorithm)"},{"line_number":125,"context_line":"        e.args \u003d (msg,)"},{"line_number":126,"context_line":"        raise"},{"line_number":127,"context_line":"    with open(path, \u0027rb\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_c8b99de9","line":124,"in_reply_to":"5f4e5783_a077a802","updated":"2017-10-13 04:21:57.000000000","message":"Done","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"a2875fde0c00f8788800a8021a88457a2fe8ed28","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    except ValueError as e:"},{"line_number":123,"context_line":"        msg \u003d \u0027{0} hash algorithm is either unrecognized or unavailable in \u0027 \\"},{"line_number":124,"context_line":"              \u0027the current python interpreter.\u0027.format(algorithm)"},{"line_number":125,"context_line":"        e.args \u003d (msg,)"},{"line_number":126,"context_line":"        raise"},{"line_number":127,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":128,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_205df879","line":125,"updated":"2017-10-12 17:31:14.000000000","message":"I\u0027m not sure the args attribute of the existing exception object is meant to be modified from the outside like this. It would be better to log a debug message with the original exception and then raise a new ValueError.","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"32b4e49877f47c8d0b34431ac05a904e455114ab","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    except ValueError as e:"},{"line_number":123,"context_line":"        msg \u003d \u0027{0} hash algorithm is either unrecognized or unavailable in \u0027 \\"},{"line_number":124,"context_line":"              \u0027the current python interpreter.\u0027.format(algorithm)"},{"line_number":125,"context_line":"        e.args \u003d (msg,)"},{"line_number":126,"context_line":"        raise"},{"line_number":127,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":128,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_689f495f","line":125,"in_reply_to":"5f4e5783_205df879","updated":"2017-10-13 04:21:57.000000000","message":"Maybe six.raise_from() can be used here (it wouldn\u0027t preserve the previous exception in python 2 though)?","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"52f7fbfaad591fb6808dec481a5e99686568b173","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    except ValueError as e:"},{"line_number":123,"context_line":"        msg \u003d \u0027{0} hash algorithm is either unrecognized or unavailable in \u0027 \\"},{"line_number":124,"context_line":"              \u0027the current python interpreter.\u0027.format(algorithm)"},{"line_number":125,"context_line":"        e.args \u003d (msg,)"},{"line_number":126,"context_line":"        raise"},{"line_number":127,"context_line":"    with open(path, \u0027rb\u0027) as f:"},{"line_number":128,"context_line":"        for chunk in iter(lambda: f.read(read_chunksize), b\u0027\u0027):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f4e5783_8f7f1914","line":125,"in_reply_to":"5f4e5783_689f495f","updated":"2017-10-13 16:01:56.000000000","message":"Is there value to the caller in having the other exception or traceback?","commit_id":"18c8a2ea98b5508fdcd2e7152ed8de9a1725fee0"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"ca2b664aef7f44f01f380636f0c612cb9cd87cb2","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027sha256\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"},{"line_number":113,"context_line":"    :param read_chunksize: Maximum number of bytes to be read from the file"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f4b6375_7696bf40","line":110,"range":{"start_line":110,"start_character":51,"end_line":110,"end_character":56},"updated":"2017-10-25 15:30:44.000000000","message":"This is incorrect.  Probably best to leave off the algorithm entirely here since it\u0027s user configurable.  So just make the summary line \"Compute checksum of a file\u0027s contents\"","commit_id":"13b8a2d7500df6c34ca81ef2cca26e1945f3215d"},{"author":{"_account_id":14758,"name":"Rajath Agasthya","email":"rajagast@cisco.com","username":"rajathagasthya"},"change_message_id":"029407717c1fc25be4db6cd7d22b6681c0505405","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"def compute_file_checksum(path, read_chunksize\u003d65536, algorithm\u003d\u0027sha256\u0027):"},{"line_number":110,"context_line":"    \"\"\"Compute checksum of a file\u0027s contents using md5()."},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    :param path: Path to the file"},{"line_number":113,"context_line":"    :param read_chunksize: Maximum number of bytes to be read from the file"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f4b6375_fc5851fa","line":110,"range":{"start_line":110,"start_character":51,"end_line":110,"end_character":56},"in_reply_to":"3f4b6375_7696bf40","updated":"2017-10-25 15:54:31.000000000","message":"Done","commit_id":"13b8a2d7500df6c34ca81ef2cca26e1945f3215d"}]}
