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

Re: Re: Moving a directory into another fails

From
Linus Torvalds <torvalds@osdl.org>
Date
Dec 4, 2006, 20:51 UTC
Message-ID
<Pine.LNX.4.64.0612041246150.3476@woody.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0612041114240.3476@woody.osdl.org>
On Mon, 4 Dec 2006, Linus Torvalds wrote:
> 
> If a filesystem cannot represent that name AS THAT BYTE SEQUENCE then the 
> filesystem is broken. No ifs, buts, maybes about it. I'm sorry, but that's 
> how it is.
Btw, what this means in practice is that when git creates a file with a 
certain sequence of bytes, then 
 (a) readdir had better return _that_ sequence of bytes, or git will see 
     it as somethign else.
 (b) opening it with that same sequence of bytes had better work.

This does not mean that a filesystem may not internally use some other encoding. It just means that if the filesystem - when converting back and forth between the internal encoding and the one it shows to user space - had better convert back to the exact same thing.

Also, note that for most projects, even a broken filesystem doesn't actually matter - it's enough that the filesystem gets the conversions right for the particular set of names in a particular project. So any project that just has 7-bit filenames will obviously never even see any issues at all, even if the filesystem it runs on then does something strange with 8-bit filenames.

This is one reason why UNIX's "everything is a stream of bytes" is so important, and whyprograms should generally work with byte streams, not "wide strings" or similar. It's the only way that you can reliably work across different locales. Use wide strings and locale-specific stuff _only_ for actually showing users something on the tty, for example.

Previous: Linus TorvaldsNext: Shawn Pearce
Message 13 of 24 in “Moving a directory into another fails”
  1. Jon SmirlJul 26, 2006
  2. Nicolas VilzJul 26, 2006
  3. Jon SmirlJul 26, 2006
  4. Nicolas VilzJul 26, 2006
  5. Petr BaudisJul 28, 2006
  6. Stefan PfetzingDec 4, 2006
  7. Jakub NarebskiDec 4, 2006
  8. Johannes SchindelinDec 4, 2006
  9. Jakub NarebskiDec 4, 2006
  10. Johannes SchindelinDec 4, 2006
  11. Jakub NarebskiDec 4, 2006
  12. Linus TorvaldsDec 4, 2006
  13. Linus TorvaldsDec 4, 2006
  14. Shawn PearceDec 4, 2006
  15. Jakub NarebskiDec 4, 2006
  16. Johannes SchindelinDec 4, 2006
  17. Linus TorvaldsDec 4, 2006
  18. Johannes SchindelinDec 5, 2006
  19. Jakub NarebskiDec 5, 2006
  20. filesystem encodings and gitweb tests, was Re: Moving a directory into another failsJohannes Schindelin, Dec 5, 2006
  21. Jakub NarebskiDec 5, 2006
  22. Johannes SchindelinDec 5, 2006
  23. Linus TorvaldsDec 5, 2006
  24. Johannes SchindelinDec 4, 2006

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.