tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MAXNAMLEN vs NAME_MAX



> MAXNAMLEN = 511
> NAME_MAX = 255

> [...]  We want to make them consistent.

Do you want to increase NAME_MAX, or decrease MAXNAMLEN?

> My opinion is that [versioning userland] is not worth the trouble.
> The only programs that can fail are ones that do things like:
>      char name[NAME_MAX];
>      strcpy(name, d->d_name);

This sounds as though you are contemplating increasing NAME_MAX.

> sizeof(d->d_name) does not change. It is just that d_namelen can be >
> 255 (NAME_MAX).  Only programs that use NAME_MAX to store directory
> entries can fail.

Not quite.  Such things can also find their way into code in subtler
ways.  For example, I've writen code that knows it can store a
directory entry length in an unsigned char (which amounts to assuming
NAME_MAX <= UCHAR_MAX).  I think all the recent examples of that I've
written have been FFS-specific and therefore safe (if I'm reading
things right, FFS uses a single octet to store directory entry length
on disk), but I'm probably not the only one who's done such stuff.

> My vote is to bump without versioning, what's yours?

I probably agree with you.  But what's the motivation for increasing
NAME_MAX rather than decreasing MAXNAMLEN?

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index