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

magic number 392 should be removed (it is very close to #define MAX_PATHNAME_LENGTH 393) #72

Open
ktarbet opened this issue Mar 11, 2022 · 1 comment
Labels
invalid This doesn't seem right

Comments

@ktarbet
Copy link
Contributor

ktarbet commented Mar 11, 2022

The number 393 is used in both Fortran and C code in several places. Usually related to a maximum total length of a pathname.

@ktarbet ktarbet added the invalid This doesn't seem right label Mar 11, 2022
@perrymanmd
Copy link
Contributor

Nothing should've been 393. I think that number came from someone thinking a pathname could have 392 characters, which which it could not have. The max number of characters with 64-character parts = 6 (parts) * 64 chars + 7 slash chars = 391 characters. So the max length was 391 which should be used in Fortran, and the max char array size in C would be 392 to accommodate the trailing NULL. So these should've been the definitions, with 393 nowhere in sight:

  • MAX_PART_LENGTH = 64
  • MAX_PART_SIZE = 65
  • MAX_PATHNAME_LEN = 391
  • MAX_PATHNAME_SIZE = 392
    In our current state with increased part length, but same pathname length, they should be:
  • MAX_PART_LENGTH = 128
  • MAX_PART_SIZE = 129
  • MAX_PATHNAME_LEN = 391
  • MAX_PATHNAME_SIZE = 392
    If we allow all parts to be 128 characters, the values should go to
  • MAX_PART_LENGTH = 128
  • MAX_PART_SIZE = 129
  • MAX_PATHNAME_LEN = 775
  • MAX_PATHNAME_SIZE = 776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants