A system installed gtransfer does not work as expected. The source URL is erroneously expanded to a weird file:// URL. Example:
$ gt -s gsiftp://host1.domain.tld:2811/~/bigfile -d gsiftp://hos2.domain.tld:2812/~/
.
error: Unable to list url file:////host1.domain.tld:2811/~/bigfile:
[globus_l_gass_copy_stat_file]: file not found in dir: /host1.domain.tld:2811/~/bigfile
ERROR: "globus-url-copy" failed. Please see "tgftp_transfer_21444__step_0.log" for details.
[...]
Cause
gtransfer uses halias to check if the source or destination URLs use host aliases. A host alias mustn't contain any slashes, hence everything after and including the first / of a URL is removed and fed to halias for a possible expansion - for a gsiftp:// URL, the assumed alias is gsiftp:.
But two if clauses in halias use too lax conditions. The function halias/dealias() is affected. This function makes two calls to the library function alias/dealias(), first to check if any user aliases match and if not to check if any system aliases match.
If e.g. there is no user aliases directory - which is the default - alias/dealias() will return 1 and the variable _dealiasedString is empty. Because of that:
the following if clause will be true (as an empty string differs from gsiftp:)
the assumed dealiased string (which is actually empty) is printed to stdout
the call to halias/dealias() will return 0 early before checking if any system aliases match.
Due to this issue gtransfer assumes gsiftp: expands to an empty string and a gsiftp:// URL like gsiftp://host1.domain.tld:2811/~/bigfile is first transformed to //host1.domain.tld:2811/~/bigfile and as it starts with a /, gtransfer adds file:// to it, as it assumes it is a path to a file and hence makes sure globus-url-copy will use file:// URLs for the transfer.
Workaround
Make sure to create $HOME/.gtransfer/aliases (either as file or as directory).
Solution
The two if clauses should also check the return value of alias/dealias(). This makes sure that halias/dealias() will print the input string instead of an empty string if an aliases directory (or file) is missing. If input string and dealiased string are identical, the input string is not a host alias and no expansion happens.
Problem
A system installed gtransfer does not work as expected. The source URL is erroneously expanded to a weird
file://
URL. Example:Cause
gtransfer
useshalias
to check if the source or destination URLs use host aliases. A host alias mustn't contain any slashes, hence everything after and including the first/
of a URL is removed and fed tohalias
for a possible expansion - for agsiftp://
URL, the assumed alias isgsiftp:
.But two if clauses in
halias
use too lax conditions. The functionhalias/dealias()
is affected. This function makes two calls to the library functionalias/dealias()
, first to check if any user aliases match and if not to check if any system aliases match.If e.g. there is no user aliases directory - which is the default -
alias/dealias()
will return1
and the variable_dealiasedString
is empty. Because of that:true
(as an empty string differs fromgsiftp:
)stdout
halias/dealias()
will return0
early before checking if any system aliases match.Due to this issue
gtransfer
assumesgsiftp:
expands to an empty string and agsiftp://
URL likegsiftp://host1.domain.tld:2811/~/bigfile
is first transformed to//host1.domain.tld:2811/~/bigfile
and as it starts with a/
, gtransfer addsfile://
to it, as it assumes it is a path to a file and hence makes sureglobus-url-copy
will usefile://
URLs for the transfer.Workaround
Make sure to create
$HOME/.gtransfer/aliases
(either as file or as directory).Solution
The two if clauses should also check the return value of
alias/dealias()
. This makes sure thathalias/dealias()
will print the input string instead of an empty string if an aliases directory (or file) is missing. If input string and dealiased string are identical, the input string is not a host alias and no expansion happens.