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

streamWrapper::stream_lock() operation/mode listing is inconsistent #4299

Open
adam-vessey opened this issue Dec 12, 2024 · 0 comments
Open

Comments

@adam-vessey
Copy link

adam-vessey commented Dec 12, 2024

It is presently indicated that valid values are in the set of:

  • LOCK_SH
  • LOCK_EX
  • LOCK_UN
  • LOCK_NB

The underlying implementation appears to allow more like:

  • LOCK_SH
  • LOCK_EX
  • LOCK_UN
  • LOCK_SH | LOCK_NB (the | denoting a bit-wise OR)
  • LOCK_EX | LOCK_NB
  • LOCK_UN | LOCK_NB (though this one might not make sense? To release locks non-blockingly?)

The initial comparison should reject LOCK_NB being passed on its own, since LOCK_NB & LOCK_UN == 4 & 3 == 0b100 & 0b011 == 0, and 0 < 1.

Somewhat of an aside, just for context, but: I got looking into this due to Drupal's implementation which makes reference to the presently documented set of values. An aside to the aside: due to Drupal's returning TRUE for operations/modes outside of the given (possibly due to the the concept of success/failure being ambiguous in the function signature?), Drupal can fail to correctly manage locks when attempting to do things with LOCK_NB. Created an issue over there to look at getting it dealt with: https://www.drupal.org/project/drupal/issues/3493632

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

1 participant