Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: segfault with exceedingly long path



On Sun, Jan 19, 2014 at 01:35:50PM -0800, Bart Schaefer wrote:
> In this particular case even if the shell were able to deal with an
> "unlimited" directory nesting depth, system calls like chdir(2) would
> begin to fail.

PATH_MAX is the maximum relative path length, which should be
accepted by chdir(2) and similar system calls.

As long as we don't use paths longer than PATH_MAX in system
calls, it doesn't matter how "deep" the directory structure is.
It only becomes a problem if a very long absolute path is used.

So we could do that in small steps, e.g. first chdir(2) to a
directory < PATH_MAX bytes deep, then from there to the next
directory < PATH_MAX bytes deep and so on until we get down to
the real directory.

I don't think that's worth it, but it works.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

Attachment: signature.asc
Description: Digital signature



Messages sorted by: Reverse Date, Date, Thread, Author