GH-39385: [C++] Use more permissable return code for rename#39481
Merged
kou merged 1 commit intoapache:mainfrom Jan 9, 2024
Merged
GH-39385: [C++] Use more permissable return code for rename#39481kou merged 1 commit intoapache:mainfrom
kou merged 1 commit intoapache:mainfrom
Conversation
|
|
felipecrv
approved these changes
Jan 5, 2024
kou
approved these changes
Jan 6, 2024
cpp/src/arrow/filesystem/localfs.cc
Outdated
Member
There was a problem hiding this comment.
How about using != 0 not < 0 for "non-zero"?
Contributor
Author
There was a problem hiding this comment.
Good suggestion! I changed it.
felipecrv
approved these changes
Jan 9, 2024
|
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit b101c01. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them. |
dgreiss
pushed a commit
to dgreiss/arrow
that referenced
this pull request
Feb 19, 2024
…ache#39481) ### Rationale for this change While the `rename` [system call](https://man7.org/linux/man-pages/man2/rename.2.html) and [Posix standard](https://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html) do specify that a return value of -1 is expected for error calls, the [C++ reference](https://en.cppreference.com/w/cpp/io/c/rename) specifies that a "non-zero" is returned upon error. This PR proposes changing to the more encompassing "non-zero" check for `std::rename`. ### Are these changes tested? There are existing tests: https://github.com/apache/arrow/blob/afb40a9f5a33802897e1d5bae8305c81da7beee1/cpp/src/arrow/filesystem/filesystem_test.cc#L701C3-L701C3 * Closes: apache#39385 Authored-by: anjakefala <anja@voltrondata.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
While the
renamesystem call and Posix standard do specify that a return value of -1 is expected for error calls, the C++ reference specifies that a "non-zero" is returned upon error.This PR proposes changing to the more encompassing "non-zero" check for
std::rename.Are these changes tested?
There are existing tests: https://github.com/apache/arrow/blob/afb40a9f5a33802897e1d5bae8305c81da7beee1/cpp/src/arrow/filesystem/filesystem_test.cc#L701C3-L701C3
renamecall inLocalFileSystem::Move. #39385