)]}'
{"third_party/cppnix/src/libutil/util.cc":[{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"5cf6fdf6f13ad7ee72cb61aed1c06af7b682c913","unresolved":true,"context_lines":[{"line_number":348,"context_line":"void writeFile(AutoCloseFD \u0026 fd, const std::string\u0026 s, mode_t mode)"},{"line_number":349,"context_line":"{"},{"line_number":350,"context_line":"    assert(fd);"},{"line_number":351,"context_line":"    writeFull(fd.get(), s);"},{"line_number":352,"context_line":"}"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"void writeFileAndSync(const Path \u0026 path, const std::string\u0026 s, mode_t mode)"}],"source_content_type":"text/x-c","patch_set":1,"id":"9f916c77_8579f18e","line":351,"updated":"2025-11-16 14:05:13.000000000","message":"Why isn\u0027t the fd closed in here, but in the wrapping function? Is the calling function entitled to keep using the fd? A previous specifcally started closing the fd here to “propagate exceptions”, so I\u0027m confused why it\u0027s being reverted here…\n(https://github.com/tvlfyi/nix/pull/5/commits/305d2e5a58cd1b10ecd4386a99c7bd4f907da7c6#r2174742759)","commit_id":"c3524af079efcc739a37d767635ad23fdbcda4bc"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"b227c755d7374bbd8a0738b5728bf1014fc95144","unresolved":true,"context_lines":[{"line_number":359,"context_line":"            throw SysError(\"opening file \u0027%1%\u0027\", path);"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"        writeFile(fd, s, mode);"},{"line_number":362,"context_line":"        fd.fsync();"},{"line_number":363,"context_line":"        /* Close explicitly to ensure that exceptions are propagated. */"},{"line_number":364,"context_line":"        fd.close();"},{"line_number":365,"context_line":"    }"}],"source_content_type":"text/x-c","patch_set":1,"id":"9c6040e3_2f88bf1e","line":362,"updated":"2025-11-16 14:18:52.000000000","message":"couldn\u0027t closeForWrite be used here?\n(https://github.com/tvlfyi/nix/pull/5/commits/305d2e5a58cd1b10ecd4386a99c7bd4f907da7c6#r2174746226)","commit_id":"c3524af079efcc739a37d767635ad23fdbcda4bc"},{"author":{"_account_id":1000066,"name":"Adam Joseph","display_name":"amjoseph","email":"adam@westernsemico.com","username":"amjoseph"},"change_message_id":"fbd552806ef0491ee5663e6e330d92861ac7bfb5","unresolved":true,"context_lines":[{"line_number":339,"context_line":"    if (!fd)"},{"line_number":340,"context_line":"        throw SysError(format(\"opening file \u0027%1%\u0027\") % path);"},{"line_number":341,"context_line":""},{"line_number":342,"context_line":"    writeFile(fd, s, mode);"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    /* Close explicitly to propagate the exceptions. */"},{"line_number":345,"context_line":"    fd.close();"}],"source_content_type":"text/x-c","patch_set":5,"id":"71523610_41189ae3","line":342,"range":{"start_line":342,"start_character":4,"end_line":342,"end_character":27},"updated":"2026-01-17 03:41:36.000000000","message":"Why was this changed from `writeFull(fd.get(), s)`?\n\n(note: gerrit\u0027s diff here is a bit misleading)","commit_id":"e21953270ad5f1338254b45fa6fc55a77068ddb3"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"0fe9b7c5475549c6d78025294a9dcca70398942d","unresolved":true,"context_lines":[{"line_number":339,"context_line":"    if (!fd)"},{"line_number":340,"context_line":"        throw SysError(format(\"opening file \u0027%1%\u0027\") % path);"},{"line_number":341,"context_line":""},{"line_number":342,"context_line":"    writeFile(fd, s, mode);"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    /* Close explicitly to propagate the exceptions. */"},{"line_number":345,"context_line":"    fd.close();"}],"source_content_type":"text/x-c","patch_set":5,"id":"97115cd1_372eb7f3","line":342,"range":{"start_line":342,"start_character":4,"end_line":342,"end_character":27},"in_reply_to":"71523610_41189ae3","updated":"2026-01-18 16:07:59.000000000","message":"If I\u0027m not mistaken, this just dispatches to the newly introduced variant of `writeFile(AutoCloseFD \u0026, const std::string\u0026, mode_t)` which does just that.\n\nI.e. this just \"recursively\" dispatches instead of duplicating the relevant code and shouldn\u0027t change anything. Or am I missing something?","commit_id":"e21953270ad5f1338254b45fa6fc55a77068ddb3"},{"author":{"_account_id":1000066,"name":"Adam Joseph","display_name":"amjoseph","email":"adam@westernsemico.com","username":"amjoseph"},"change_message_id":"fbd552806ef0491ee5663e6e330d92861ac7bfb5","unresolved":true,"context_lines":[{"line_number":354,"context_line":"void writeFileAndSync(const Path \u0026 path, const std::string\u0026 s, mode_t mode)"},{"line_number":355,"context_line":"{"},{"line_number":356,"context_line":"    {"},{"line_number":357,"context_line":"        AutoCloseFD fd{open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, mode)};"},{"line_number":358,"context_line":"        if (!fd)"},{"line_number":359,"context_line":"            throw SysError(\"opening file \u0027%1%\u0027\", path);"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"        writeFile(fd, s, mode);"},{"line_number":362,"context_line":"        fd.fsync();"},{"line_number":363,"context_line":"        /* Close explicitly to ensure that exceptions are propagated. */"},{"line_number":364,"context_line":"        fd.close();"},{"line_number":365,"context_line":"    }"}],"source_content_type":"text/x-c","patch_set":5,"id":"7e37cc8c_1a5bc498","line":362,"range":{"start_line":357,"start_character":1,"end_line":362,"end_character":19},"updated":"2026-01-17 03:41:36.000000000","message":"This looks like a copy-and-paste of the body of `writeFile(Path,string,mode_t)` -- why not call that function instead of copy-and-pasting its body here?","commit_id":"e21953270ad5f1338254b45fa6fc55a77068ddb3"},{"author":{"_account_id":1000034,"name":"sterni","email":"sternenseemann@systemli.org","username":"sterni"},"change_message_id":"0fe9b7c5475549c6d78025294a9dcca70398942d","unresolved":true,"context_lines":[{"line_number":354,"context_line":"void writeFileAndSync(const Path \u0026 path, const std::string\u0026 s, mode_t mode)"},{"line_number":355,"context_line":"{"},{"line_number":356,"context_line":"    {"},{"line_number":357,"context_line":"        AutoCloseFD fd{open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, mode)};"},{"line_number":358,"context_line":"        if (!fd)"},{"line_number":359,"context_line":"            throw SysError(\"opening file \u0027%1%\u0027\", path);"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"        writeFile(fd, s, mode);"},{"line_number":362,"context_line":"        fd.fsync();"},{"line_number":363,"context_line":"        /* Close explicitly to ensure that exceptions are propagated. */"},{"line_number":364,"context_line":"        fd.close();"},{"line_number":365,"context_line":"    }"}],"source_content_type":"text/x-c","patch_set":5,"id":"815fe977_cf1c92b9","line":362,"range":{"start_line":357,"start_character":1,"end_line":362,"end_character":19},"in_reply_to":"7e37cc8c_1a5bc498","updated":"2026-01-18 16:07:59.000000000","message":"`writeFile(Path,string,mode_t)` immediately closes the `fd`, so we would not be able to call `fsync()` here, I think.","commit_id":"e21953270ad5f1338254b45fa6fc55a77068ddb3"}]}
