smali icon indicating copy to clipboard operation
smali copied to clipboard

java.io.IOException: File name too long

Open agentdr8 opened this issue 7 years ago • 11 comments

Certain packages contain multiple DEX files (latest Facebook Messenger for example), and the classes within apparently create really long filenames/paths, which baksmali 2.1.3 doesn't agree with:

$ baksmali classes2.dex Error occurred while disassembling class Lcom.facebook.messaging.inbox2.graphql.InboxV2QueryModels$InboxV2QueryModel$MessengerInboxUnitsModel$NodesModel$MessengerInboxUnitItemsModel$MessengerInboxItemAttachmentModel$ItemImageModel; - skipping class java.io.IOException: File name too long at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at org.jf.baksmali.baksmali.disassembleClass(baksmali.java:215) at org.jf.baksmali.baksmali.access$000(baksmali.java:55) at org.jf.baksmali.baksmali$1.call(baksmali.java:149) at org.jf.baksmali.baksmali$1.call(baksmali.java:147) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

This is on Ubuntu 14.04 64-bit, ext4 fs, java 1.7.0_80-b15

agentdr8 avatar Aug 17 '16 22:08 agentdr8

Hmm, that's really weird. I thought the max filename length was 255. That one should only have been ~150.

JesusFreke avatar Oct 02 '16 19:10 JesusFreke

I'm not sure but I think the length limit could include both path + filename, instead of just the filename. Also the limit may be the numbers of bytes instead of the number of characters.

ale5000-git avatar Oct 02 '16 19:10 ale5000-git

I'm not able to reproduce this with the same environment (ubuntu 14.04, ext4, java 7).

Were you disassembling it into a directory with a very long path? I believe the limit for the overall path length is 4k

JesusFreke avatar Oct 02 '16 19:10 JesusFreke

Yeah, I'm guessing it's trying to use utf-16 for the filename, and goes over the 255 byte limit. I'm trying to figure out if that's even possible, to see if I can reproduce locally.

JesusFreke avatar Oct 02 '16 20:10 JesusFreke

Were you disassembling it into a directory with a very long path? I believe the limit for the overall path length is 4k

My cwd was only 3 levels deep; /home/dr8/build

agentdr8 avatar Oct 03 '16 03:10 agentdr8

I recommend LongPathTool, Please try.

Micahel55 avatar Feb 28 '18 08:02 Micahel55

You should try LongPathTool

KevinNelson0700 avatar May 14 '20 13:05 KevinNelson0700

I had this issue as well in baksmali 2.5.2 (Latest version) and am using Linux Mint with an encrypted ext4 drive . it turns out the problem is related to the encryption of filenames . I found that I can only create files with 143 chars MAX . one of the devs of eCryptfs recommends that we limit filenames to ~ 140 chars here

S4muii avatar Feb 09 '23 19:02 S4muii

recommendation noted.

i recommend you get a proper file system without silly limitations, possibly with full partition or disk encryption. eCryptfs is deprecated on RHEL 6, ubuntu 18, and others... that's 5 years ago.

Lanchon avatar Feb 09 '23 20:02 Lanchon

it was an option for me during the installation of Linux mint . I went with the home directory encryption and encryption of the filenames . I thought it was using veraCrypt back then . that was like 1-2 years ago probably. thanks for the suggestion anyway

S4muii avatar Feb 09 '23 20:02 S4muii

OT...

btw, it's an excellent time to move to btrfs, with full data checksumming and its superb snapshot support. just don't ever fully fill the filesystem; bad things could happen.

you can do it over LUKS for encryption or, if your data is not all that sensitive and your drive self-encrypts, maybe you want to rely on a BIOS/firmware disk password for simplicity.

or if your drive is OPAL 2, you may do more interesting things. or if moving to NVMe, check whether you drive supports namespaces, which is the coolest thing that happened to storage recently.

reinstalling a more recent mint from scratch is the easy and recommended way forward. you can backup your current home and also the list of installed packages, mint has tools for that. on the new system you can reinstall most of your packages automatically and manually deal with the rest.

Lanchon avatar Feb 09 '23 22:02 Lanchon