(Opening this on behalf of @brenoguim who did all the heavy lifting of creating a reduced test)
We're seeing an issue when using fmt::print
on Ubuntu 14.04 that does not happen on equivalent CentOS/RHEL, here's the snippet:
#include <cassert> #include <fcntl.h> #include <fmt/core.h> int main() { auto name = "/tmp/some_file"; // Remove old file and create new one system(fmt::format("rm {}", name).c_str()); system(fmt::format("touch {}", name).c_str()); // Open file descriptor int fd = open(name, O_WRONLY | O_RDONLY); assert(fd != -1); // Associate FILE with file descriptor auto file = fdopen(fd, "w"); assert(file); // Write a lot of data for (int i = 0; i < 20001; ++i) { fmt::print(file, "{}\n", i); // this fails // fmt::println(file, "{}", i); // this works } // Close and expect it to flush, so the last line should be 20000 fclose(file); // Print last lines and show that last chunk of file is missing system(fmt::format("tail {}", name).c_str()); }
Basically, it should print up to 20000, but on Ubuntu it stops at 19600. A few things we know:
fmt::println
fixes the issue, as shared in the snippet above.needs_flush
to return true
fixes the issue tooRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4