From eccc2de85328e2e4dc5df861c5a0667e78fb6c38 Mon Sep 17 00:00:00 2001 From: Michal Simon Date: Mon, 6 Apr 2020 17:55:36 +0200 Subject: [PATCH] [XrdCl] Iron out final details for checksum type inference. --- src/XrdCl/XrdClClassicCopyJob.cc | 5 ++++- src/XrdCl/XrdClUtils.cc | 14 ++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/XrdCl/XrdClClassicCopyJob.cc b/src/XrdCl/XrdClClassicCopyJob.cc index a3d452a202a..49a49902dfd 100644 --- a/src/XrdCl/XrdClClassicCopyJob.cc +++ b/src/XrdCl/XrdClClassicCopyJob.cc @@ -1585,7 +1585,10 @@ namespace XrdCl { checkSumType = Utils::InferChecksumType( GetSource(), GetTarget(), zip ); if( checkSumType.empty() ) - log->Info( UtilityMsg, "Could not infer checksum type." ); + { + log->Warning( UtilityMsg, "Could not infer checksum type." ); + checkSumMode = ""; + } else log->Info( UtilityMsg, "Using inferred checksum type: %s.", checkSumType.c_str() ); } diff --git a/src/XrdCl/XrdClUtils.cc b/src/XrdCl/XrdClUtils.cc index 8f6b4b9e613..c2c85aaf9b1 100644 --- a/src/XrdCl/XrdClUtils.cc +++ b/src/XrdCl/XrdClUtils.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -623,7 +624,11 @@ namespace XrdCl { size_t pos = itr->find( ':' ); if( pos == std::string::npos ) continue; - ret.push_back( itr->substr( pos + 1 ) ); + std::string cksname = itr->substr( pos + 1 ); + // remove all white spaces + cksname.erase( std::remove_if( cksname.begin(), cksname.end(), ::isspace ), + cksname.end() ); + ret.push_back( std::move( cksname ) ); } } } @@ -642,13 +647,14 @@ namespace XrdCl //-------------------------------------------------------------------------- // If both files are local we wont be checksumming at all //-------------------------------------------------------------------------- - if( source.IsLocalFile() && destination.IsLocalFile() ) return std::string(); + if( source.IsLocalFile() && !source.IsMetalink() && destination.IsLocalFile() ) return std::string(); // checksums supported by local files std::set local_supported; local_supported.insert( "adler32" ); local_supported.insert( "crc32" ); local_supported.insert( "md5" ); + local_supported.insert( "zcrc32" ); std::vector srccks; @@ -696,7 +702,7 @@ namespace XrdCl // If the destination is a remote endpoint query the supported checksums //------------------------------------------------------------------------ std::vector cks = GetSupportedCheckSums( destination ); - srccks.insert( dstcks.end(), cks.begin(), cks.end() ); + dstcks.insert( dstcks.end(), cks.begin(), cks.end() ); } //-------------------------------------------------------------------------- @@ -705,7 +711,7 @@ namespace XrdCl // // First check if source is local //-------------------------------------------------------------------------- - if( source.IsLocalFile() ) + if( source.IsLocalFile() && !source.IsMetalink() ) { std::vector::iterator itr = dstcks.begin(); for( ; itr != dstcks.end(); ++itr )