FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Sun Jun 20, 2021 06:12



Post new topic Reply to topic  [ 6 posts ] 
Invalid argument when setting ntfs_dos_name 
Author Message

Joined: Fri Jun 01, 2007 15:55
Posts: 7
Post Invalid argument when setting ntfs_dos_name
I'm attempting to restore an 8.3 short filename on a file that has encoded japanese characters. getfattr successfully extracts the value, but setfattr fails with an "Invalid argument" error. I suspect it is an arbitrary length check that is failing before decoding the value, since I can shorten the name by one multibyte character and restore that value. I tried using the base64 encoded value as well as the hex value but both fail with same error message.

Is this fixed by any chance or is there a possible workaround for this?

ntfs-3g 2010.10.2 integrated FUSE 27

Thanks,
Scott


Tue Aug 30, 2011 21:52
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Invalid argument when setting ntfs_dos_name
Hi,

Quote:
I'm attempting to restore an 8.3 short filename on a file that has encoded japanese characters. getfattr successfully extracts the value, but setfattr fails with an "Invalid argument" error.

There is a bug in older versions which may turn out when the short name contains lower-case (latin) characters. There are also restrictions to the allowed characters, and the name must be unique in a directory.
Quote:
I suspect it is an arbitrary length check that is failing before decoding the value, since I can shorten the name by one multibyte character and restore that value. I tried using the base64 encoded value as well as the hex value but both fail with same error message.

There is no check on the length, only a truncation to 12 chars. Can you post an example of short name which is rejected (base64 or hex) ?

Regards

Jean-Pierre


Tue Aug 30, 2011 22:38
Profile

Joined: Fri Jun 01, 2007 15:55
Posts: 7
Post Re: Invalid argument when setting ntfs_dos_name
sorry... I meant to post the example:

[root@host178 ~]# getfattr -h -e hex -n system.ntfs_dos_name /mnt/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/*mydocs
getfattr: Removing leading '/' from absolute path names
# file: mnt/Users/Administrator/AppData/Roaming/Microsoft/Windows/SendTo/\343\203\211\343\202\255\343\203\245\343\203\241\343\203\263\343\203\210.mydocs
system.ntfs_dos_name=0xe38389e382ade383a57e312e4d5944


I was browsing the ntfs_set_ntfs_dos_name() function in dir.c and noticed that the new value appears to be limited to a 12 8-byte character string instead of a 12 ntfschar string, which would account for unicode that goes beyond a single byte. The mixing of the arrays of ntfschar and char seems incorrect, but I also didn't spend a lot of time examining the code so I might be off base there.

Thanks for the reply,
Scott


Tue Aug 30, 2011 22:45
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Invalid argument when setting ntfs_dos_name
Hi,

Quote:
and noticed that the new value appears to be limited to a 12 8-byte character string instead of a 12 ntfschar string,

Hmm, you are probably right, thank you for spotting this. I will check again to-morrow.

Regards

Jean-Pierre


Tue Aug 30, 2011 23:04
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Invalid argument when setting ntfs_dos_name
Hi,

Attached is a patch for truncating to 12 ntfschars instead of 12 utfs-8 chars.

Thanks again for reporting.

Regards

Jean-Pierre


Attachments:
dir.c.patch37.gz [541 Bytes]
Downloaded 828 times
Wed Aug 31, 2011 09:10
Profile

Joined: Fri Jun 01, 2007 15:55
Posts: 7
Post Re: Invalid argument when setting ntfs_dos_name
That worked. Thanks!


Wed Aug 31, 2011 15:18
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.