guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile can't find a chinese named file


From: Marko Rauhamaa
Subject: Re: guile can't find a chinese named file
Date: Mon, 30 Jan 2017 18:33:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

David Kastrup <address@hidden>:

> Marko Rauhamaa <address@hidden> writes:
>> address@hidden (Ludovic Courtès):
>>> Guile assumes its command-line arguments are UTF-8-encoded and
>>> decodes them accordingly.
>>
>> I'm afraid that choice (which Python made, as well) was a bad one
>> because Linux doesn't guarantee UTF-8 purity.
>
> Have you looked at the error messages? They are all perfect UTF-8. As
> was the command line locale.

I was responding to Ludovic.

> Apparently, Guile can open the file just fine, and it sees the command
> line just fine as encoded in utf-8.

My problem is when it is not valid UTF-8.

> So I really, really, really suggest that before people post their
> theories that they actually bother cross-checking them with Guile.

Well, execute these commands from bash:

   $ touch $'\xee'
   $ touch xyz
   $ ls -a
   .  ..  ''$'\356'  xyz

Then, execute this guile program:

========================================================================
(let ((dir (opendir ".")))
  (let loop ()
    (let ((filename (readdir dir)))
      (if (not (eof-object? filename))
          (begin
            (if (access? filename R_OK)
                (format #t "~s\n" filename))
            (loop))))))
========================================================================

It outputs:

   ".."
   "."
   "xyz"

skipping a file. This is a security risk. Files like these appear easily
when extracting zip files, for example.


Marko



reply via email to

[Prev in Thread] Current Thread [Next in Thread]