-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Comparing changes
Open a pull request
base repository: NixOS/nix
base: 6f3244ce4517
head repository: NixOS/nix
compare: 2f8ee4578f07
- 10 commits
- 8 files changed
- 4 contributors
Commits on Apr 29, 2020
-
builtins.readFile: do not truncate content
This closes #3026 by allowing `builtins.readFile` to read a file with a wrongly reported file size, for example, files in `/proc` may report a file size of 0. Reading file in `/proc` is not a good enough motivation, however I do think it just makes nix more robust by allowing more file to be read. Especially, I do considerer the previous behavior to be dangerous because nix was previously reading truncated files. Examples of file system which incorrectly report file size may be network file system or dynamic file system (for performance reason, a dynamic file system such as FUSE may generate the content of the file on demand). ``` nix-repl> builtins.readFile "/proc/version" "" ``` With this commit: ``` nix-repl> builtins.readFile "/proc/version" "Linux version 5.6.7 (nixbld@localhost) (gcc version 9.3.0 (GCC)) #1-NixOS SMP Thu Apr 23 08:38:27 UTC 2020\n" ``` Here is a summary of the behavior changes: - If the reported size is smaller, previous implementation was silently returning a truncated file content. The new implementation is returning the correct file content. - If a file had a bigger reported file size, previous implementation was failing with an exception, but the new implementation is returning the correct file content. This change of behavior is coherent with this pull request. Open questions - The behavior is unchanged for correctly reported file size, however performances may vary because it uses the more complex sink interface. Considering that sink is used a lot, I don't think this impacts the performance a lot. - `builtins.readFile` on an infinite file, such as `/dev/random` may fill the memory. - it does not support adding file to store, such as `${/proc/version}`.
Configuration menu - View commit details
-
Copy full SHA for 5a34a47 - Browse repository at this point
Copy the full SHA 5a34a47View commit details -
Remove the
drain
argument fromreadFile
Now it is always `drain` (see previous commit).
Configuration menu - View commit details
-
Copy full SHA for 7afcb5a - Browse repository at this point
Copy the full SHA 7afcb5aView commit details -
When used with `readFile`, we have a pretty good heuristic of the file size, so `reserve` this in the `string`. This will save some allocation / copy when the string is growing.
Configuration menu - View commit details
-
Copy full SHA for 2e5be2a - Browse repository at this point
Copy the full SHA 2e5be2aView commit details
Commits on May 1, 2020
-
Improve help-message for nix-repl
* Remove obsolete `printHelp` function * Add an example to demonstrate how to list all available commands within the REPL
Configuration menu - View commit details
-
Copy full SHA for 2aeb874 - Browse repository at this point
Copy the full SHA 2aeb874View commit details
Commits on May 4, 2020
-
nix auto-gc: use fragment size
Jude Taylor committedMay 4, 2020 Configuration menu - View commit details
-
Copy full SHA for e2fc575 - Browse repository at this point
Copy the full SHA e2fc575View commit details
Commits on May 6, 2020
-
Configuration menu - View commit details
-
Copy full SHA for fd49112 - Browse repository at this point
Copy the full SHA fd49112View commit details -
Merge pull request #3562 from pikajude/master
Use fragment size for autoGC capacity calculation
Configuration menu - View commit details
-
Copy full SHA for 02c5914 - Browse repository at this point
Copy the full SHA 02c5914View commit details -
Merge pull request #3557 from Ma27/nix-repl-help
Improve help-message for nix-repl
Configuration menu - View commit details
-
Copy full SHA for 272c4ba - Browse repository at this point
Copy the full SHA 272c4baView commit details -
Merge pull request #3546 from guibou/nix_readfile_on_0_sized_files
builtins.readFile: do not truncate content
Configuration menu - View commit details
-
Copy full SHA for 74a1bfd - Browse repository at this point
Copy the full SHA 74a1bfdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f8ee45 - Browse repository at this point
Copy the full SHA 2f8ee45View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 6f3244ce4517...2f8ee4578f07