Discussion:
Download Only If Newer
Add Reply
Gerard Seibert
2018-09-11 18:32:07 UTC
Reply
Permalink
Raw Message
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.
--
Gerard


-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.htm
Ray Satiro
2018-09-11 19:35:13 UTC
Reply
Permalink
Raw Message
Post by Gerard Seibert
I am using curl 7.61.1 on an amd64 FreeBSD 11.2 machine.
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/etiqu
Gerard Seibert
2018-09-12 09:41:45 UTC
Reply
Permalink
Raw Message
Sent: Tuesday, September 11, 2018 3:35 PM
Subject: Re: Download Only If Newer
Post by Gerard Seibert
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
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
https://github.com/curl/curl/blob/curl-7_61_1/src/tool_operate.c#L1861-
L1867
I am using Bash 4.4 here. I found that adding "&> /dev/null" to the command silenced the noise.
--
Gerard


-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https:/
Kees Nijssen
2018-09-12 15:26:48 UTC
Reply
Permalink
Raw Message
Post by Gerard Seibert
Sent: Tuesday, September 11, 2018 3:35 PM
Subject: Re: Download Only If Newer
Post by Gerard Seibert
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
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
...
I am using Bash 4.4 here. I found that adding "&> /dev/null" to the command silenced the noise.
--
Gerard
I see that you are using the --s option. Shouldn’t that be either the short form -s or the long form --silent to achieve what is promised in the manual?

With regards,

Kees

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: ht
Gerard Seibert
2018-09-12 15:54:39 UTC
Reply
Permalink
Raw Message
Nijssen
Sent: Wednesday, September 12, 2018 11:27 AM
Subject: Re: Download Only If Newer
Post by Gerard Seibert
Sent: Tuesday, September 11, 2018 3:35 PM
Subject: Re: Download Only If Newer
Post by Gerard Seibert
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
curl --s -L -R -z drop.txt -o drop.tmp
https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fww
w.spamhaus.org%2Fdrop%2Fdrop.txt&data=02%7C01%7C%7Cd09983b
d5a254
dcad4b508d618c53cc2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7
C636
723632732886107&sdata=xGHCdWbjZQ9eLLzGZCsPjncrZczUOEmEHcT4Y
2Qz2X
Post by Gerard Seibert
Post by Gerard Seibert
o%3D&reserved=0 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.
Post by Gerard Seibert
I have tried adding "2>&1" to the end of the command, but it doesn't
help.
Post by Gerard Seibert
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 ...
I am using Bash 4.4 here. I found that adding "&> /dev/null" to the
command silenced the noise.
Post by Gerard Seibert
--
Gerard
I see that you are using the --s option. Shouldn’t that be either the short
form -s or the long form --silent to achieve what is promised in the manual?
With regards,
Kees
I don't know. I just know that the change I did silences the error message.
--
Gerard
Loading...