[Toybox] toybox debian patch for PATH_MAX.
Antoni Villalonga
antoni at friki.cat
Wed Sep 14 04:10:33 PDT 2022
Hi,
On Wed, Sep 14, 2022 at 12:52:50AM -0500, Rob Landley wrote:
> I'm looking at
> https://salsa.debian.org/debian/toybox/-/blob/master/debian/patches/set-pathmax-default.patch
> and:
>
> A) Nothing outside of kconfig uses PATH_MAX that I'm aware of?
> toys/posix/getconf.c has CONF(PATH_MAX) but that expands to _PC_PATH_MAX which
> is an enum value in /usr/include/*/bits/confname.h that resolves to... looks
> like 4? Other than that, grep in a clean checkout finds www/code.html saying we
> do NOT use PATH_MAX, and the aforementioned kconfig.
>
> 2) I'm building on devuan barnacle and it's got PATH_MAX due to...
>
> /usr/include/linux/limits.h:13:2: warning: #warning defining PATH_MAX [-Wcpp]
> #warning defining PATH_MAX
> ^~~~~~~
> In file included from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
> from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
> from /usr/include/dirent.h:233,
> from ./toys.h:13,
> from lib/args.c:10:
>
> I also checked the musl and bionic headers, and both of them define PATH_MAX in
> limits.h. (Without which that kconfig build would have broken.)
>
> III) The three kconfig/*.c files you modified all #include "lxc.h" so I can just
> add the #ifndef block there once instead of repeating it in many individual files.
>
> If toybox itself needs this it wouldn't go in various *.c files, it would go in
> lib/portability.h which is (indirectly) #included from every toybox *.c file.
> But... why is it needed? (What breaks if it's not there?)
>
> I commited dea2ace53450 to the repo for kconfig (that whole directory needs to
> be replaced, I know), but there's an actual issue in toybox itself, could you be
> more specific about what you're seeing?
>
> Thanks,
>
> Rob
Path 'set-pathmax-default.patch' was a quick dirty fix trying to build Toybox
for Debian/Hurd.
Hurd build log before the patch:
https://buildd.debian.org/status/fetch.php?pkg=toybox&arch=hurd-i386&ver=0.8.8%2Bdfsg-1&stamp=1660914245&raw=0
( scripts/kconfig/lex.zconf.c:2263:22: error: ‘PATH_MAX’ undeclared (first use in this function) )
Hurd buildlog after the patch:
https://buildd.debian.org/status/fetch.php?pkg=toybox&arch=hurd-i386&ver=0.8.8%2Bdfsg-2&stamp=1663073011&raw=0
( ./lib/portability.h:183:10: fatal error: sys/mount.h: No such file or directory )
Still needs more work :-/
I'll try to look at it but probably there are too much work to be done.
Some coments PATH_MAX:
https://www.gnu.org/software/hurd/hurd/porting/guidelines.html
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
| {PATH_MAX}
| Maximum number of bytes in a pathname, including the terminating null character.
| Minimum Acceptable Value: {_POSIX_PATH_MAX}
| [XSI] Minimum Acceptable Value: {_XOPEN_PATH_MAX}
At this point I'll probably drop my PATH_MAX patch from Debian package.
May be toybox upstream can rely on _POSIX_PATH_MAX/_XOPEN_PATH_MAX mentioned on
opengroup docs in case PATH_MAX is not defined.
I didn't mentioned it as an 'issue' on github because it's only a Hurd-related
problem.
Thanks for your time!
PS: I've seen your other email. I need to look deeper on it before replying.
--
Antoni Villalonga
https://friki.cat/
More information about the Toybox
mailing list