error with umlauts in directory name

Alexander Belchenko bialix at ukr.net
Fri Feb 9 15:03:19 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel пишет:
> Alexander Belchenko wrote:
> ....
> 
>> I think for this particular purpose with temp file switch to non-unicode
>> path is safe on windows. Because you are using the same path to write
>> file, to run editor with this file and then read file back. In Windows
>> it's mean instead of unicode path we will use ANSI path that it safe
>> solution for invoking external editor via subprocess.
>>
> 
> But I can very easily create a filename on Windows that is not OEM/ANSI
> safe. Like for me on an English windows, I can create an Arabic
> filename. (حبيب). That will never work in ANSI. So I really think we
> need the osutils.getcwd()

You're probably right. But I don't know how subprocess works with
unicode arguments for editor? When I run any program from console
it's arguments is always plain strings in bzrlib.user_encoding.
And it seems that majority of programs expect plain strings in their
argv list, not unicode strings. Because typical main() function
looks like:

int main (int argc, /* Number of strings in array argv */
 char *argv[],       /* Array of command-line argument strings */
 char **envp )       /* Array of environment variable strings */
{
...

See http://msdn2.microsoft.com/en-us/library/ms880421.aspx

I think unicode args leads to unpredictable behaviour in external program.
But I never check what happens if I try to run editor with unicode params.


> 
> Otherwise it would try to create the file in
> C:/branch/?????/bzr_log.XXXX

I think in this case we fails somehow or other.
If we want to be paranoid we need to check os.getcwd()
for absence of ???? otherwise fall back to create temp file in
temp dir (as bzr did very long time ago).

> 
> Now, we may have a problem spawning an editor to edit that file. But I'm
> quite positive that it is trivially easy to create filenames that cannot
> be represented on Windows OEM pages.
> 
> I don't want to overkill our design. So it might be sufficient to just
> use '.'.
> 
> I would like to add some of the other cleanups, though.

Alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFzI03zYr338mxwCURAk0KAJ9W2YI87PnpnN2ATSYFynBi8kvQbwCfckzg
irAq/9+bDwESbDYXEIL9a88=
=onMj
-----END PGP SIGNATURE-----




More information about the bazaar mailing list