Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement request - support file systems with lower PATH_MAX values #42

Open
mykaul opened this issue Jun 18, 2020 · 8 comments
Open

Comments

@mykaul
Copy link

mykaul commented Jun 18, 2020

PATH_MAX seems to be hard-coded everywhere. Unfortunately, when using some file systems (Gluster, for example), the real paths are longer than PATH_MAX.
There is no way (that I found, as opposed to NAME_MAX) that one can query the FS for PATH_MAX - it is just assumed to be 4096 everywhere.

I suspect if we can change dirgen_max and perhaps other functions to be able to get a hard-coded, lower PATH_MAX, we'll be able to overcome this limitation, which currently fails many tests.

@s-m-e
Copy link

s-m-e commented Jun 18, 2020

PATH_MAX is directly hard-coded in most operating systems, for instance in the Linux kernel. I have tried to alter it for testing purposes (in pjdfstest and libfuse2, however not in the kernel itself), but it pretty much always causes issues and inconsistencies in tests. I'd be interested in how this can be overcome, but from experience it's a very deep rabbit hole.

@s-m-e
Copy link

s-m-e commented Jun 18, 2020

Relevant discussions:

@asomers
Copy link
Collaborator

asomers commented Jun 18, 2020

It actually isn't hard-coded. The PATH_MAX in limits.h is considered a minimum, but different file systems can support different maximums. You can retrieve the per-file-system maximum at runtime with pathconf(2) or getconf(1). For example:

> getconf PATH_MAX .
1024

I think this would be a very reasonable enhancement to pjdfstest.

@mykaul
Copy link
Author

mykaul commented Jun 18, 2020

See https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/sysdeps/posix/pathconf.c#L89 - it does seem to be hard-coded based on the limits.h that was available for glibc compilation?

@asomers
Copy link
Collaborator

asomers commented Jun 18, 2020

Oh, wow, I didn't realize that Linux doesn't implement pathconf(2). That's lame. FreeBSD does, and there is currently one file system (smbfs) that returns a non-default value for _PC_PATH_MAX. It looks like OpenBSD, NetBSD, and OSX also implement pathconf(2).

@mykaul
Copy link
Author

mykaul commented Jun 19, 2020

I think pathconf is implemented in Linux, just not for PATH_MAX which is assumed to be statically defined.
I could not find the implementation on FreeBSD code, would be happy to take a look.

@asomers
Copy link
Collaborator

asomers commented Jun 19, 2020

My grep can't find a pathconf syscall in Linux. Here is the FreeBSD man page for the KPI: https://www.freebsd.org/cgi/man.cgi?query=VOP_PATHCONF&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html . And here is smbfs's implementation, which overrides the default PATH_MAX: https://svnweb.freebsd.org/base/head/sys/fs/smbfs/smbfs_vnops.c?view=markup#l913 .

@gaul
Copy link
Contributor

gaul commented Mar 29, 2021

This is also an issue with s3fs which can only support 1024 byte PATH_MAX due to S3 limitations s3fs-fuse/s3fs-fuse#1602.

asomers added a commit to asomers/pjdfstest that referenced this issue Jul 9, 2022
Because linkme does not work on FreeBSD 14.

This reverts commit 4f7c42c.

Issue pjd#42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants