RPM spec: BuildRequires: gnu-sed conflicts with busybox sed


My application ships with a binary, which requires that I remove build paths after compilation. This is achieved by bit-tweaking using sed.


Basically, I would need to bit-tweak the binary hard-coded with the build paths:

$ strings mylib.so.1.0.0 | grep myapp

This method previously worked with gnu sed (e.g. on SailfishOS 3.4)

sed -i 's|/home/mersdk/myapp/installroot/usr/share/harbour-myapp/|/usr/share/harbour-myapp/\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0' mylib.so.1.0.0

This gave the correct results:

$ strings mylib.so.1.0.0 | grep myapp


However, since SailfishOS 4.0 (I think), gnu sed has been replaced with busybox sed, which doesn’t appear to handle substitution of hex characters, including \x0

Attempting to do the same with busybox sed, leads to the following incorrect output:

$ strings mylib.so.1.0.0 | grep myapp

Towards a solution

An incomplete solution was to install gnu sed in the build environment by specifying in the RPM spec:

BuildRequires: gnu-sed

However, when installing the build requirements, it errors out because of a conflict between busybox-symlinks-sed and gnu-sed:

Problem: busybox-symlinks-sed-1.31.0+git18-1.4.2.jolla.i486 conflicts with gnu-sed provided by gnu-sed-4.1.5+git1-1.1.2.jolla.i486
 Solution 1: deinstallation of busybox-symlinks-sed-1.31.0+git18-1.4.2.jolla.i486
 Solution 2: do not install gnu-sed-4.1.5+git1-1.1.2.jolla.i486

Choose from above solutions by number or cancel [1/2/c/d/?] (c): c
Setting version: 0.1
Building target platforms: i486-meego-linux-gnu
Building for target i486-meego-linux-gnu
error: Failed build dependencies:
	gnu-sed is needed by harbour-myapp

My question

Is there a way I can specify in the RPM spec to remove the package busybox-symlinks-sed? This needs to be done each time to work with my SailfishOS CI/CD docker solution.


I found a solution. Instead of using gnu sed, use perl. e.g.

perl -C1 -i -pe  's|/home/mersdk/myapp/installroot/usr/share/harbour-myapp/|/usr/share/harbour-myapp/\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0|g' mylib.so.1.0.0
1 Like

Good there is a workaround, but the general problem still remauns.

I have a similar situation with one of my builders with coreutils where gnu would be needed but bb is installed and can not be removed non-interactively.

Listing as conflicting package will disallow installation.
But if forcing would still try, right?

Really hacky and not sure it’ll it would work at all:
but what about a preinstall script like ‘pkcon remove busybox-symlinks-sed’
Would this not automatically install back full gnu-sed? Else Just install as well?

But as said do not know if install inside install will work, most probably not, right? :wink:
So maybe using ‘rpm -e …’ instead (and curl …; rpm -i …)???