morningman opened a new pull request, #67836:
URL: https://github.com/apache/doris/pull/67836

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #66773
   
   Problem Summary:
   
   `localfs_error(int posix_errno, msg)`, `errno_to_str()` and `hdfs_error()` 
in `be/src/io/fs/err_utils.cpp` format the return value of `strerror_r()` 
straight into the message. That is the text on glibc, whose `strerror_r` 
returns `char*`, but the POSIX flavour on macOS and musl returns an `int` and 
fills the buffer instead, so there the message reads `failed to read <path>: 0`.
   
   The ORC reader (and the other readers that copy the pattern) tells NotFound 
apart from any other open failure by looking for `"No such file or directory"` 
in the text, so on macOS an ENOENT surfaces as INTERNAL_ERROR and 
`NewOrcReaderTest.InitRestoresNotFoundFromReadFailure` (added by #66773) fails.
   
   This spells the errno through `std::generic_category().message()` instead, 
which is what the `std::error_code` overload in the same file already does; it 
reads the same on both libcs and is thread safe. `localfs_error(int, ...)` also 
described the global `errno` rather than its `posix_errno` argument - every 
caller passes `errno` itself, so nothing changes, but it now says what it 
classifies.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
       - [x] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
       On macOS, `doris_be_test` built for the io/fs, ORC and Iceberg reader 
suites (`FileHandleCacheTest`, `HdfsFileSystemTest`, `HdfsMgrTest`, 
`VfileScannerExceptionTest`, `NewOrcReaderTest`, `OrcFileInputStreamTest`, 
`IcebergReaderTest`, `IcebergV2ReaderTest`, 
`IcebergDeleteFileReaderHelperTest`): 357 tests pass, including 
`InitRestoresNotFoundFromReadFailure` and `InitKeepsInternalErrorForDirectory`, 
which failed before. On Linux the message text is unchanged.
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01BocZ8hbRkSYWhGAiQC5MM1
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to