Conversation
src/client/Client.cc
Outdated
| de->d_off = next_off; | ||
| #endif | ||
| de->d_reclen = 1; | ||
| de->d_reclen = (uintptr_t)last - (uintptr_t)de + 1; |
There was a problem hiding this comment.
Good catch. Just FYI - I had discussed this with @xhernandez over chat and the issue cropped up when developing proxy b/w samba and libcephfs where d_reclen was relied on.
75ef6f4 to
7c93093
Compare
src/client/Client.cc
Outdated
| int len = strlen(name); | ||
| if (len > 255) { | ||
| len = 255; | ||
| } |
There was a problem hiding this comment.
| int len = strlen(name); | |
| if (len > 255) { | |
| len = 255; | |
| } | |
| size_t len = strlen(name); | |
| len = min(len, (size_t)255); |
int could get prone to overflow, therefore switched to using size_t (memcpy()'s len arg is indeed of type size_t too) and using min() looks a bit cleaner.
There was a problem hiding this comment.
It's very unlikely that it will overflow, but anyway size_t is better. I'll change this.
|
jenkins test make check |
6e0420e to
6cd297a
Compare
src/client/Client.cc
Outdated
| size_t len = strlen(name); | ||
| len = std::min(len, (size_t)255); | ||
| memcpy(de->d_name, name, len); | ||
| de->d_name[len] = 0; |
There was a problem hiding this comment.
so now it's switched from string termination char to int 0?
Based on the man page of readdir(3), the d_reclen field should contain the total size of the record, which varies depending on the length of the returned name. However, the previous implementation was returning a hardcoded '1' in all cases. This patch computes the right size of the record and returns it. Fixes: https://tracker.ceph.com/issues/65389 Signed-off-by: Xavi Hernandez <[email protected]>
fe758eb to
5ac0165
Compare
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test make check arm64 |
|
This PR is under test in https://tracker.ceph.com/issues/68089. |
|
jenkins test make check arm64 |
1 similar comment
|
jenkins test make check arm64 |
|
This PR is under test in https://tracker.ceph.com/issues/68170. |
Based on the man page of readdir(3), the d_reclen field should contain the total size of the record, which varies depending on the length of the returned name. However, the previous implementation was returning a hardcoded '1' in all cases.
This patch computes the right size of the record and returns it.
Fixes: https://tracker.ceph.com/issues/65389
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e