Bug 217145 - Feature request: I need very long directory and file names
Summary: Feature request: I need very long directory and file names
Status: RESOLVED INVALID
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_ext4@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-06 08:08 UTC by Vyacheslav Sakhno
Modified: 2023-03-08 05:01 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.15.34-un-def-alt1
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Vyacheslav Sakhno 2023-03-06 08:08:16 UTC
I am a youtuber-linuxoid. I need to group videos in a directory by date(name) and list of what seen on a videos at that date(1-3 Kilobytes).

Also torrent client cutting names needed in Linux because of limit of filenames.
Comment 1 Christian Kujau 2023-03-06 10:15:25 UTC
Ext4 (and Btrfs and XFS too) supports file names up to 255 bytes long. How long do you need a file name to be? That 1-3 KB refers to....a list of files, or the actual file name length? I'm interested in the actual use cases for this. Also, what's that name of the torrent client that magically truncates file names here?

$ mkdir -p $(perl -e 'print "a"x255')/$(perl -e 'print "b"x255')
$ touch $(perl -e 'print "a"x255')/$(perl -e 'print "b"x255')/$(perl -e 'print "c"x255')
$ find a*
aaaaaaaaaaaaa[...] well, you get the idea :-)
Comment 2 Vyacheslav Sakhno 2023-03-06 13:00:08 UTC
Directory name is a story of a filming day of 1-3KB length, video file name is a story in a video with a length also 1-3KB. I read them "diagonally" and it is a digest as a tweet but bigger.
https://yandex.ru/search/?text=linux+torrent+client+cutting+long+torrent+file+names&lr=10828&clid=2583699&win=567
 
https://askubuntu.com/questions/181730/how-to-download-torrents-with-long-filenames
Comment 3 Christian Kujau 2023-03-06 16:05:34 UTC
"video file name is a story"...interesting setup :-) But as you already found in your Askubuntu forum: "The problem is the common Linux file systems only support up to 255 characters filename lengths". This is explained in more detail in the following SE answers:

> To what extent does Linux support file names longer than 255 bytes?
> https://unix.stackexchange.com/a/619646

> Is there a reasonble way to increase the file name limitation of 255 bytes?
> https://unix.stackexchange.com/a/619492

So, this would not be a feature request of Ext4 (or any other Linux file system) but of the Linux VFS, but I don't think that will be easliy implemented in the near future. Your best bet would be to change your workflow and use shorter file names.
Comment 4 Andreas Dilger 2023-03-06 18:38:47 UTC
The problem with "long filename is a description of the video" is that 1-3KiB today may grow to 4KiB or 16KiB in the future, so fixing the filename length to allow 1KiB or 3KiB names (out of a full 4KiB PATH_MAX) is only a short term solution.  Changing ext4 or XFS to support 3KiB or 4KiB *filenames* would be a lot of effort for very marginal benefit. 

I think the right solution is to put the "full description" into a separate xattr on the file (which can be up to 64KiB in modern ext4) and then restrict filenames to 255 bytes. That allows very long descriptions without impacting interoperability.
Comment 5 Artem S. Tashkinov 2023-03-08 05:01:08 UTC
This is impossible because it will break countless programs and POSIX compatibility.

Note You need to log in before you can comment on or make changes to this bug.