reg-cli icon indicating copy to clipboard operation
reg-cli copied to clipboard

Hangs when improper image content is encountered instead of dying

Open Peter-Sparksuite opened this issue 10 months ago • 0 comments

Describe the bug

Tooling that produces the images shouldn't be producing invalid png images, but, it seems, pngjs is hypersensitive in some regard. When this happens, details about the error are displayed (stack trace & error message), but, the reg-cli tool hangs instead of completing.

/node_modules/pngjs/lib/parser.js:48
      this.error(new Error("Invalid file signature"));
                 ^

Error: Invalid file signature
    at Parser._parseSignature (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/parser.js:48:18)
    at ChunkStream._processRead (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:160:13)
    at ChunkStream._process (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:175:14)
    at ChunkStream.write (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:57:8)
    at PNG.write (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/png.js:95:16)
    at ReadStream.ondata (node:internal/streams/readable:809:22)
    at ReadStream.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)

Node.js v18.20.1

Reproduced step

Steps to reproduce the behavior:

  1. Images for comparison are created, with one or more having details that pnpjs appears to consider invalid
  2. Run the reg-cli tool, specifying the new image folder path, the old image folder path, a path for the temp folder, --json {path to report.json} --report {path to report.html} --ignoreChange --matchingThreshold=0.05
  3. Observe the error report shown above
  4. Observe that the command never terminates

Expected behavior

The command should finish up with a non-zero return code and a message indicating the cause of the problem.

Actual behavior

The tool never completes. Output does show the error being encountered, but app hangs instead of finishes.

Screenshots

......

Peter-Sparksuite avatar Apr 18 '24 17:04 Peter-Sparksuite