summaryrefslogtreecommitdiff
path: root/guix/nar.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-02-21 20:17:29 +0100
committerLudovic Courtès <ludo@gnu.org>2014-02-21 23:49:53 +0100
commit96c7448f370227c9777a6acdac4ac65f1884fb43 (patch)
treeba30d68dfab3493adcd3c5cc96cd774d818de180 /guix/nar.scm
parent36bbbbd150f75c2a6dab2473643c3723e606e41d (diff)
downloadgnu-guix-96c7448f370227c9777a6acdac4ac65f1884fb43.tar
gnu-guix-96c7448f370227c9777a6acdac4ac65f1884fb43.tar.gz
nar: Produce archives with files sorted in C collation order.
* guix/nar.scm (write-file) <directory>: Pass 'string<?' as the second argument to 'scandir'. * tests/nar.scm ("write-file puts file in C locale collation order"): New test.
Diffstat (limited to 'guix/nar.scm')
-rw-r--r--guix/nar.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/nar.scm b/guix/nar.scm
index 9ba6e4ce2c..5bf174554c 100644
--- a/guix/nar.scm
+++ b/guix/nar.scm
@@ -177,8 +177,13 @@ sub-directories of FILE as needed."
((directory)
(write-string "type" p)
(write-string "directory" p)
- (let ((entries (remove (cut member <> '("." ".."))
- (scandir f))))
+ (let* ((select? (negate (cut member <> '("." ".."))))
+
+ ;; 'scandir' defaults to 'string-locale<?' to sort files, but
+ ;; this happens to be case-insensitive (at least in 'en_US'
+ ;; locale on libc 2.18.) Conversely, we want files to be
+ ;; sorted in a case-sensitive fashion.
+ (entries (scandir f select? string<?)))
(for-each (lambda (e)
(let ((f (string-append f "/" e)))
(write-string "entry" p)