Skip to content

Commit

Permalink
xrootd : use lower case for checksum algorithm names when replying
Browse files Browse the repository at this point in the history
          to checksum queries.

Motivation:

     xrdcp --cksum adler:value ...
and
     xrdcp --cksum adler:print ...

does not work because dCache replies with ADLER32 which xrdcp
fails to match to adler32.

Issie : xrootd/xrootd#459

Modification:

Return lower case "adler32" in xrootd door.

Result:
     xrdcp --cksum adler:value ...
and
     xrdcp --cksum adler:print ...
work.

xrdfs .... query checksum /path
returns lower case "adler32" (or "md5")

    RB: https://rb.dcache.org/r/10051/
    Ack-ed: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
    Require-notes: yes
    Require-book: no
    Target: trunk
    Request: 2.13
    Request: 2.16
    Request: 3.0
(cherry picked from commit 3d91506)
  • Loading branch information
DmitryLitvintsev committed Feb 10, 2017
1 parent a9513b3 commit 3fb86ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Expand Up @@ -462,7 +462,12 @@ protected XrootdResponse<QueryRequest> doOnQuery(ChannelHandlerContext ctx, Quer
s.append(0);
break;
case "csname":
s.append("1:ADLER32,2:MD5");
/**
* xrdcp expects lower case names for checksum algorithms
* https://github.com/xrootd/xrootd/issues/459
* TODO: revert to upper case then above issue is addressed
*/
s.append("1:adler32,2:md5");
break;
case "version":
s.append("dCache ").append(Version.of(XrootdRedirectHandler.class).getVersion());
Expand All @@ -480,7 +485,13 @@ protected XrootdResponse<QueryRequest> doOnQuery(ChannelHandlerContext ctx, Quer
Set<Checksum> checksums = _door.getChecksums(createFullPath(msg.getArgs()), msg.getSubject());
if (!checksums.isEmpty()) {
Checksum checksum = Checksums.preferrredOrder().min(checksums);
return new QueryResponse(msg, checksum.getType().getName() + " " + checksum.getValue());
/**
* xrdcp expects lower case names for checksum algorithms
* https://github.com/xrootd/xrootd/issues/459
* TODO: remove toLowerCase() call when above issue is addressed
*/
return new QueryResponse(msg,
checksum.getType().getName().toLowerCase() + " " + checksum.getValue());
}
} catch (FileNotFoundCacheException e) {
throw new XrootdException(kXR_NotFound, e.getMessage());
Expand Down
Expand Up @@ -616,7 +616,12 @@ protected XrootdResponse<QueryRequest> doOnQuery(ChannelHandlerContext ctx, Quer
throw new XrootdException(kXR_Unsupported, "No checksum available for this file.");
}
Checksum checksum = Checksums.preferrredOrder().min(attributes.getChecksums());
return new QueryResponse(msg, checksum.getType().getName() + " " + checksum.getValue());
/**
* xrdcp expects lower case names for checksum algorithms
* https://github.com/xrootd/xrootd/issues/459
* TODO: remove toLowerCase() call when above issue is addressed
*/
return new QueryResponse(msg, checksum.getType().getName().toLowerCase() + " " + checksum.getValue());

default:
return unsupported(ctx, msg);
Expand Down

0 comments on commit 3fb86ad

Please sign in to comment.