Print

Print


Hi Andy,
there is some confusion about 'xrdcp -f' .... the documentation says it
(re-)creates a file, but if I strace a standard xrootd (3.0.4) it is just an
open with
a truncate flag e.g. you just overwrite the existing file.

[pid 32708] lstat("/tmp/t1", {st_mode=S_IFREG|0644, st_size=2007, ...}) = 0
[pid 32708] open("/tmp/t1", O_RDWR|O_CREAT|O_TRUNC, 0664) = 21
[pid 32708] close(21)                   = 0
[pid 32708] open("/tmp/t1", O_RDWR|O_TRUNC) = 21
[pid 32708] fcntl(21, F_DUPFD, 512)     = 512
[pid 32708] close(21)                   = 0
[pid 32708] fcntl(512, F_SETFD, FD_CLOEXEC) = 0
[pid 32708] fstat(512, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 32708] lstat("/tmp/t1", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 32708] fstat(512, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 32708] pwrite(512, "root:x:0:0:root:/root:/bin/bash\n"..., 2007, 0) =
2007
pid 32708] close(512)

Is that correct? ... because in the protocol documentation it says also:
*
kXR_delete*        - open a new file, deleting any existing file

Also the client has some weird code, it tries to remove the file if it is
not found ....

if ( (cli->LastServerError()->errnum == kXR_NotFound)
           && (options & kXR_delete) ) {
         // We silently try to remove the dest file, ignoring the result
         XrdClientAdmin adm(cli->GetCurrentUrl().GetUrl().c_str());
         if (adm.Connect()) {
            adm.Rm( cli->GetCurrentUrl().File.c_str() );
         }

Cheers Andreas.