Skip to content

Fix zbar flakiness when reading codes #69

@za3k

Description

@za3k

there is exactly one widely-available command-line program in linux which reads QR codes, zbar. it has a problem -- it sometimes fails, even on digitally generated QR codes. the failure rate for digital codes should be 0%, because they have exactly all the right data.

at least 1/3 of bugs in the zbar issue tracker are about this. almost all of the bugs in the tracker are about QR codes.

fixing this problem will make qr-backup measurably better. it will also make QR reading better on linux in general, for a lot of people.

i suspect it will fix another 1/3 of the bugs in the zbar tracker, even though they are not explicitly about digitally-generated QR codes.


why does it affect qr-backup?

qr-backup makes backups as a .pdf file. then, we try to test whether the backup worked, by using a command-line program (zbar) to read the QR codes, and see if we can decode the data.

there is a problem -- sometimes zbar fails to read the QR codes, even though we have a perfectly pristine digital QR

there is no command-line alternative to zbar.


zbar sometimes fails (>0.1% of the time) to scan a QR code. Fix this, changing the code of zbar to be correct, and get zbar to have a 0% error rate for digitally-generated images of QR codes.

Debugging tips:

  • Set DEBUG_SVG and recompile
  • Set QR_DEBUG, after merging the code in image.zip (source: Timothy Terriberry)

Reproduction case: https://user-images.githubusercontent.com/64830812/127732474-ff7fa13e-d913-4926-8361-ace8cf14d1f8.png

Code link: https://github.com/mchehab/zbar/tree/master/zbar/qrcode

Bounty: 10 hours of my time in trade

Cross-posted as mchehab/zbar#306 to the zbar repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions