Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change MAX_FILENAME_LENGTH to 180 #845

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

crackleeeessyp
Copy link

@crackleeeessyp crackleeeessyp commented Mar 9, 2022

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:
iBotPeaches/Apktool#1582
#541

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
@ale5000-git
Copy link
Contributor

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

@S4muii
Copy link

S4muii commented Feb 9, 2023

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 ?

@crackleeeessyp
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants