Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Chris Ahlstrom Newsgroups: comp.os.linux.advocacy Subject: Re: Then there's PATH_MAX Date: Tue, 10 Dec 2024 08:46:30 -0500 Organization: None Lines: 64 Message-ID: References: <180fd2f32d5884e5$6049$1734$802601b3@news.usenetexpress.com> Reply-To: OFeem1987@teleworm.us Injection-Date: Tue, 10 Dec 2024 14:46:30 +0100 (CET) Injection-Info: dont-email.me; posting-host="3da2555477f409da2ff3958b540ff722"; logging-data="1041106"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18S9Ih4k1pomN/2bDt+oZqz" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:95Fiifm0JVQpNLng/0xw4l/wxm4= X-Face: 63n<76,LYJQ2m#'5YL#.T95xqyPiG`ffIP70tN+j"(&@6(4l\7uL)2+/-r0)/9SjZ`qw= Njn mr93Xrerx}aQG-Ap5IHn"xe;`5:pp"$RH>Kx_ngWw%c\+6qSg!q"41n2[.N/;Pu6q8?+Poz~e A9? $6_R7cm.l!s8]yfv7x+-FYQ|/k X-User-Agent: Microsoft Outl00k, Usenet K00k Editions X-Mutt: The most widely-used MUA X-Slrn: Why use anything else? Bytes: 3269 Farley Flud wrote this post while blinking in Morse code: > On Mon, 09 Dec 2024 06:09:40 +0000, vallor wrote: > >> #include >> #include >> >> #ifdef __linux__ >> #include >> #endif >> >> int main (void) >> { >> printf("%d\n",PATH_MAX); >> return 0; >> } > > This is bullshit. > > PATH_MAX is filesystem dependent and since GNU/Linux, unlike that > pile of garbage Microslop, supports many, many different filesystems > the PATH_MAX macro is unreliable and may be undefined on some machines. According to Kerrisk's Linux API book, PATH_MAX has a minimum value of 255, and is named _PC_PATH_MAX by pathconf()/sysconf(). NAME_MAX has a minimum value of 14. These values are somewhat unrealistic. You can check out all the values defined: $ getconf -a &> variables.text Here are a few: NAME_MAX 255 _POSIX_NAME_MAX 255 PATH_MAX 4096 _POSIX_PATH_MAX 4096 ARG_MAX 2097152 PAGESIZE 4096 PAGE_SIZE 4096 > The best and only way to determine file name/path parameters is to > use "pathconf" of "fpathconf:" ^^ or > > https://pubs.opengroup.org/onlinepubs/9799919799/ > > From the link: > > "The pathconf() function was proposed immediately after the sysconf() > function when it was realized that some configurable values may differ > across file system, directory, or device boundaries." Note that the values provided by pathconf() or fpathconf() can change over the lifetime of a process (e.g. when a different filesystem is mounted). Anyway, for my application(s), including those running on Windows, I treat PATH_MAX as a defining limit. We don't need no funking long pathnames! -- !netgod:*! time flies when youre using linux !doogie:*! yeah, infinite loops in 5 seconds. !Teknix:*! has anyone re-tested that with 2.2.x ? !netgod:*! yeah, 4 seconds now