[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
22/22: cpio: Properly handle Unicode characters in file names.
From: |
guix-commits |
Subject: |
22/22: cpio: Properly handle Unicode characters in file names. |
Date: |
Sat, 25 Feb 2023 14:51:30 -0500 (EST) |
apteryx pushed a commit to branch master
in repository guix.
commit 61f691fdfb4846e123e6423ee192142a35bd114d
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Thu Feb 23 23:37:32 2023 -0500
cpio: Properly handle Unicode characters in file names.
Fixes <https://issues.guix.gnu.org/61722>.
* guix/cpio.scm (file->cpio-header): Compute the file name length in bytes
rather than in
characters.
(file->cpio-header*, special-file->cpio-header*): Likewise.
(write-cpio-archive): Likewise, and write the file name as UTF-8 bytes, not
textually, to avoid encoding it as ISO-8859-1.
---
guix/cpio.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/guix/cpio.scm b/guix/cpio.scm
index d4a7d5f1e0..876f61ea3c 100644
--- a/guix/cpio.scm
+++ b/guix/cpio.scm
@@ -170,7 +170,7 @@ using FILE-NAME as its file name."
#:size (stat:size st)
#:dev (stat:dev st)
#:rdev (stat:rdev st)
- #:name-size (string-length file-name))))
+ #:name-size (string-utf8-length file-name))))
(define* (file->cpio-header* file
#:optional (file-name file)
@@ -182,7 +182,7 @@ produced in a deterministic fashion."
(make-cpio-header #:mode (stat:mode st)
#:nlink (stat:nlink st)
#:size (stat:size st)
- #:name-size (string-length file-name))))
+ #:name-size (string-utf8-length file-name))))
(define* (special-file->cpio-header* file
device-type
@@ -201,7 +201,7 @@ The number of hard links is assumed to be 1."
permission-bits)
#:nlink 1
#:rdev (device-number device-major device-minor)
- #:name-size (string-length file-name)))
+ #:name-size (string-utf8-length file-name)))
(define %trailer
"TRAILER!!!")
@@ -237,7 +237,7 @@ produces with the '-H newc' option."
;; We're padding the header + following file name + trailing zero, and
;; the header is 110 byte long.
- (write-padding (+ 110 1 (string-length file)) port)
+ (write-padding (+ 110 (string-utf8-length file) 1) port)
(case (mode->type (cpio-header-mode header))
((regular)
@@ -246,7 +246,7 @@ produces with the '-H newc' option."
(dump-port input port))))
((symlink)
(let ((target (readlink file)))
- (put-string port target)))
+ (put-bytevector port (string->utf8 target))))
((directory)
#t)
((block-special)
- 08/22: gnu: virglrenderer: Update to 0.7.0., (continued)
- 08/22: gnu: virglrenderer: Update to 0.7.0., guix-commits, 2023/02/25
- 11/22: gnu: spice-vdagent: Update to 0.22.1., guix-commits, 2023/02/25
- 02/22: gnu: spice-gtk: Remove input labels., guix-commits, 2023/02/25
- 15/22: gnu: osinfo-db: Use libsoup 3., guix-commits, 2023/02/25
- 12/22: gnu: usbutils: Update to 015., guix-commits, 2023/02/25
- 10/22: gnu: spice: Update to 0.15.1., guix-commits, 2023/02/25
- 19/22: services: gnome-desktop-service-type: Extend setuid-program-service-type., guix-commits, 2023/02/25
- 05/22: gnu: spice-gtk: Propagate libjpeg-turbo, lz4, opus, and usbredir., guix-commits, 2023/02/25
- 16/22: gnu: gnome-boxes: Update to 43.3., guix-commits, 2023/02/25
- 06/22: gnu: spice-protocol: Update to 0.14.4., guix-commits, 2023/02/25
- 22/22: cpio: Properly handle Unicode characters in file names.,
guix-commits <=