On 4/12/25 3:29 AM, Laurent Lyaudet wrote:
Le ven. 11 avr. 2025 à 18:11, Chet Ramey <chet.ra...@case.edu
<mailto:chet.ra...@case.edu>> a écrit :
On 4/10/25 12:29 PM, Laurent Lyaudet wrote:
> Hello :),
>
> Recently, I noticed during tests that mkdir -p can handle paths beyond
> PATH_MAX that is currently 4096.
> But cd cannot do this.
POSIX requires cd to fail in this case, leaving the current directory
unchanged.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu <mailto:c...@case.edu> http://
tiswww.cwru.edu/~chet/ <http://tiswww.cwru.edu/~chet/>
Hello Chet :)
Thank you very much.
I did not knew that POSIX had failing requirements.
POSIX requires cd to call chdir(2) with (in this case) a relative path that
it received as an argument, since canonicalization results in a path
longer than PATH_MAX.
The POSIX chdir description says that it `may fail' if its argument exceeds
PATH_MAX bytes: if it fails, cd is required to fail. On Linux, for
instance, chdir(2) will return -1/ENAMETOOLONG if the argument is longer
than PATH_MAX. There is no `split the path' fallback.
I would have think that as long as the filesystem handles it, it is ok for
POSIX.
The file system system calls don't handle it, that's the issue.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/