Skip to content
Snippets Groups Projects

Patch binary distributions so we can use recommended /usr paths instead of /usr/local ones

Closed viktor drobot requested to merge (removed):main into main

I've done patching for crucial binary executables and supplementary data (such as manpages) for all of available architectures of WXtoIMG. Now main config file is expected to be at /etc/wxtoimg.cfg (instead of /usr/local/etc/wxtoimg.cfg) and common data are in /usr/share/wx2img (instead of /usr/local/lib/wx). Patching was quite trivial - for /usr/local/lib/wx to /usr/share/wx2img the change is byte-to-byte in length equal so simple replacement was sufficient. For config file it was a bit trickier but since new path /etc/wxtoimg.cfg is shorter than the older one string literal constants were just filled with \0 symbols after the end so C strings should work fine. In documentation parts old extra characters were replaced with spaces. I've tested patched version on x86_64 architecture and it worked fine (as I was able to detect). As of now new file list consists of the following paths:

$ pacman -Ql wxtoimg-beta 
wxtoimg-beta /usr/
wxtoimg-beta /usr/bin/
wxtoimg-beta /usr/bin/wxbatch
wxtoimg-beta /usr/bin/wxmap
wxtoimg-beta /usr/bin/wxproj
wxtoimg-beta /usr/bin/wxrec
wxtoimg-beta /usr/bin/wxtoimg
wxtoimg-beta /usr/bin/xwxtoimg
wxtoimg-beta /usr/share/
wxtoimg-beta /usr/share/applications/
wxtoimg-beta /usr/share/applications/wxtoimg.desktop
wxtoimg-beta /usr/share/licenses/
wxtoimg-beta /usr/share/licenses/wxtoimg-beta/
wxtoimg-beta /usr/share/licenses/wxtoimg-beta/LICENSE
wxtoimg-beta /usr/share/man/
wxtoimg-beta /usr/share/man/de/
wxtoimg-beta /usr/share/man/de/man1/
wxtoimg-beta /usr/share/man/de/man1/wxcalibrate.1
wxtoimg-beta /usr/share/man/de/man1/wxfaq.1
wxtoimg-beta /usr/share/man/de/man1/wxrego.1
wxtoimg-beta /usr/share/man/de/man1/xwxtoimg.1
wxtoimg-beta /usr/share/man/es/
wxtoimg-beta /usr/share/man/es/man1/
wxtoimg-beta /usr/share/man/es/man1/wxcalibrate.1
wxtoimg-beta /usr/share/man/es/man1/wxfaq.1
wxtoimg-beta /usr/share/man/es/man1/wxrego.1
wxtoimg-beta /usr/share/man/es/man1/xwxtoimg.1
wxtoimg-beta /usr/share/man/fr/
wxtoimg-beta /usr/share/man/fr/man1/
wxtoimg-beta /usr/share/man/fr/man1/wxcalibrate.1
wxtoimg-beta /usr/share/man/fr/man1/wxfaq.1
wxtoimg-beta /usr/share/man/fr/man1/wxrego.1
wxtoimg-beta /usr/share/man/fr/man1/xwxtoimg.1
wxtoimg-beta /usr/share/man/ja/
wxtoimg-beta /usr/share/man/ja/man1/
wxtoimg-beta /usr/share/man/ja/man1/wxcalibrate.1
wxtoimg-beta /usr/share/man/ja/man1/wxfaq.1
wxtoimg-beta /usr/share/man/ja/man1/wxrego.1
wxtoimg-beta /usr/share/man/ja/man1/xwxtoimg.1
wxtoimg-beta /usr/share/man/man1/
wxtoimg-beta /usr/share/man/man1/wxbatch.1.gz
wxtoimg-beta /usr/share/man/man1/wxmap.1.gz
wxtoimg-beta /usr/share/man/man1/wxproj.1.gz
wxtoimg-beta /usr/share/man/man1/wxrec.1.gz
wxtoimg-beta /usr/share/man/man1/wxtoimg.1.gz
wxtoimg-beta /usr/share/man/pl/
wxtoimg-beta /usr/share/man/pl/man1/
wxtoimg-beta /usr/share/man/pl/man1/wxcalibrate.1
wxtoimg-beta /usr/share/man/pl/man1/wxfaq.1
wxtoimg-beta /usr/share/man/pl/man1/wxrego.1
wxtoimg-beta /usr/share/man/pl/man1/xwxtoimg.1
wxtoimg-beta /usr/share/pixmaps/
wxtoimg-beta /usr/share/pixmaps/wxtoimg.png
wxtoimg-beta /usr/share/wx2img/
wxtoimg-beta /usr/share/wx2img/man/
wxtoimg-beta /usr/share/wx2img/man/de_wxcalibrate.1
wxtoimg-beta /usr/share/wx2img/man/de_wxfaq.1
wxtoimg-beta /usr/share/wx2img/man/de_wxrego.1
wxtoimg-beta /usr/share/wx2img/man/de_xwxtoimg.1
wxtoimg-beta /usr/share/wx2img/man/es_wxcalibrate.1
wxtoimg-beta /usr/share/wx2img/man/es_wxfaq.1
wxtoimg-beta /usr/share/wx2img/man/es_wxrego.1
wxtoimg-beta /usr/share/wx2img/man/es_xwxtoimg.1
wxtoimg-beta /usr/share/wx2img/man/fr_wxcalibrate.1
wxtoimg-beta /usr/share/wx2img/man/fr_wxfaq.1
wxtoimg-beta /usr/share/wx2img/man/fr_wxrego.1
wxtoimg-beta /usr/share/wx2img/man/fr_xwxtoimg.1
wxtoimg-beta /usr/share/wx2img/man/ja_wxcalibrate.1
wxtoimg-beta /usr/share/wx2img/man/ja_wxfaq.1
wxtoimg-beta /usr/share/wx2img/man/ja_wxrego.1
wxtoimg-beta /usr/share/wx2img/man/ja_xwxtoimg.1
wxtoimg-beta /usr/share/wx2img/man/pl_wxcalibrate.1
wxtoimg-beta /usr/share/wx2img/man/pl_wxfaq.1
wxtoimg-beta /usr/share/wx2img/man/pl_wxrego.1
wxtoimg-beta /usr/share/wx2img/man/pl_xwxtoimg.1
wxtoimg-beta /usr/share/wx2img/template0.html
wxtoimg-beta /usr/share/wx2img/template1.html
wxtoimg-beta /usr/share/wx2img/template2.html
wxtoimg-beta /usr/share/wx2img/template3.html
wxtoimg-beta /usr/share/wx2img/template4.html
wxtoimg-beta /usr/share/wx2img/template5.html
wxtoimg-beta /usr/share/wx2img/template6.html
wxtoimg-beta /usr/share/wx2img/tkclscrd.ttf
wxtoimg-beta /usr/share/wx2img/tle/
wxtoimg-beta /usr/share/wx2img/tle/archive.txt
wxtoimg-beta /usr/share/wx2img/tle/met2-21h.txt
wxtoimg-beta /usr/share/wx2img/tle/met3-05h.txt
wxtoimg-beta /usr/share/wx2img/tle/noaa-12h.txt
wxtoimg-beta /usr/share/wx2img/tle/noaa-14h.txt
wxtoimg-beta /usr/share/wx2img/tle/noaa-15h.txt
wxtoimg-beta /usr/share/wx2img/tle/noaa-16h.txt
wxtoimg-beta /usr/share/wx2img/tle/noaa-17h.txt
wxtoimg-beta /usr/share/wx2img/tle/othertle.txt
wxtoimg-beta /usr/share/wx2img/tle/resource.txt
wxtoimg-beta /usr/share/wx2img/tle/weather.txt
wxtoimg-beta /usr/share/wx2img/wxland.png
wxtoimg-beta /usr/share/wx2img/wxmap.db
wxtoimg-beta /usr/share/wx2img/wxmap.png

To check patches by hand you can use the following steps:

  1. Patch original binary executable: bspatch ORIG.exec FIXED.exec ORIG-ARCH.patch
  2. Compare original and patched binaries with the following: cmp -l ORIG.exec FIXED.exec | gawk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'. It will give you bitewise comparison of what has been changed - you can then re-check by hand in, e. g., bless or okteta

It would be great if you will be able to test my changes on other architectures as well. This will allow to comply to the Arch packaging standards without need of tinkering with /usr/local and similar stuff

Also I've fixed .desktop file a bit: added proper categories. proj should be in dependency list as well - I've found link to this executable while digging through binary executables

Edited by viktor drobot

Merge request reports

Approval is optional

Closed by Daniel PeukertDaniel Peukert 2 years ago (Sep 6, 2022 1:26pm UTC)

Merge details

  • The changes were not merged into main.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • viktor drobot changed the description

    changed the description

  • Hey, sorry about the delay, I wasn't able to look into this yet, but I'll try to take a look by the end of this week.

  • Hello! Thank you for the feedback! Hope my proposals will be useful :) I'm already using patched WXtoIMG on x86_64 and things are looking fine. But need to test more thoroughly, ofc

    Also hope that my suggested method of binary-to-binary comparison is clear enough to see all differences with exact hex coordinates

    Edited by viktor drobot
  • Hi! Any progress on that?

  • Hi, sorry about time it took me to get to this, life kept getting in the way. I've decided to implement the replacements directly, as it's a little bit clearer to see what's being done to the binaries for the folks trying to audit the PKGBUILD. There are still a couple of things left to figure out (see the PKGBUILD for TODOs), but overall, everything seems to be working.

    Thanks for pointing this approach to me, it's an interesting way to solve these kinds of issues and I'll definitely keep it in mind if I ever need something similar in the future.

    Implemented in 0f7d2351 and 583bb88d.

Please register or sign in to reply
Loading