[LTP] [PATCH] lack of ENAMETOOLONG testcases for pathnames longer than PATH_MAX
Andrea Cervesato
andrea.cervesato@suse.com
Wed Jan 14 15:38:05 CET 2026
>
> Er... Intent was to verify two things: that anything longer than PATH_MAX triggers
> ENAMETOOLONG, but anything up to PATH_MAX does not. Having a pathname of exactly
> 4095 '/' (or interleaved . and / in the same amount, etc.) be rejected with ENAMETOOLONG
> is just as much of a failure as not triggering ENAMETOOLONG on anything longer...
In this case we need a new test verifying that PATH_MAX is actually
handled well, as Cyril suggested. But in this test we should only
verifying errors.
>
> FWIW, I considered something like
> mkdir("subdirectory", 0700);
> concatenating enough copies of "subdirectory/../" to get just under PATH_MAX and appending
> "././././././././" to the end, so that truncation to PATH_MAX and to PATH_MAX-1 would
> both be otherwise valid paths; decided that it's better to keep it simpler - a pile of
> slashes is easier to produce and would resolve to a valid directory if not for the
> total length restrictions.
It's up to you how you create the string that will trigger the error.
Also, you probably need to take a look at tst_test.needs_tmpdir.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
More information about the ltp
mailing list