Skip to content

GH-39385: [C++] Use more permissable return code for rename#39481

Merged
kou merged 1 commit intoapache:mainfrom
anjakefala:kef/39385
Jan 9, 2024
Merged

GH-39385: [C++] Use more permissable return code for rename#39481
kou merged 1 commit intoapache:mainfrom
anjakefala:kef/39385

Conversation

@anjakefala
Copy link
Copy Markdown
Contributor

@anjakefala anjakefala commented Jan 5, 2024

Rationale for this change

While the rename system 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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 5, 2024

⚠️ GitHub issue #39385 has been automatically assigned in GitHub to PR creator.

@anjakefala anjakefala marked this pull request as ready for review January 5, 2024 22:27
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 5, 2024
Copy link
Copy Markdown
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about using != 0 not < 0 for "non-zero"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion! I changed it.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Jan 6, 2024
@kou kou merged commit b101c01 into apache:main Jan 9, 2024
@kou kou removed the awaiting merge Awaiting merge label Jan 9, 2024
@conbench-apache-arrow
Copy link
Copy Markdown

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>
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.

[C++] Reviewing the rename call in LocalFileSystem::Move.

3 participants