User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
start [2023/08/22 13:04] – [Build MariaDB with readline support] abeverleystart [2026/06/03 11:48] (current) abeverley
Line 7: Line 7:
 ===== Build MariaDB with readline support ===== ===== Build MariaDB with readline support =====
  
-I've been frustrated with the use of editline (libedit) instead of readline that the MariaDB is now built with in Debian 11. I have found editline to be buggy with its implementation of Ctrl-R and editing of wrapped lines, and Ctrl-W not mapping to delete a word is infuriating! +I've been frustrated with the use of editline (libedit) instead of readline that MariaDB is now built with in Debian 11. I have found editline to be buggyits implementation of Ctrl-R and editing of wrapped lines do not work wellplus Ctrl-W not being mapping to delete a word by default is infuriating!
- +
-As I understand it, Debian is no longer able to distribute MariaDB built against readline as the former is GPL2 and the latter GPL3, and apparently the 2 are incompatible for distribution. So instead I am starting to build my own packages using these instructions: +
- +
-  apt install build-essential devscripts +
-  apt build-dep mariadb-client-core-10.5 +
-  apt install libreadline-dev +
-  su andrew +
-  apt source mariadb-client-core-10.5 +
-  cd mariadb-10.5-10.5.19/ +
-   +
-Edit ''debian/changelog'' and add new line at top. Version number should be incremented by adding a letter on the end. E.g. +
- +
-Edit ''debian/control'' and change: +
- +
-  libedit-dev, +
-  libedit-dev:native, +
- +
-To +
- +
-  libreadline-dev, +
-  libreadline-dev:native, +
- +
-Edit ''debian/rules'' and add ''-DNOT_FOR_DISTRIBUTION=1'' below ''-DWITH_INNODB_SNAPPY=ON''. Then run: +
- +
-  debuild -uc -us -b+
  
 +As I understand it, Debian is no longer able to distribute MariaDB built against readline as the former is GPL2 and the latter GPL3, and apparently the 2 are incompatible for distribution. So I have written instructions for [[how to rebuild MariaDB against readline in Debian]].
  
 ===== Building packages from later versions of Debian for earlier releases ===== ===== Building packages from later versions of Debian for earlier releases =====
Line 48: Line 24:
   debuild -uc -us   debuild -uc -us
  
-References:+==== Examplebuilding openarc package from experimental ==== 
 + 
 +Add experimental sources to ''/etc/apt/sources.list'': 
 + 
 +  deb-src http://httpredir.debian.org/debian/ experimental main contrib 
 + 
 +  apt-get build-dep openarc 
 +  apt-get source openarc 
 +  cd openarc-1.0.0~beta3+dfsg/ 
 +  # Download additional patches 
 +  cd debian/patches 
 +  wget https://github.com/trusteddomainproject/OpenARC/pull/167.patch 
 +  wget https://github.com/trusteddomainproject/OpenARC/pull/168.patch 
 +  wget https://github.com/trusteddomainproject/OpenARC/pull/170.patch 
 +  wget https://github.com/trusteddomainproject/OpenARC/pull/173.patch 
 +  # Apply 
 +  cd ../.. 
 +  patch -p1 < debian/patches/167.patch 
 +  patch -p1 < debian/patches/168.patch 
 +  patch -p1 < debian/patches/170.patch 
 +  patch -p1 < debian/patches/173.patch 
 +  dch --bpo # Add letter to suggested version 
 +  dpkg-source --commit 
 +  debuild -uc -us 
 + 
 +==== References ====
  
 https://ostechnix.com/how-to-build-debian-packages-from-source/ https://ostechnix.com/how-to-build-debian-packages-from-source/
 https://unix.stackexchange.com/questions/112157/ https://unix.stackexchange.com/questions/112157/
  
 +Versioning info: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
 +
 +===== Building Debian packages of Perl modules =====
 +
 +On production servers, I much prefer to use Perl modules from Debian repositories, rather than installing from CPAN or using some sort of pinning technique. The advantage is that they are maintained upstream, are more stable, faster to install and easier overall to manage.
 +
 +Sometimes a Perl module is either not available in the main Debian repositories, or the version is too old (or I need a patch that has not made it upstream yet). In these circumstances I build my own Debian packages of Perl modules. Normally building a package is easy, but sometimes it can be a bit of an art. Read more about [[building Debian packages of Perl modules]].
 +
 +===== Disk performance tests =====
 +
 +See https://askubuntu.com/a/991311 (regarding fio tool)
 +
 +Test for all-round read/write (worst performance):
 +
 +  fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randrw --size=500m --io_size=10g --blocksize=4k --ioengine=libaio --fsync=1 --iodepth=1 --direct=1 --numjobs=1 --runtime=60 --group_reporting
 +
 +Sequential read:
 +
 +  fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=read --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting
 +
 +Sequential write:
 +
 +  fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=write --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting
 +
 +Random read:
 +
 +  fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randread --size=500m --io_size=10g --blocksize=4k --ioengine=libaio --fsync=1 --iodepth=1 --direct=1 --numjobs=1 --runtime=60 --group_reporting
 ===== JSON Web Tokens with Perl ===== ===== JSON Web Tokens with Perl =====
  
 Some examples of [[how to use JWTs with Perl]] Some examples of [[how to use JWTs with Perl]]
 +
 +===== Bulk resizing images =====
 +
 +  # Maximum width 400px and max height 700px
 +  mogrify -resize '400x700>' *.png
 +  
 +  # Maximum width 400px
 +  mogrify -resize '400>' *.png
 +
 +===== Comparing and normalising documents =====
 +
 +Use this to compare PDF and word documents:
 +
 +  * Same the word document as plain text
 +  * Use ''pdftotext'' to convert the PDF to plain text
 +
 +Use this Perl script to normalise each file:
 +
 +  my $str = do { local $/; <STDIN> };
 +  # Strip paragraph numbers
 +  $str =~ s/^[0-9.]+/\n\n/mg;
 +  # Remove wrapped lines that are not paragraph separators
 +  $str =~ s/(?<!\n)\n(?!\n)/ /g;
 +  # Strip space at beginning of lines
 +  $str =~ s/^\h+//mg;
 +  # Normalise paragraph breaks
 +  $str =~ s/\v\v+/\n\n/g;
 +
 +Compare both files using ''git diff --word-diff=color''
  
 ===== Using Overlay (OpenStreetMap) ===== ===== Using Overlay (OpenStreetMap) =====
  
 [[overlay|Using Overlay to extract data from OpenStreetMap]] [[overlay|Using Overlay to extract data from OpenStreetMap]]
 +
 +===== Quick and dirty string dumping in Perl =====
 +
 +From https://blogs.perl.org/users/mauke/2026/04/quick-and-dirty-string-dumping.html
 +
 +A non-obvious feature of sprintf can help here: sprintf('%vd', $string) gives the decimal values of all code points in $string separated by dots. For example:
 +
 +  sprintf('%vd', "abc\n\a") is 97.98.99.10.7
 +  sprintf('%vd', "\xe2\x82\xac") is 226.130.172
 +  sprintf('%vd', "\x{20ac}") is 8364
 +
 +Don't like decimal character codes? Use hex instead:
 +
 +  sprintf('%vx', "abc\n\a") is 61.62.63.a.7
 +  sprintf('%vx', "\xe2\x82\xac") is e2.82.ac
 +  sprintf('%vx', "\x{20ac}") is 20ac
 +
 +Don't like dots? Use whatever separator you want:
 +
 +  sprintf('%*vd', '~', "abc\n\a") is 97~98~99~10~7
  
 ===== Using iptables and PHP to create a captive portal ===== ===== Using iptables and PHP to create a captive portal =====
start.1692709485.txt.gz · Last modified: by abeverley