Skip to content

fix problems with german "Umlaut" in folder name - #3459

Merged
icewind1991 merged 12 commits into
masterfrom
fix_for_2377
May 31, 2013
Merged

icewind1991 merged 12 commits into
masterfrom
fix_for_2377

Conversation

@FlorinPeter

Copy link
Copy Markdown
Contributor

This PR fix the problem with german "Umlaut" in folder name on mac os (#2377 and #579).
The problem was that the mac os filesystem character encoding is http://en.wikipedia.org/wiki/Macintosh_Roman so we need utf8 encoding because the webinterface is utf8.

Comment thread lib/files/cache/scanner.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utf8_encode converts ISO-8859-1 to UTF-8. Can we assume safely that readdir() will always return ISO-8859-1 encoded strings on all systems, including Windows?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

without any unit test this is a too critical change.
👎

@MTGap

MTGap commented May 23, 2013

Copy link
Copy Markdown
Contributor

We use readdir in multiple locations. I think this needs to be solved in a different manner.

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

Yes. You are right @MTGap
I think we need a wrapper or something else for the readdir function.
Are there currently any static methods which wraps php functions in OC?

@MTGap

MTGap commented May 23, 2013

Copy link
Copy Markdown
Contributor

The view class wraps the php functions for local storage.

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

After I've looked at the problem again, I must admit that my initial approach was wrong.
This approach should be better and less critical.
I have added two new tests that show the error we had and proves the solution I made.

@MTGap

MTGap commented May 23, 2013

Copy link
Copy Markdown
Contributor

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@icewind1991 using Filesystem::normalizePath instead of Cache::normalizePath may break some logic, so I suppose using Cache::normalize instead, what you think?

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 I tested the normalizer https://github.com/nicolas-grekas/Patchwork-UTF8/blob/master/class/Patchwork/PHP/Shim/Normalizer.php locally in my tests it works like the normalizer provided by php-intl.
Sorry for my first message ;)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@FlorinPeter THX for testing this! Awesome!

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@karlitschek looks like we have a working fallback for the normalizer

@karlitschek

Copy link
Copy Markdown
Contributor

Yay :-)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Yay :-)

I assume we should go for that solution? 😄

@FlorinPeter interested in submitting a pull request to the 3rdparty repo to add the patchwork normalizer?
In a second pr to core we should hook it up.

@icewind1991 @danimo @bartv2 I'd still like to see your comments on this stuff - THX

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

ok I did some work, we need this owncloud-archive/3rdparty#32 merged so jenkins can test it

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 thx, Jenkins seems also excited about it ;)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@icewind1991 can you please review this? THX

Comment thread lib/files/cache/cache.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the function getParentId() - do we need to normalize $path there as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and within move() $source is used in the select query without normalize call
same for $target in the update statement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in getStatus() $file is not normalized

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pattern in seach()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeepDiver1975 getParentId() is calling getId and there the $path get's normalized. I Think we need normalizing everywhere we use md5() to prevent duplicate path_hash. As I can see a un-normalized string in a sql query is always normalized by the database, but for this case I will provide a unit test, so we can be sure.

@MTGap

MTGap commented May 24, 2013

Copy link
Copy Markdown
Contributor

The get functions in the cache should already have their paths normalized, because it should be going through the filesystem. I believe the only issue is with the return with readdir as was in the original commit.

I think we should use OC\Files\Stream\Dir for all the opendir calls so that we can normalize the returns of readdir.

@icewind1991

Copy link
Copy Markdown
Contributor

I think we should use OC\Files\Stream\Dir for all the opendir calls so that we can normalize the returns of readdir.

I'm planning to deprecate the opendir stuff with the new filesystem stuff and use a higer level api for it instead.

I think doing normalization in OC_Filesystem::normalizePath would be better

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@alexisvincent like I said before this branch is not for productional use, it is only for testing this issue.

@FlorinPeter

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 @icewind1991 @MTGap @karlitschek please review, THX

@DeepDiver1975

Copy link
Copy Markdown
Contributor

I'm fine with the code now 👍
@icewind1991 okay from your perspective as well? THX

@icewind1991

Copy link
Copy Markdown
Contributor

Looks good to me 👍

icewind1991 added a commit that referenced this pull request May 31, 2013
fix problems with german "Umlaut" in folder name
@icewind1991
icewind1991 merged commit 94a6622 into master May 31, 2013
@FlorinPeter

Copy link
Copy Markdown
Contributor Author

Should we backport this? From my perspective I would say yes what do you think? @DeepDiver1975 @icewind1991 @karlitschek

@DeepDiver1975
DeepDiver1975 deleted the fix_for_2377 branch May 31, 2013 21:11
@DeepDiver1975

Copy link
Copy Markdown
Contributor

I'd keep this as a new feature for OC6
@karlitschek has to make the final decision

@alexisvincent

Copy link
Copy Markdown

Please backport it. For me it would mean a lot. And from my perspective (prehaps flawed) this is a bug that needs fixing (reason to fix in OC5) and not just a new feature for OC6.

@drgoldman

Copy link
Copy Markdown

I would like to ASK to backport it in OC5, too.

@danimo

danimo commented Jun 1, 2013

Copy link
Copy Markdown
Contributor

Btw, I mentioned this to @DeepDiver1975 the other day and I should repeat it here: This patch does not make ownCloud fit for use with OS X. Mac OS X's HFS+ partition are only case preserving ("Foo" != "foo"), but not case sensitive ("Foo" and "foo" can coexist in the same directory) by default.

We either need to mandate OS X users to have ownCloud's data storage on a case sensitive partition (and check for it), or still perform some kind of mapping, similar how we do it on Windows today (just to complete the fun, it is also possible to have case insensitive file systems on Linux, e.g. JFS or (more likely) a CIFS-mounted local or remote storage.

@alexisvincent

Copy link
Copy Markdown

hmm :/ so would it work if i made a FAT32 partition on the mac server and put the owncloud installation in there... With this fix? Or prehaps another fs? @danimo

@danimo

danimo commented Jun 1, 2013

Copy link
Copy Markdown
Contributor

@alexisvincent erm, FAT32 is also just case preserving. What you would need to do is create a DMG file with HFS+ with the case sensitivity flag set, then mount it and use it to store the data folder.

@alexisvincent

Copy link
Copy Markdown

Hmm. ok thanks for the advice. Just out of interests sake. how stable do you think it would be using a DMG 24/7?
@danimo

@drgoldman

Copy link
Copy Markdown

I think a DMG will be as stable as the drive is stabe where it resides on. But this is somehow another discussion.
For me I will put the data on an external RAID formatted with case sensitive HFS+ and hope to get the Backbord in OC5.

@drgoldman

Copy link
Copy Markdown

....and I hate the auto-correction :-(
backport

@alexisvincent

Copy link
Copy Markdown

Thanks. I think ill just make a case sensitive partition :) any information on a back port? Sorry if im being a pain about this.. @karlitschek

@karlitschek

Copy link
Copy Markdown
Contributor

This needs more testing before backporting because it could trigger major unforeseen bugs.

@drgoldman

Copy link
Copy Markdown

Does this means that more tests will be done? I would appreciate if a backport could be done for OC5

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@karlitschek first of all 🎂 for you 😉

We had quite some testing of that code now within git master - shall we backport this now? THX

@karlitschek

Copy link
Copy Markdown
Contributor

THX :-)
Backporting would be good.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Backporting would be good.

I'll take care asap

@DeepDiver1975

Copy link
Copy Markdown
Contributor

backported to stable5
c76be96

@mkormendy

Copy link
Copy Markdown

I was having an issue with the OC client on mac os x, it connects to my server which is a mac os x mountain lion install with the owncloud core as noted here:

owncloud/client#616 (comment)

As such I noticed that I was having issues with the accented characters, and I realize that OwnCloud isn't supported to be run on OS X, but I was working with an install before the accented characters issue was realized.

I also saw that these threads were dealing with this issue possibly:

#579

#2469

I have some information that might help towards a solution that I found, and you might already know about it but I would check it out regardless it is here:

Stack Overflow - In PHP, how do I deal with the difference in encoded filenames on HFS+ vs. elsewhere?

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.