Skip to content

cephfs.pyx: handle when UID/GID passed to chown() is -1#64999

Merged
rishabh-d-dave merged 2 commits intoceph:mainfrom
rishabh-d-dave:fs-pyx-chown
Sep 9, 2025
Merged

cephfs.pyx: handle when UID/GID passed to chown() is -1#64999
rishabh-d-dave merged 2 commits intoceph:mainfrom
rishabh-d-dave:fs-pyx-chown

Conversation

@rishabh-d-dave
Copy link
Contributor

@rishabh-d-dave rishabh-d-dave commented Aug 12, 2025

When chown() in libcephfs call receives -1 as the value of UID/GID, it
is implicitly converted from signed integer to unsigned integeer but
CephFS cython instead of doing that errors out during complilation.
Therefore make this conversion explicitly to allow users to pass -1
(which they do to indicate that UID/GID value shouldn't be changed) and
also for sake of uniformity and consistency between between CephFS
cython and libcephfs interface.

Fixes: https://tracker.ceph.com/issues/72547
Introduced-by: 65328ac, PR #62934.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@rishabh-d-dave
Copy link
Contributor Author

.

Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. Please add a comment to the conversion noting this works around:

OverflowError: can't convert negative value to gid_t .

When chown() in libcephfs call receives -1 as the value of UID/GID, it
is implicitly converted from signed integer to unsigned integeer but
CephFS cython instead of doing that errors out during complilation.
Therefore make this conversion explicitly to allow users to pass -1
(which they do to indicate that UID/GID value shouldn't be changed) and
also for sake of uniformity and consistency between between CephFS
cython and libcephfs interface.

Fixes: https://tracker.ceph.com/issues/72547
Introduced-by: 65328ac
Signed-off-by: Rishabh Dave <ridave@redhat.com>
@rishabh-d-dave
Copy link
Contributor Author

Good work. Please add a comment to the conversion noting this works around:

OverflowError: can't convert negative value to gid_t .

Done.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
@rishabh-d-dave
Copy link
Contributor Author

@rishabh-d-dave
Copy link
Contributor Author

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@vshankar
Copy link
Contributor

This PR is under test in https://tracker.ceph.com/issues/72684.

Copy link
Contributor

@vshankar vshankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vshankar
Copy link
Contributor

vshankar commented Sep 1, 2025

jenkins retest this please

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test api

@rishabh-d-dave
Copy link
Contributor Author

rishabh-d-dave commented Sep 9, 2025

@vshankar CI is green, can we merge this PR?

@rishabh-d-dave rishabh-d-dave merged commit 9c7cda9 into ceph:main Sep 9, 2025
13 checks passed
@rishabh-d-dave rishabh-d-dave deleted the fs-pyx-chown branch September 9, 2025 03:55
rishabh-d-dave added a commit to rishabh-d-dave/ceph that referenced this pull request Oct 16, 2025
Run test_python.sh with non-root user. This makes it necessary to change
the owner user and group of file system root to be same as this non-root
user. This brings testing closer to the real-world scenario and also
allows exercising negative tests where an FS op would fail for a non-root
user but it would pass for root user.

There are few tests that exercise FS operations where root user is
needed. Group these tests under a separate class and add extra code for
this class that allows these tests to run with root UID and GID.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 6021dda)

Conflicts:
src/test/pybind/test_cephfs.py
- PR ceph#64999 is merged in main but not in Squid, causing this branch to
  have less tests that need to be moved to class TestWithRootUser.
rishabh-d-dave added a commit to rishabh-d-dave/ceph that referenced this pull request Oct 16, 2025
Run test_python.sh with non-root user. This makes it necessary to change
the owner user and group of file system root to be same as this non-root
user. This brings testing closer to the real-world scenario and also
allows exercising negative tests where an FS op would fail for a non-root
user but it would pass for root user.

There are few tests that exercise FS operations where root user is
needed. Group these tests under a separate class and add extra code for
this class that allows these tests to run with root UID and GID.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 6021dda)

Conflicts:
src/test/pybind/test_cephfs.py
- PR ceph#64999 is merged in main but not in Reef (bug is absent in Reef),
  causing this file to have less tests that need to be moved to class
  TestWithRootUser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants