git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW

From
Peter Krefting <peter@softwolves.pp.se>
Date
Oct 29, 2009, 09:01 UTC
Message-ID
<alpine.DEB.2.00.0910290955530.8995@ds9.cixit.se>
In-Reply-To
<1256752900-2615-3-git-send-email-timur@iris-comp.ru>
Hi!
Timur Sufiev:
Show 22 quoted lines
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 6b5b5b2..2a2ebcb 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -2,7 +2,7 @@
> #include "win32.h"
> #include <conio.h>
> #include "../strbuf.h"
> -
> +#include "../io-i18n.h"
> #include <shellapi.h>
>
> static int err_win_to_posix(DWORD winerr)
> @@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)
> 	if (!strcmp(filename, "/dev/null"))
> 		filename = "nul";
>
> -	fd = open(filename, oflags, mode);
> +	fd = open_i18n(filename, oflags, mode);
>
> 	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
> 		DWORD attrs = GetFileAttributes(filename);

Instead of calling the open_i18n() which converts from UTF-8 to a local 8-bit character set, this should probably call a version that converts from UTF-8 to UTF-16 and uses _wopen().

Same thing for fopen_i18n() and _wfopen().

I created a small RFC patch for that that changed parts of the system earlier this year - http://kerneltrap.org/mailarchive/git/2009/3/2/5350814

I did not address readdir() and friends, I'm not sure if they are available in UTF-16 form or if they need to be rewritten using findfirst()/findnext().

-- 
\\// Peter - http://www.softwolves.pp.se/
Previous: Timur SufievNext: Alex Riesen
Message 4 of 6 in “Add IO-wrappers for filenames encoding <local encoding> <-> UTF-8”
  1. 1/3 Add IO-wrappers for filenames encoding <local encoding> <-> UTF-8Timur Sufiev, Oct 28, 2009
  2. 2/3 Use I18N-wrappers everywhere in GitTimur Sufiev, Oct 28, 2009
  3. 3/3 Provide compatibility with MinGWTimur Sufiev, Oct 28, 2009
  4. Peter KreftingOct 29, 2009
  5. Alex RiesenOct 29, 2009
  6. Johannes SixtOct 29, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.