Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Clone error - non ASCII chars on file name(JGit gives a file rename error when cloning a repo which includes files with non ASCI chars in file names)
Clone error - non ASCII chars on file name [message #1815534] Fri, 04 October 2019 10:32 Go to next message
Ignacio Sales is currently offline Ignacio SalesFriend
Messages: 2
Registered: October 2019
Junior Member
JGit is throwing an error when the clone command is called. The logs show that the problem is caused when renaming files which have non ASCII characters in their file names (specifically the copyright sign).

We are running JGit as a Java Process triggered from an Apache WebServer. The java process is launched with the options:
-Dfile.encoding=UTF-8
-Dsun.jnu.encoding=UTF-8

The clone fails with the error "Could not rename file /pathtogitrepolocaldir/git_7456e938-17a2-448e-9a68-e8985f71e36e/._FileNameWith©.tmp to /pathtogitrepolocaldir/git_7456e938-17a2-448e-9a68-e8985f71e36e/FileNameWith©"

Surprisingly, running the java process from the command line with "sudo" gets the repository cloned without issues. Running without sudo on a repo without non-ASCII chars works fine as well, of course, so it does not seem to be a file permissions issue.

We are running JGit version 5.5.0.201909110433-r. We updated from 4.8.0.201706111038-r, which was also showing the same behaviour.

Any help will be appreciated, but please note that we do not control the contents of the repo we are cloning, so changing the name of the files is not a workable fix.
Re: Clone error - non ASCII chars on file name [message #1815587 is a reply to message #1815534] Sun, 06 October 2019 14:43 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 576
Registered: August 2016
Senior Member
Could it be that the OS locale for the process is not a UTF8 locale, and that this causes problems despite the encoding options?
Re: Clone error - non ASCII chars on file name [message #1815595 is a reply to message #1815587] Sun, 06 October 2019 18:19 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
yes, I also think this is probably the reason

On Linux/Mac try to set the environment variables

LANG=en_US.UTF-8
LC_ALL=$LANG

at least for the Java process running JGit, if the OS locale isn't unicode the OS cannot translate unicode file names from/to their raw byte representation
Re: Clone error - non ASCII chars on file name [message #1815621 is a reply to message #1815595] Mon, 07 October 2019 11:30 Go to previous message
Ignacio Sales is currently offline Ignacio SalesFriend
Messages: 2
Registered: October 2019
Junior Member
@Thomas, Matthias:

Thanks for your help and quick response. Indeed, even though the user's environment and the Apache configuration specified LANG=en_US.UTF-8, by the time the Java process was launched, this had changed to LANG=C.
The fix was to set the variable on the command which launched the Java process. Once this was done, problem fixed!

Thanks again.
Previous Topic:org.eclipse.egit.core.test results in java.io.IOException because of it could not delete files
Next Topic:Save buttons not enabling consistently in EGit Merge Tool in PDT
Goto Forum:
  


Current Time: Thu Apr 25 03:53:28 GMT 2024

Powered by FUDForum. Page generated in 0.03404 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top