-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[C++] Reviewing the rename
call in LocalFileSystem::Move
.
#39385
Comments
For reference, the |
So generally I think it's ok here |
Out of curiousity, how did you figure out it was defined in |
Oh it might in After find the api, we can know where we should include |
I think the C++ standard, when defining I wouldn't oppose changing the code from [1] https://github.com/llvm/llvm-project/blob/main/libcxx/include/cstdio#L157 |
Oh, thank you for explaining why it does not have the |
### 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: #39385 Authored-by: anjakefala <anja@voltrondata.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
…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>
…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>
…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>
Describe the enhancement requested
LocalFileSystem::Move
on non-Windows, callsrename
: https://github.com/apache/arrow/blob/main/cpp/src/arrow/filesystem/localfs.cc#L585. It then does a check for -1, and prints the error.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.I have two questions:
rename
that is being called inLocalFileSystem::Move
the one instd::
? Should it be prefaced withstd::
?std::rename
returns a different number other than -1 upon error?Component(s)
C++
The text was updated successfully, but these errors were encountered: