Bug 4121 - PATH_MAX undefined since it is undefined in limits.h
Summary: PATH_MAX undefined since it is undefined in limits.h
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.23c
Hardware: x86 Other
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
Depends on:
Reported: 2006-09-22 19:45 UTC by Larry Manulak
Modified: 2019-06-18 10:40 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Larry Manulak 2006-09-22 19:45:57 UTC
OS: SCO OpenServer 5.0.7 using gcc 2.95.3p4

client/client.c:3000:'PATH_MAX' undeclared.

This is related to bug 3746.

In SCO OpenServer 5, PATH_MAX is undefined in limits.h. Below is the relevant part of limits.h:
 * The following are not defined since the value can vary according
 * to the file referred to.
 * In all cases, pathconf should be checked to find the actual value for
 * a particular file.
 *  A similar rationale applies to the following cross compatibility values.
 *	MAXPATHLEN		(from 4.2 BSD params.h)

 * It is arguable whether these should be defined even in _IBCS2 mode since
 * the defintions are WRONG on recent SCO OS's and pathconf should be
 * used instead

#ifdef _IBCS2
#define LINK_MAX  1000
#define PATH_MAX   256
#define PIPE_BUF  5120
#endif /* _IBCS2 */

The recommended solution is to use pathconf to find this value. Alternatively, you could use _POSIX_PATH_MAX since that is defined as 255 but that could be too restrictive.

A workaround to get this compiled is:

But then I got 
utils/smbget.c:118:'MAXPATHLEN' undeclared.

As you can see from the part of limits.h extracted above, that is also deliberately undefined.

Adding -DMAXPATHLEN=_POSIX_PATH_MAX would probably work here too but it is time to go home.

Larry Manulak
Omega Computer Services Ltd.
Comment 1 Larry Manulak 2006-09-25 15:25:29 UTC
This seems to be the same as bug 4008 (Compile error in client/client.c when building for SCO OSR 5). I think I have provided additional informatiion about why it happens.
Comment 2 Larry Manulak 2006-09-25 16:44:54 UTC
This appears to be similar to bug 2560 where it showed up in 3.0.13 in smbd/vfs.c and appeared to have been solved by 3.0.14a.

It reappears here in client.c (is that new code?).
Comment 3 Andrew Bartlett 2019-06-18 10:40:27 UTC
Fixed in Samba 3.4 by 

commit 2b3c44e4fb980335c22abcc07a88f32b13e5918f
Author: Jeremy Allison <jra@samba.org>
Date:   Sat Nov 10 22:31:34 2007 -0800

    Always define PATH_MAX. Makes code simpler (removes
    a bunch of #defines). Remove pstring from msdfs.c.
    (This used to be commit e203ba22275320808bc11b17361ad1f2d5b0b897)