Le jeu. 10 avr. 2025 à 18:30, Laurent Lyaudet <laurent.lyau...@gmail.com> a écrit :
> > > Le jeu. 10 avr. 2025 à 18:29, Laurent Lyaudet <laurent.lyau...@gmail.com> > a écrit : > >> Hello :), >> >> Recently, I noticed during tests that mkdir -p can handle paths beyond >> PATH_MAX that is currently 4096. >> But cd cannot do this. >> You have to split your cd commands to go to the farthest directory. >> >> I think that cd cannot move if it fails. >> In case of error, it must keep bash in the same current directory. >> Maybe I'm wrong. >> >> But if I'm wrong and that is not a requirement, >> then splitting the path before recursive calls of one level depth cd >> would make cd as resilient as mkdir -p. >> If I'm not wrong, we need to handle some kind of backtracking in cd. >> I hope this is something that can be done. >> I will not argue further if it's not accepted here. >> >> ***Below greetings is some sample script to demonstrate/reproduce the >> "bug/more resilient feature request"*** >> (For reference, here is where this problem comes out: >> >> https://discourse.ubuntu.com/t/increasing-path-max-to-8092-and-name-max-to-512/58748/20?u=laurent-lyaudet >> ) >> >> 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 "" >> >> >> > Sorry, I forgot to say that I already know there is also another upper > limit to a command line length. > But it is less relevant to this problem. > Sorry again, I forgot to say I'm using Ubuntu 24.10 with bash in gnome-terminal, standard package, nothing fancy. Bash version is $ bash --version GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2022 Free Software Foundation, Inc. Licence GPLv3+ : GNU GPL version 3 ou ultérieure < http://gnu.org/licenses/gpl.html> Ceci est un logiciel libre ; vous être libre de le modifier et de le redistribuer. AUCUNE GARANTIE n'est fournie, dans les limites permises par la loi.