Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mount on case insensitive filesystems #288

Closed
jbenet opened this issue Nov 9, 2014 · 11 comments
Closed

mount on case insensitive filesystems #288

jbenet opened this issue Nov 9, 2014 · 11 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/fuse Topic fuse

Comments

@jbenet
Copy link
Member

jbenet commented Nov 9, 2014

Some filesystems (like osx's default hfs) are case insensitive... this breaks our b58 string keys when mounting with fuse. Possible solutions

  • use different encoding (argh)
  • use a different mount point to map between encodings /ipfs/b32/...
@whyrusleeping
Copy link
Member

I... I dont... why? A unix based OS with case insensitive paths? I hurt...

@chriscool
Copy link
Contributor

Yeah, there is also the way unicode is handled in hfs. See: http://radsoft.net/rants/20080405,00.shtml
I don't remember what was eventually done in Git about this.

@whyrusleeping
Copy link
Member

@chriscool if you could figure out how git handles it, that would be super cool

@chriscool
Copy link
Contributor

This commit is also interesting:

git/git@76759c7

@chriscool
Copy link
Contributor

It looks like go has good support for unicode normalization:
http://blog.golang.org/normalization

@jbenet
Copy link
Member Author

jbenet commented Nov 11, 2014

Thanks @chriscool all of these are very interesting finds!

@chriscool
Copy link
Contributor

Thanks @jbenet.

By the way, in https://github.com/git/git/blob/master/builtin/init-db.c around line 288 there is:

                /* Check if the filesystem is case-insensitive */
                path[len] = 0;
                strcpy(path + len, "CoNfIg");
                if (!access(path, F_OK))
                        git_config_set("core.ignorecase", "true");
                probe_utf8_pathname_composition(path, len);

and in https://github.com/git/git/blob/master/git-compat-util.h there is:

/* used on Mac OS X */
#ifdef PRECOMPOSE_UNICODE
#include "compat/precompose_utf8.h"
#else
#define precompose_str(in,i_nfd2nfc)
#define precompose_argv(c,v)
#define probe_utf8_pathname_composition(a,b)
#endif

@chriscool
Copy link
Contributor

About the core.ignorecase config variable it is read in config.c into the ignore_case global variable and then in dir.c there is:

/* helper string functions with support for the ignore_case flag */
int strcmp_icase(const char *a, const char *b)
{
        return ignore_case ? strcasecmp(a, b) : strcmp(a, b);
}

int strncmp_icase(const char *a, const char *b, size_t count)
{
        return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count);
}

int fnmatch_icase(const char *pattern, const char *string, int flags)
{
        return wildmatch(pattern, string,
                         flags | (ignore_case ? WM_CASEFOLD : 0),
                         NULL);
}

@jbenet jbenet added kind/bug A bug in existing code (including security flaws) topic/fuse Topic fuse labels Mar 28, 2015
@mitar
Copy link

mitar commented Mar 28, 2016

hfs is case insensitive, but case preserving. You can still store files with different case, you just cannot have two files which have name different only in case.

@Stebalien
Copy link
Member

CIDs fix this as we can use any base we want. Also, we're switching to base32 by default so this will become even less of an issue.

@Stebalien Stebalien mentioned this issue May 26, 2020
77 tasks
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this issue Oct 23, 2021
@aschmahmann aschmahmann mentioned this issue Dec 1, 2021
80 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/fuse Topic fuse
Projects
None yet
Development

No branches or pull requests

5 participants