smali icon indicating copy to clipboard operation
smali copied to clipboard

Change MAX_FILENAME_LENGTH to 180

Open crackleeeessyp opened this issue 2 years ago • 3 comments

On windows, if we put the apk/dex file on desktop or other path such as C:\Users\xxxxxx\Desktop\folder\test.apk. Some dex may produce long file path smali file which cannot handled by Windows application, so shorten the MAX_FILENAME_LENGTH to 180 to make sure that it works in most cases.

Related issue: https://github.com/iBotPeaches/Apktool/issues/1582 https://github.com/JesusFreke/smali/issues/541

crackleeeessyp avatar Mar 09 '22 06:03 crackleeeessyp

Why? Isn't better to add support for longer filenames? Windows can support path with length of 32767 characters.

ale5000-git avatar Feb 08 '23 00:02 ale5000-git

I had a similar issue with it on Linux and an encrypted partition . the maximum allowed filename length there is ~140 cause here and my issue was with an androidx class . so I think it might be here to stay the name of the class was "androidx/recyclerview/widget/RecyclerView$MediaControllerCompat$MediaControllerImplApi21$ExtraBinderRequestResultReceiver$MediaBrowserCompat$CustomActionResultReceiver.smali" it got written normally on a NTFS unencrypted partition but not on the ext4 encrypted one. we need a way to make a universal patch . like trying to write files to the path with long filenames until we figure out the limit instead of hardcoding a value maybe ?

S4muii avatar Feb 09 '23 19:02 S4muii

That's right for windows can support path with length of 32767 characters, however, some program languages/ and old windows may not support 32767 but only 256, and would introduce problem when handle these long path files.

Current implementation uses 256 as max file length, however, it doesn't consider that current folder path may contain several characters.

I think @samuii1 is right, maybe we need find a way to make sure that long name not exceeded to 256 characters include current folder path character.

crackleeeessyp avatar Feb 14 '23 06:02 crackleeeessyp