nfs-client-java icon indicating copy to clipboard operation
nfs-client-java copied to clipboard

problem about creatig a chinese-named file like '测试服务员.txt'

Open AveiShriety opened this issue 7 years ago • 4 comments

@DavidASeibert Hi! Again to please YOU to help me. ^_^~ When I establish a nfs server in the Linux(Centos7.2) operating system, I could creating a chinese-named file like '测试服务员.txt' with the nfs-client-java code:

Nfs3File test = new Nfs3File(nfs3, "/测试服务员.txt");
NfsFileOutputStream outputStream = new NfsFileOutputStream(test);

However, when I establish a nfs server in the Windows Server 2012 R2 operating system, the same nfs-client-java code throws an error. In order to see some reason, I write an logging code in the NfsResponseHandler.java: System.out.println("getResponse().getState():" + getResponse().getState()); The logging prints and the stack traces:

getResponse().getState():0
getResponse().getState():2
getResponse().getState():2
getResponse().getState():63

Exception in thread "main" com.emc.ecs.nfsclient.nfs.NfsException: Error in NfsCreateRequest serviceVersion:3 xid:1037689678 usePrivilegedPort:false fileHandle:[-35, 45, 1, 0, 0, 0, 3, 0, -35, 45, 1, 0, 0, 0, 3, 0, 67, 105, -95, -8, 80, 2, -80, 32, 54, 34, 12, -127, 29, -38, 109, -85] name:测试服务员.txt error code:com.emc.ecs.nfsclient.nfs.NfsStatus@4926097b
	at com.emc.ecs.nfsclient.nfs.NfsResponseHandler.checkResponse(NfsResponseHandler.java:52)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcChecked(RpcWrapper.java:276)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcChecked(RpcWrapper.java:176)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcWrapped(RpcWrapper.java:131)
	at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendCreate(Nfs3.java:819)
	at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendCreate(Nfs3.java:1)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileBase.create(NfsFileBase.java:898)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.<init>(NfsFileOutputStream.java:182)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.<init>(NfsFileOutputStream.java:100)
	at com.epoint.nfs.test.Write.WriteFile(Write.java:24)
	at com.epoint.nfs.test.Write.main(Write.java:83)

And now, How to solve this problem?

AveiShriety avatar Aug 12 '17 10:08 AveiShriety

Hi, @AveiShriety . Status 63 from https://tools.ietf.org/html/rfc1813 is NFS3ERR_NAMETOOLONG, so I believe this is a Windows name length issue. Have you tried creating this file on the Windows machine without using NFS? I suspect it will fail there, too. If that's the case, and there's no simple setting to allow longer names, you probably need a Chinese Windows expert to explain how to allow creation of this file on your server.

DavidASeibert avatar Aug 14 '17 14:08 DavidASeibert

I could create the chinese-named file with java IO code. So I don't know how to solve it. Sigh~~~ Through my exploration, I know that even the file name is all made up of English letters, its length couldn't be more than 255. So, and now, I want to know two things: 1.What the length 255 represents? (is it the length of Java keywords char? or the lenth of others?) 2.In my understanding, there is a encoding for the filename ( if true, I wonder where is the encoding or what is the java method in the nfs-java-client code ) and there is a statistics on the length of filenames ( if true, where is the statistics or what is the java method in the nfs-java-client code)

AveiShriety avatar Aug 16 '17 09:08 AveiShriety

Sorry, I find another amazing thing that I could create a chinese-named file which filename is "一而一一一一一而一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一". But I can't create the chinese-named file which filename is "一而" with the logging prints and the stack traces:

filename_length:2<>filename:一而

getResponse().getState():0
getResponse().getState():2
getResponse().getState():2
getResponse().getState():63
Exception in thread "main" com.emc.ecs.nfsclient.nfs.NfsException: Error in NfsCreateRequest serviceVersion:3 xid:-2023825255 usePrivilegedPort:false fileHandle:[-121, 34, 10, 0, 0, 0, 11, 0, -121, 34, 10, 0, 0, 0, 11, 0, 70, 43, 29, 6, 82, 5, 0, 0, -41, -102, 26, -110, 0, 0, 0, 0] name:一而 error code:com.emc.ecs.nfsclient.nfs.NfsStatus@762efe5d
	at com.emc.ecs.nfsclient.nfs.NfsResponseHandler.checkResponse(NfsResponseHandler.java:52)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcChecked(RpcWrapper.java:276)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcChecked(RpcWrapper.java:176)
	at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcWrapped(RpcWrapper.java:131)
	at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendCreate(Nfs3.java:819)
	at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendCreate(Nfs3.java:1)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileBase.create(NfsFileBase.java:898)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.<init>(NfsFileOutputStream.java:182)
	at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.<init>(NfsFileOutputStream.java:100)
	at com.epoint.nfs.test.Write.WriteFile(Write.java:24)
	at com.epoint.nfs.test.Write.main(Write.java:88)

What's the problem?

AveiShriety avatar Aug 16 '17 11:08 AveiShriety

I'm not sure what the problem is, but these are all related to details of Windows NFS server behavior, possibly even to handling of Chinese characters in non-Chinese operating systems. Since the client works correctly for Linux, and has no way to determine the OS of the NFS server, I doubt that there's any way to change the client to fix these problems. Any configuration change will almost certainly have to be done on the NFS server side.

DavidASeibert avatar Aug 16 '17 18:08 DavidASeibert