开发者

Why isn't /usr/include/linux/limits.h PATH_MAX 4096 enforced?

Questions

Am I misinterpreting PATH_MAX?

Do I need to start worrying how many other limits are not enforced or are incorrectly enforced?

Research platform

uname -a Linux xxxxxx.com 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

From /etc/fstab I see that the filesystem I'm manipulating is ext3. Maybe PATH_MAX is irrelevant and the filesystem is responsible for handling limits?

Purpose

I was attempting to determine if Apache 2.2.3 would properly process a GET where the length of the pathname (all directory components plus trailing filename) is long (perhaps 300 or so bytes).

What I typed

I started this investigation by running this shell script:

d="256 byte string here"
while [ 1 ]; do
    mkdir $d
    if [ $? -ne 0 ]; then
        break
    fi
    cd $d
    if [ $? -ne 0 ]; then
        break
    fi
done
pwd

This script's execution failed but I ended up with a 522 directory hierarchy where the bottom-most file had a pathname that wa开发者_如何学Gos 131273 bytes long.


You are misinterpreting PATH-MAX -- it is a limit on the API of certain functions. It is not a limit on the operating system.

Here's a related blog post

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜