You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/03/23 17:04:31 UTC

[GitHub] [hadoop] goiri commented on a change in pull request #2792: HDFS-15909. Make fnmatch cross platform

goiri commented on a change in pull request #2792:
URL: https://github.com/apache/hadoop/pull/2792#discussion_r599761580



##########
File path: hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc
##########
@@ -722,16 +722,16 @@ void FileSystemImpl::FindShim(const Status &stat, const std::vector<StatInfo> &
       for (StatInfo const& si : stat_infos) {
         //If we are at the last depth and it matches both path and name, we need to output it.
         if (operational_state->depth == shared_state->dirs.size() - 2
-            && !fnmatch(shared_state->dirs[operational_state->depth + 1].c_str(), si.path.c_str(), 0)
-            && !fnmatch(shared_state->name.c_str(), si.path.c_str(), 0)) {
+            && XPlatform::Syscall::FnMatch(shared_state->dirs[operational_state->depth + 1], si.path)
+            && XPlatform::Syscall::FnMatch(shared_state->name, si.path)) {
           outputs.push_back(si);
         }
         //Skip if not directory
         if(si.file_type != StatInfo::IS_DIR) {
           continue;
         }
         //Checking for a match with the path at the current depth
-        if(!fnmatch(shared_state->dirs[operational_state->depth + 1].c_str(), si.path.c_str(), 0)){
+        if(XPlatform::Syscall::FnMatch(shared_state->dirs[operational_state->depth + 1], si.path)) {

Review comment:
       XPlatform::Syscall::FnMatch is equivalent to !fnmatch?
   I have to say that the original was a little antiintuitive.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org