Increasing PATH_MAX to 8092 and NAME_MAX to 512

Hello :),
I came here today because I asked for an increase of PATH_MAX on the ubuntu-motu emailing list there:
https://lists.ubuntu.com/archives/ubuntu-motu/2025-April/008415.html
And Simon Quigley emailed me that it was much more appropriate to ask on discourse.ubuntu.com since the ubuntu-motu emailing list is “deprecated” (my word to simplify what he said).
Here is my original email:

Hello :),

I know this is a tricky feature request but I need to ask it,
even if it is flamed during flight.
I helped my mother to switch from Windows to Ubuntu.
She used Firefox and Thunderbird for years.
But there is one limitation that is inconvenient.
She was working in (paper) administration,
and, in "normal computer use",
she is able to nest directories and subdirectories, etc.
and use long distinct sentences for basenames,
so that she doesn't need to open the documents to find the right one
(like invoices etc.).
She's very organized in her use of a computer,
much more than I.
But she doesn't know CamelCase and other tricks
to shorten basenames or folders names.
PATH_MAX (MAX_PATH) and NAME_MAX limits on Windows
were removed years ago (the limit is not significant for "normal computer use").
Since Ubuntu is a mainstream Linux distribution system,
and nowadays computers are able to handle it,
I think it would help to double current constants
in the Linux kernel versions for Ubuntu,
and in other Ubuntu packages where it would be redefined
instead of using the right C definition or pathconf.
I know it may be a lot of work,
and I definitely think that the first step would be to verify that
all other (main) packages use pathconf.
Then increase.
I don't ask for it for today, but I hope it is something that can be planned for 2030.
Because the need for it is real.

Thank you for your attention, best regards,
      Laurent Lyaudet

Best regards,
Laurent Lyaudet

1 Like

I believe I understand what you are looking for but I think changing complete file systems and operating systems is the wrong solution for your requirement.

Why not use a collection manager like Tellico?

Or you can keep it really simple using a fully adaptable OpenDocument Spreadsheet to index files. For example:


You can copy file paths from nautilus by pressing Ctrl-c and insert in a cell in spreadsheet using Ctrl-v. The function =HYPERLINK("/path/to/file") provides a clickable link to open the file. And you can add every field you want, search for it and filter the list.

Hello g-schick :),

Thanks for taking the time to answer me.
Unfortunately, this is not what I’m looking for.
My mother is retired, she will turn 76 years old later in 2025 and has habits.
I don’t want her to be confused between a Calc document and her folders.
The structure of a Calc document is not nested.
She will not be able to browse it like she does with Nautilus.
Of course, she could have a main Calc document that has hyperlinks for nested Calc documents :wink: XD, very wrong idea for usability (where is the back button ? Why do I have all these windows opened ? XD). I would have to ask her to create a Calc document for each directory (she has gigabytes of data, pdfs, libre office documents, etc. already).

I don’t know Tellico, it may be a better idea.
Is it able to load a complete tree structure of directories and fill default attributes of each file automatically ?
It reminds me of an old attempt to have an OS with a database as the root of the filesystem
https://en.wikipedia.org/wiki/BeOS
(https://fr.wikipedia.org/wiki/BeOS)
https://en.wikipedia.org/wiki/Be_File_System
(https://fr.wikipedia.org/wiki/BeOS_file_system)
https://en.wikipedia.org/wiki/File_system#Database_file_systems
Sorry, but I think the cognition gap is too high for my mother.
Moreover, metadata needs to be filled by someone,
the entry cost is too high for most users.

ExFAT limitations in USB keys and external SSDs can be bypassed by making a .tar.gz archive with 7-zip on Windows, then copying.
Then trying to untar on the Linux computer.
Then look at the error messages for too long filenames.
Then use command line to edit/shorten filenames inside tar archive in-place.
Then untar again.

It is a cumbersome process that slows adoption of Linux for mere mortals.
I still think that the KISS answer to this is to follow the same path than Windows and to adapt limitations in Linux to be irrelevant to “normal computer use”.

Best regards,
Laurent Lyaudet

create a Calc document for each directory

The OpenDocument Spreadsheet would only be one file for all files and folders. Nested inside this spreadsheet can exist hyperlinks to all kinds of files not only other spreadsheets.

The structure of a Calc document is not nested.

The ‘nesting’ can be replicated with using fields in the spreadsheet.

Tellico: Is it able to load a complete tree structure

I do not know Tellico, too. Just searched for some other options.

metadata needs to be filled by someone

Your actual meta data exists in folder names and file names - just perfect to extract them automatically. After extracting the meta data real folder names and file names may be shortened to fit OS limits.

I still think that the KISS answer …

I agree with you to keep it simple but I do not agree with you that your solution is technically as simple as using a spreadsheet …

to adapt limitations in Linux to be irrelevant to “normal computer use”

In my opinion discussed limits of linux are not heavily relevant to “normal computer use”.

My mother is retired, she will turn 76 years old later in 2025 and has habits.

I totally agree with you that any altering of procedures will break your mother’s habits. And I totally understand and appreciate your aim to not touch your mother’s workflow to not confuse her.

Rehello @g-schick :slight_smile:

The ‘nesting’ can be replicated with using fields in the spreadsheet.

Ok, I don’t see what you mean. If you care to explain, otherwise don’t bother :).

Your actual meta data exists in folder names and file names - just perfect to extract them automatically. After extracting the meta data real folder names and file names may be shortened to fit OS limits.

Using AI ? I think that it’s not that simple. Take as an example an invoice, the basename could contain “Facture <SOME_COMPANY_NAME> du 9 avril 2025 d’un montant de 120 €” to say that the invoice date is 2025/04/09 and amount is 120 €. Easy for humans, even with typos, but otherwise we enter the field of NLP, and we have to use AI with human feedback/validation. AI can be a big help, but the entry cost is still high for people like my mother. I already paid the entry cost by using the tar trick and editing filenames inside tar archive for her. I care also about people who are not able to look Internet to learn how to a edit a tar archive in-place ;).

I agree with you to keep it simple but I do not agree with you that your solution is technically as simple as using a spreadsheet …

We both know I used KISS for the user and you replied KISS for the dev ;).

In my opinion discussed limits of linux are not heavily relevant to “normal computer use”.

I must agree. They are relevant but not heavily relevant since we both know that 2 or 3 levels depth of directories structures, Firefox (and everything accessible through it), Thunderbird, VLC, LibreOffice, GIMP and 95 % of users are fine like that.

I still think there are good reasons to improve Linux based on the 5 % remaining:

  • The 95 % - 5 % rule always existed for one reason or another,
    and most improvements come from the minority who is not satisfied at some point in time.
  • The code of Linux kernel and its ecosystem would be in better shape, if modifying PATH_MAX or other constants is a no-brainer and yields no regression. It would be a proof that this code doesn’t contain any magic numbers or incoherence anymore. It was part of my initial assumption that it was already the case for the kernel, and that it would be a nice work to make it so for main packages using pathconf. I will ask my request to Linux Kernel mailing list later this week to know if they feel the same regarding the kernel.

Best regards,
Laurent Lyaudet

Using AI

No. Because of the structure (folders, files) a simple script may do this job.

Nesting

I have updated my spreadsheet. Title will be the filename. All folder names are split up in columns. Results may be filtered by filename and folder names. Other attributes not yet visible in folder tree may be added in new columns and also may be used for filtering.

I think you posted this in the right place. But I’m no Linux developer. Your title caught my attention and reading your first post I started thinking of other possible solutions.

Rehello @g-schick :slight_smile: ,

Thanks for the clarification about nesting in Calc.
I think it will be quite tricky because your selector on head of column “Folder 2” will not be filtered according to selected “Folder 1” unless you do some BASIC scripting in Calc. Neither impossible, nor simple enough in my opinion.

No. Because of the structure (folders, files) a simple script may do this job.

Ok, unfortunately some of the metadata is not in the structure of folders, files, like the amount of the invoice in my example. Even people organized like my mother use some Blob text after some level of complexity :). That’s where Natural Language Processing comes into play.

I think you posted this in the right place. But I’m no Linux developer. Your title caught my attention and reading your first post I started thinking of other possible solutions.

No problem :). Thanks for trying to help :). When I’ll have an answer on Linux Kernel mailing list, we will have more elements to judge.

Best regards,
Laurent Lyaudet

Filtering in Calc

You can select multiple filters in different columns and all will be applied, also on other selectors. In my example: When filtering ‘Folder 4’ by ‘Documents’ the selector for ‘Folder 5’ wont let you select ‘Screenshots’ any more. No scripting necessary.

use some Blob text

These blob texts will follow a structure, too (they must be linked to the files by name or another nomenclature). So reading these and filling additional columns will also be possible using a script.

Hello @g-schick :),

No scripting necessary.

Nice, the list of the selectors for “Folder n” are automatically filled by Calc when it reads the hyperlinks. I didn’t know how it worked, very nice :).

These blob texts will follow a structure

What I call blob are the basenames “à tout faire”, where my mother adds any relevant information into the basename of the file.
Trust me, with typos included, you don’t want to script data extraction from this,
there will always be slight errors.
And no matter if you use AI or a simple script, you will always need a loop on all the files with a prompt like:

From the basename "blabla", the following metadata were extracted:
document type: invoice (Type '1' to correct)
invoice date: 2025/04/09 (Type '2' to correct)
invoice amount: 120 € (Type '3' to correct)
Type '4' to add another metadata.
Type '0' to validate.
Whatever strictly positive number you type,
you will  see the same corrected prompt
to have the opportunity to make further corrections.

The script may be written in a few hours.
But it will take an huge amount of time to loop on all the files.
Around 50 000 files, I know why I talked about entry cost.
Fortunately, the number of basenames needing to be shortened was much less.

Best regards,
Laurent Lyaudet

In your actual data you have those informations (‘document type’, ‘invoice date’, …) within the name of the file. Correct?
So why does the Script need to extract this data to build an equivalent list to your current tree in file system? This would be a next step in improving the data.

In your example the filename is
"[prefix]Facture <SOME_COMPANY_NAME> du 9 avril 2025 d’un montant de 120 €[postfix]”.
In Spreadsheet the title for this file would be
[prefix]Facture <SOME_COMPANY_NAME> du 9 avril 2025 d’un montant de 120 €[postfix]”.
No information will be lost, no information will be added. Nothing to correct here.

If you want to update and/or correct information:
In current workflow you have to enter each folder and change the filename. In the spreadsheet the filename doesn’t need to be changed anymore - you just update the information in the sheet. No need to switch to another directory to alter another file’s info. Just edit the associated cell.

Ok, we didn’t understood each other. In my mind the script was for metadata extraction (split, atomize, format, etc.), Tellico, extended attributes of a database filesystem, or precise columns for the Calc document as you prototyped in your first message (it had different columns suggestions in the Calc screen capture). I was arguing all the way that the blob way my mother uses had the smallest entry cost for her and me, compared to metadata extraction.

Your actual meta data exists in folder names and file names - just perfect to extract them automatically. After extracting the meta data real folder names and file names may be shortened to fit OS limits.

I replied:

Use AI

You replied:

No […] a simple script

You were thinking about filling the Calc document with a minimal number of columns as suggested in your second screen capture but since the conversation had the metadata common factor, I didn’t follow the same thought path than you. What you called metadata extraction is just blob copy in my opinion. Hopefully we understand each other now. Thanks for simplifying your Calc idea to make it simple with low entry cost. I don’t know if it will be used by my mother but it may help someone else :).

Best regards,
Laurent Lyaudet

The spreadsheet was designed to fulfill your in post #1 described needs - higher character limits to extend information (folder names and filenames) - and provides even more.
And as a fact the data is inside the files so folder names (and filenames) do describe the data from outside what makes them metadata per definition. Data extracted from data is - in fact - data. (And blob in connection with data stands for ‘Binary Large Object’)

Hello,

Let’s not derail the conversation and get back to the issue.

@laurent-lyaudet we understand there are diverse use cases and we certainly are empathic with your use case.

For the moment, increasing both PATH_MAX and NAME_MAX is not something that we are considering. This is, AFAIK, never been requested.

If I had to guess, part of the reason is that PATH_MAX limitation can be worked around by using relative paths. i.e.:

You could do "mkdir 0123456789/ && cd 0123456789/ " several times, more than 8092 characters, and PATH_MAX will not be a limitation.
You can’t do “mkdir relative/or/full/path/that/contains/…/more/than/8092/characters”

For NAME_MAX I guess we just don’t have such a request.

1 Like

I agree. Do not derail the discussion because some person’s mind disagrees with the argument. I have been subjected to this myself … in this forum. Who guards the guardians in this forum?

I shall now release my tome.

I must reply to this challenge since it relates to my own efforts to obtain order out of chaos in my own Ubuntu 22.04. I am not yet in the bleeding edge of 26.04.

Now I share the views of others that trying to introduce a new feature in kernel is like pissing into the wind.

We must resort to our own instincts to build “workarounds”. Not to change the foundations.

Now I can relate to that scenario. We all have “habits”. My wife and I are a decade in “age of man” older in this home/dev/care environment and I am researching ways of cutting through chaos in the medical sector inter alia. Order out of chaos. On that subject I shall digress slightly and point to Santa Fe Institute.

Now returning to the man/machine interface - or your aged mother/Ubuntu machine interface - there is already far too much complexity for the elderly.

Your mother prefers to write long winded names. So be it. Accept that operational constraint. Design a workaround. At least she is not writing file names in Latin.

I draw on your example:

Using AI ? I think that it’s not that simple. Take as an example an invoice, the basename could contain “Facture <SOME_COMPANY_NAME> du 9 avril 2025 d’un montant de 120 €” to say that the invoice date is 2025/04/09 and amount is 120 €. Easy for humans, even with typos, but otherwise we enter the field of NLP, and we have to use AI with human feedback/validation. AI can be a big help, but the entry cost is still high for people like my mother. I already paid the entry cost by using the tar trick and editing filenames inside tar archive for her. I care also about people who are not able to look Internet to learn how to a edit a tar archive in-place ;

How can we simplify the interface between your mother and the hidden assets? Without changing her work flow (too much).

And I empathise with the goal to tear down barriers for the elderly.

What I suggest is using a very powerful but front end tool Albert as one cog in a tool chain.

This allows Python extensions to be written and your mother can be mentored to hit [Ctrl+Space] to popup a query box (no AI at this stage but I have on occasions likened Albert to Robot Gort’s all seeing eye in the 1951 scifi film).

So the custom command (agreed with your mother in requirements analysis) might be:

Invoice [search term]

It might bring up all invoices to be clicked through.

But how can we dig deeper to find invoices for specific customers, or even ignoring file names to find keywords (context vectors) within the corpus of invoices?

We introduce Recoll as another cog in the desktop “work around” tool chain. The Albert front end will capture the essence of interest then whirl away in Python extension to bring up a Recoll GUI summarising invoices to preview.

Using your example Albert extension must compose this Recoll query:

The Recoll search operatos (hover on the Recoll query field) show that you can compose this custom query (assuming that your invoices are in LibreOffice Calc)

So we start Recoll query with:

ext:ods

This means display in Recoll GUI only indexed files with extension .ods.

Now sort the GUI date column. To see every .ods file in the desktop. By date.

Now hover the mouse over the ext:ods query and lo … a cheat sheet pops up.

We can narrow our search pattern yet further even looking for key words within each spreadsheet.

I use these methods to search my own desktop constellation. But they can be extended to search this forum (forget tags and categories) and the old ubuntuforums and other corpora.

The theme to research is corpus linguistics. There is another nice gem to discover. A cog in the toolchain. AntConc.

1 Like

Hello @joseogando :),

I tried what you said. Indeed, you can go beyond the 4096 bytes limit in gnome-terminal.
I didn’t know.
But your current path will be truncated in display.
Note that mkdir -p works beyond 4096.
But cd fails, you have to split your cd commands.
What I don’t understand yet is that mkdir -p works,
but the mkdir commands issued when untaring fails.
Like if mkdir -p was the bash built-in and mkdir commands issued when untaring
were using something else (a .so ?) less resilient.

I wrote a bash script with some echoes to demonstrate this.
It shows that making tar -xf as resilient as mkdir -p could be a simple feature request with very low regression risk that would be a step in the right direction.

I will reply on basenames in another post.
Here is my script below (named mkdir_cd_tar_untar_above_4096.sh).
Best regards,
Laurent Lyaudet

#!/bin/bash

# base 16, each lines count for 64, 64*64=4096
mkdir -p 0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
another_too_long_string_to_certainly_be_over_4096
echo ""
echo ""
echo "mkdir -p works above 4096"
echo ""
echo ""
cd 0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
another_too_long_string_to_certainly_be_over_4096 || (\
echo "" &&\
echo "" &&\
echo "cd fails above 4096" &&\
echo "" &&\
echo "")
cd 0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/
echo ""
echo ""
echo "1) split cd works for 2048"
echo ""
echo ""
cd 0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/\
0123456789012345/0123456789012345/0123456789012345/0123456789012345/
echo ""
echo ""
echo "2) split cd works for 2048"
echo ""
echo ""
cd another_too_long_string_to_certainly_be_over_4096
echo ""
echo ""
echo "3) split cd works for the last directory above 4096"
echo ""
echo ""
echo "a" > test.txt
cd
echo "back to home"
tar -cvf 0123456789.tar 0123456789012345/ > /dev/null && echo "tar creation succeeds"
mkdir abcd
cd abcd
cp ../0123456789.tar .
tar -xf 0123456789.tar || echo "tar decompression fails"
cd
echo "back to home again"
echo "cleaning"
rm 0123456789.tar && rm -r 0123456789012345 && rm -r abcd && echo "cleaned"

I forgot to say that bash cd built-in could also be made more resilient, like is mkdir -p.

Rehello @joseogando :),

Regarding NAME_MAX, I’m not certain about the limit on Windows.
I read 255 or 260 sometimes.
But it is below some filenames on Internet.
For example, here:
https://www.legifrance.gouv.fr/jorf/id/JORFTEXT000051445248?datePubli=10%2F04%2F2025&nature=DECISION

This is the official website of France for legal documents, laws, décrets, decisions.
I searched “Décrets legifrance” in Google.
Then choose today date in the answers, and I found right away a legal text which title,
and hence basename when you save it in Firefox with Ctrl-S is above 255.
This legal text correspond to the URL above.
I can found plenty of this on legifrance.gouv.fr.
Full basename is:
" Décision n° 2025-167 du 26 mars 2025 portant extension de l’autorisation n° 2011-14 du 4 janvier 2011 délivrée à la SARL Radioactivité pour l’exploitation d’un service de radio de catégorie B par voie hertzienne terrestre en modulation de fréquence dénommé Évasion Somme"
When I try to save it in Firefox, basename is truncated at “en modulation de f.html”, but the save fails without any error displayed. I cannot find the webpage saved in my folder. I checked twice I looked at the right folder.
My mother did the same test on her old Windows laptop: webpage basename was also truncated (at “en modulation de fr.html” one more character), but at least it worked and she had the webpage in her test folder.
So first, there is a bug with Firefox and long filenames on Ubuntu. I will have to make a bug report for this.
Second, there is a risk that there is a collision on truncated filenames.
Augmenting NAME_MAX to 512 would decrease those bugs and risks exponentially,
once the technical stack works well with pathconf.

Best regards,
Laurent Lyaudet