From 26a02cb3869a36905626a3c70b93f1fa59e2ec2e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 25 Sep 2018 13:38:20 -0400 Subject: [PATCH] display error when an invalid url is downloaded download is documented as displaying an error when download fails, but it didn't when the url was not valid at all. That leads to confusing behavior. Also, display the url with --debug --- Utility/Url.hs | 5 ++++- ...lic_S3_bucket_where_it_exported_before.mdwn | 3 +++ ...1_08514c489b916b2ae8e4e0122051856f._comment | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before/comment_1_08514c489b916b2ae8e4e0122051856f._comment diff --git a/Utility/Url.hs b/Utility/Url.hs index 92e60b3354..3fd02fd432 100644 --- a/Utility/Url.hs +++ b/Utility/Url.hs @@ -311,7 +311,10 @@ download meterupdate url file uo = (DownloadWithCurl _, _) | isfileurl u -> downloadfile u | otherwise -> downloadcurl - Nothing -> return False + Nothing -> do + liftIO $ debugM "url" url + hPutStrLn stderr "download failed: invalid url" + return False isfileurl u = uriScheme u == "file:" diff --git a/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before.mdwn b/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before.mdwn index 7cb3f63372..304f585a0a 100644 --- a/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before.mdwn +++ b/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before.mdwn @@ -120,3 +120,6 @@ It would be nice, before introducing versioning information as you outlined in t [[!meta author=yoh]] + +> Added an error message when download of an invalid url is attempted +> and also made the url be listed by --debug. [[done]] --[[Joey]] diff --git a/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before/comment_1_08514c489b916b2ae8e4e0122051856f._comment b/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before/comment_1_08514c489b916b2ae8e4e0122051856f._comment new file mode 100644 index 0000000000..769f0f3f59 --- /dev/null +++ b/doc/bugs/unclear_why_annex_fails_to_get_a_file_from_a_public_S3_bucket_where_it_exported_before/comment_1_08514c489b916b2ae8e4e0122051856f._comment @@ -0,0 +1,18 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2018-09-25T17:31:36Z" + content=""" +Misconfiguration: + + joey@darkstar:~/tmp/ds001419>git show git-annex:remote.log | grep openneuro.org + 336309c0-d7f8-430e-bd2b-4bdc61e587cb bucket=openneuro.org datacenter=US encryption=none exporttree=yes fileprefix=ds001419/ host=s3.amazonaws.com name=s3-PUBLIC partsize=1GiB port=80 public=yes publicurl=yes storageclass=STANDARD type=S3 timestamp=1537895418.565736858s + +publicurl=yes means that the bucket's url is "yes". + +Since constructing an URI object from that invalid url fails, the url +downloader fails early and this avoids the debug output that would normally be +shown too when downloading an url by recent versions of git-annex. + +This also explains probably why whereis doesn't list any urls. +"""]]