curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: Download Only If Newer

From: Ray Satiro <raysatiro_at_yahoo.com>
Date: Tue, 11 Sep 2018 15:35:13 -0400

On 9/11/2018 2:32 PM, Gerard Seibert wrote:
> I am using curl 7.61.1 on an amd64 FreeBSD 11.2 machine.
>
> I am trying to download a file from SpamHaus, but only if it is newer. This is the command line syntax I am using:
>
> curl --s -L -R -z drop.txt -o drop.tmp https://www.spamhaus.org/drop/drop.txt
> Failed to set filetime 1536603588 on outfile: No such file or directory
>
> As you can see, if the file is not newer, it produces an error message. I am trying to find a way to suppress that error message, but without any success. I have tried adding "2>&1" to the end of the command, but it doesn't help.

curl's --silent is documented as "Don't show progress meter or error
messages." [1] but does not go as far as changing the error stream which
is what you are seeing [2]. That could be clarified or fixed. The reason
2>&1 doesn't work is because you are redirecting stderr to stdout which
is unchanged. You could 2>/dev/null or 1>/dev/null 2>&1 or to a lesser
extent --stderr /dev/null, but that last one won't stop a library
libcurl uses from outputting to stderr (which should not happen but you
never know). curl is trying to set the filetime [4] on a file that
(presumably) doesn't exist which seems like a bug.

[1]: https://curl.haxx.se/docs/manpage.html#-s
[2]: https://github.com/curl/curl/blob/curl-7_61_1/src/tool_filetime.c#L136
[3]: https://curl.haxx.se/docs/manpage.html#--stderr
[4]:
https://github.com/curl/curl/blob/curl-7_61_1/src/tool_operate.c#L1861-L1867

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-09-11