New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra zero-length file created after 7.42.0 appears to have broken -z option #237

Closed
vszakats opened this Issue Apr 23, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@vszakats
Member

vszakats commented Apr 23, 2015

This code example (Windows platform):

echo TESTTEST> index.html
curl -fR -z .\index.html https://example.org/index.html -o .\index.html.newer
echo %ERRORLEVEL%

will create a zero-length file and return result code 0 when using curl 7.42.0.

In previous versions it was returning result 0 but the zero-length file was not created, which seems to be the correct behavior, given that -z means to download only if there is a newer than the reference-file found on the server. New behavior also makes it not possible to use -z either by checking the result code (always 0) or the existence of the output (always created).

This seems to be related to update #183. Here, the description "curl: create output file on successful download of an empty file" (and Daniel's video) suggests that a zero-length file is only expected if the server actually serves a zero-length file, which is not the case in above scenario; the file on the server has a length of 1270 bytes.

Therefore I believe this to be a bug.

@bagder bagder added the regression label Apr 23, 2015

@bagder

This comment has been minimized.

Member

bagder commented Apr 23, 2015

@kdudka, feel like looking into this?

@kdudka kdudka self-assigned this Apr 23, 2015

@kdudka

This comment has been minimized.

Collaborator

kdudka commented Apr 23, 2015

Sure, I will have a look. Sorry for the breakage!

kdudka added a commit that referenced this issue Apr 23, 2015

curl -z: do not write empty file on unmet condition
This commit fixes a regression introduced in curl-7_41_0-186-g261a0fe.
It also introduces a regression test 1424 based on tests 78 and 1423.

Reported-by: Viktor Szakats
Bug: #237
@kdudka

This comment has been minimized.

Collaborator

kdudka commented Apr 23, 2015

Fixed in 710a2e9. Thanks for the bug report!

@kdudka kdudka closed this Apr 23, 2015

@vszakats

This comment has been minimized.

Member

vszakats commented Apr 23, 2015

Thank you guys for the quick fix!

kdudka added a commit that referenced this issue Apr 23, 2015

curl -z: do not write empty file on unmet condition
This commit fixes a regression introduced in curl-7_41_0-186-g261a0fe.
It also introduces a regression test 1424 based on tests 78 and 1423.

Reported-by: Viktor Szakats
Bug: #237

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue May 3, 2015

wiz
Update to 7.42.1:
Version 7.42.1 (28 Apr 2015)

Daniel Stenberg (28 Apr 2015)
- RELEASE-NOTES: 7.42.1 ready

- CURLOPT_HEADEROPT: default to separate

  Make the HTTP headers separated by default for improved security and
  reduced risk for information leakage.

  Bug: http://curl.haxx.se/docs/adv_20150429.html
  Reported-by: Yehezkel Horowitz, Oren Souroujon

- RELEASE-NOTES: synced with a6e0270e

- sws: init http2 state properly

  It would otherwise cause problems when running tests after 1801 etc.

- curl_easy_getinfo.3: document 'internals' in CURLINFO_TLS_SESSION

  ... as it was previouly undocumented what the pointer was.

- openssl: fix serial number output

  The code extracting the cert serial number was broken and didn't display
  it properly.

  Bug: curl/curl#235
  Reported-by: dkjjr89

- [Alessandro Ghedini brought this change]

  curl.1: fix typo

- RELEASE-NOTES: toward 7.42.1, synced with 097460a

- [Kamil Dudka brought this change]

  curl -z: do not write empty file on unmet condition

  This commit fixes a regression introduced in curl-7_41_0-186-g261a0fe.
  It also introduces a regression test 1424 based on tests 78 and 1423.

  Reported-by: Viktor Szakats
  Bug: curl/curl#237

- [Kamil Dudka brought this change]

  docs: distribute the CURLOPT_PINNEDPUBLICKEY(3) man page, too

- connectionexists: follow-up to fd9d3a1ef1f

  PROTOPT_CREDSPERREQUEST still needs to be checked even when NTLM is not
  enabled.

  Mistake-caught-by: Kamil Dudka

- connectionexists: fix build without NTLM

  Do not access NTLM-specific struct fields when built without NTLM
  enabled!

  bug: http://curl.haxx.se/?i=231
  Reported-by: Patrick Rapin

- dist: include {src,lib}/checksrc.whitelist

mamash pushed a commit to joyent/pkgsrc-legacy that referenced this issue Sep 18, 2015

wiz Filip Hajny
Update to 7.42.1:
Version 7.42.1 (28 Apr 2015)

Daniel Stenberg (28 Apr 2015)
- RELEASE-NOTES: 7.42.1 ready

- CURLOPT_HEADEROPT: default to separate

  Make the HTTP headers separated by default for improved security and
  reduced risk for information leakage.

  Bug: http://curl.haxx.se/docs/adv_20150429.html
  Reported-by: Yehezkel Horowitz, Oren Souroujon

- RELEASE-NOTES: synced with a6e0270e

- sws: init http2 state properly

  It would otherwise cause problems when running tests after 1801 etc.

- curl_easy_getinfo.3: document 'internals' in CURLINFO_TLS_SESSION

  ... as it was previouly undocumented what the pointer was.

- openssl: fix serial number output

  The code extracting the cert serial number was broken and didn't display
  it properly.

  Bug: curl/curl#235
  Reported-by: dkjjr89

- [Alessandro Ghedini brought this change]

  curl.1: fix typo

- RELEASE-NOTES: toward 7.42.1, synced with 097460a

- [Kamil Dudka brought this change]

  curl -z: do not write empty file on unmet condition

  This commit fixes a regression introduced in curl-7_41_0-186-g261a0fe.
  It also introduces a regression test 1424 based on tests 78 and 1423.

  Reported-by: Viktor Szakats
  Bug: curl/curl#237

- [Kamil Dudka brought this change]

  docs: distribute the CURLOPT_PINNEDPUBLICKEY(3) man page, too

- connectionexists: follow-up to fd9d3a1ef1f

  PROTOPT_CREDSPERREQUEST still needs to be checked even when NTLM is not
  enabled.

  Mistake-caught-by: Kamil Dudka

- connectionexists: fix build without NTLM

  Do not access NTLM-specific struct fields when built without NTLM
  enabled!

  bug: http://curl.haxx.se/?i=231
  Reported-by: Patrick Rapin

- dist: include {src,lib}/checksrc.whitelist

jgsogo added a commit to jgsogo/curl that referenced this issue Oct 19, 2015

curl -z: do not write empty file on unmet condition
This commit fixes a regression introduced in curl-7_41_0-186-g261a0fe.
It also introduces a regression test 1424 based on tests 78 and 1423.

Reported-by: Viktor Szakats
Bug: curl#237

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.