clojure.java.io/copy incorrectly stops copying on 0 byte read

Description

Reported at https://ask.clojure.org/index.php/8450/strange-behavior-with-clojure-java-io-copy

Actual copying is implemented by reading bytes from an InputStream and writing to an OutputStream. The copy loop terminates if the bytes read is not >0. However, 0 is a legal return value (only -1 indicates EOF).

Approach: Termination condition should be >= 0, not > 0.

Patch: clj-2533-2.patch

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

Prescreened

Patch

Code

Affects versions

Priority

Minor
Configure