Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12562

Viewing the diff of text file containing some NULL bytes causes an empty diff to be returned


      Issue Summary

      Viewing the diff of a text file that also contains a NULL byte can fail.

      Steps to Reproduce

      1. Create a text file and commit it
        printf '0%.0s' {1..8200} > file && git add file && git commit -m'Committed file'
      2. Add a NULL byte after 8200 bytes somewhere in the file and commit
        printf '\0' >> file && git commit -am'Added NULL byte'
      3. Push to Bitbucket
      4. View the diff of the commit

      Expected Results

      The diff is displayed correctly

      Actual Results

      About 50% of the time, the diff of the file is not shown and a spinner is displayed indefinitely.

      The below message is logged in the atlassian-bitbucket.log file (with debug logging enabled):

      2020-09-02 15:54:33,048 DEBUG [http-nio-7990-exec-3] admin @R62JNHx954x834x1 1rqr69w 0:0:0:0:0:0:0:1 "GET /rest/api/latest/projects/PROJECT_1/repos/test/commits/d05b6df9815f3125192b9c5cdc344d7c04ac5ace/diff/file HTTP/1.1" c.a.b.i.p.nu.NioNuProcessHandler [/usr/local/bin/git diff -C --color=never -U10 --dst-prefix=dst:// --src-prefix=src:// a270f5e93c74d1389ef5483e0fb6ccd5cd319e94 d05b6df9815f3125192b9c5cdc344d7c04ac5ace -- file]: Dropping callback invocation (Canceled: true; Timed out: false)

      The above message does not necessarily always indicate a problem and can occur during normal operation, such as when a diff is truncated intentionally. It is just a symptom of this bug.


      Currently there is no known workaround for this behavior. A workaround will be added here when available.

            Unassigned Unassigned
            wkritzinger Wolfgang Kritzinger
            1 Vote for this issue
            3 Start watching this issue