bug-global
[Top][All Lists]
Advanced

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

Re: [PATCH] libutil: find: Define PATH_MAX for GNU/Hurd systems.


From: Shigio YAMAGUCHI
Subject: Re: [PATCH] libutil: find: Define PATH_MAX for GNU/Hurd systems.
Date: Fri, 24 Jun 2016 09:50:03 +0900

Hi,
> Then maybe it would be safer to use the same size as defined in
> "linux/limits.h".
>
> #define PATH_MAX        4096    /* # chars in a path name including nul */
>
> This patch does not change anything for systems which PATH_MAX is
> defined, and this number will not create an issue for GNU/Hurd. WDYT?

It seems that there is no certain basis.
Instead, I have found a guideline as follows on the Net.

[https://www.gnu.org/software/hurd/hurd/porting/guidelines.html]

>> Note 2: Yes, some POSIX functions such as realpath() actually assume
>> that PATH_MAX is defined. This is a bug of the POSIX standard, which
>> got fixed in the latest revisions, in which one can simply pass NULL
>> to get a dynamically allocated buffer.

I would like to rewrite code like this.

#ifdef __GNU__
result = realpath(start, NULL);
#else
result = realpath(start, buffer);
#endif

Systems which have no PATH_MAX other than hurd will foll on
a comple error. What do you think?

Regards,
Shigio


2016-06-24 1:49 GMT+09:00 Manolis Ragkousis <address@hidden>:
Hello,

On 06/20/16 10:17, Shigio YAMAGUCHI wrote:
> Hi
>> +/* MAX_PATH is not defined in some platforms, most notably GNU/Hurd.
>> +   In that case we define it here to some constant. */
>
> Since PATH_MAX is buffer size that realpath(3) assumes,
> setting a wrong size would destroy memory.
> How can we know correct size?
>

Then maybe it would be safer to use the same size as defined in
"linux/limits.h".

#define PATH_MAX        4096    /* # chars in a path name including nul */

This patch does not change anything for systems which PATH_MAX is
defined, and this number will not create an issue for GNU/Hurd. WDYT?

Thank you,
Manolis



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

[Prev in Thread] Current Thread [Next in Thread]