[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #63495] File operations fail in the presence of non-UTF-8 pathnames
From: |
Taylor R. Campbell |
Subject: |
[bug #63495] File operations fail in the presence of non-UTF-8 pathnames |
Date: |
Fri, 9 Dec 2022 10:27:04 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?63495>
Summary: File operations fail in the presence of non-UTF-8
pathnames
Project: MIT/GNU Scheme
Submitter: riastradh
Submitted: Fri 09 Dec 2022 03:27:02 PM UTC
Category: runtime
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Suboptimal behavior
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Keywords:
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 09 Dec 2022 03:27:02 PM UTC By: Taylor R. Campbell <riastradh>
% touch "$(printf 'h\351llo')" # héllo, encoded in ISO-8859-1
% ls | hexdump -C
1. 68 e9 6c 6c 6f 0a
|h.llo.|
00000006
(directory-read ".")
;Ill-formed UTF-8 sequence: #u8(233 108 108 111)
(define the-file-name
(let ((v (make-vector-8b 5)))
(vector-8b-set! v 0 #x68)
(vector-8b-set! v 1 #xe9)
(vector-8b-set! v 2 #x6c)
(vector-8b-set! v 3 #x6c)
(vector-8b-set! v 4 #x6f)
v))
;Value: the-file-name
(string-from-primitive the-file-name)
;Ill-formed UTF-8 sequence: #u8(233 108 108 111)
(string-for-primitive the-file-name)
;Value: #u8(104 195 169 108 108 111)
(call-with-input-file the-file-name (lambda (port) 'ok))
;The primitive new-file-open-input-channel, while executing the open system
call, received the error: No such file or directory.
Is there any way to get at this file in MIT Scheme now? Is it intentional
that file system operations will raise errors when confronted with such file
names? Should string-from-primitive only do utf8->string if the input is
valid UTF-8? Should string-for-primitive preserve legacy strings instead of
re-encoding them as UTF-8?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63495>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #63495] File operations fail in the presence of non-UTF-8 pathnames,
Taylor R. Campbell <=