There are 2 comments.
 
 
XWiki Docker images / cid:jira-generated-image-avatar-506777b2-2ef6-4a7d-8ab8-beb814f1a317 XDOCKER-84 Open

sed in DockerFile has unwanted side effect

 
View issue   ยท   Add comment
 

2 comments

 
cid:jira-generated-image-avatar-8d9795e8-cdec-40aa-baa6-fe3ad824ffd1 Vincent Massol on 18/Jul/26 11:04
 

Fixed in commit 140bd39.

The unanchored sed pattern matched two }} lines in {{META-INF/extension.xed: besides the intended xwiki-platform-distribution-war -> -docker rewrite, it also corrupted xwiki-platform-distribution-war-legacydependencies -> -docker-legacydependencies.

Applied the suggested fix - anchoring the pattern with the closing < so only the exact {{}} line is matched:

sed \-i 's/org.xwiki.platform:xwiki\-platform\-distribution\-war</org.xwiki.platform:xwiki\-platform\-distribution\-docker</' ...

Verified against the real extension.xed from the 18.5.0 WAR: the old command rewrites the -legacydependencies line, the new one leaves it untouched while still performing the intended replacement. (Note the file also contains a xwiki-platform-distribution-war line, which neither the old nor the new command touches.)

Fix applied in template/Dockerfile and the regenerated //Dockerfile files.

 
cid:jira-generated-image-avatar-8d9795e8-cdec-40aa-baa6-fe3ad824ffd1 Vincent Massol on 18/Jul/26 11:07
 
Fixed in commit 140bd39.

The
unanchored {{ original sed }} pattern was not anchored, so it matched two {{}} id lines in {{ META \ -INF/extension.xed }}: besides . Besides the intended {{ replacement, it also corrupted the xwiki \ -platform \ -distribution \ -war }} \ - > {{\ legacydependencies id into xwiki - platform-distribution- docker }} rewrite, it also corrupted -legacydependencies.

Before (buggy):
{ { noformat}
sed -i 's/<id>org.
xwiki \ .platform:xwiki -platform \ -distribution \ -war \ /<id>org.xwiki.platform:xwiki - legacydependencies}} \ platform - > {{\ distribution -docker /' \
  /usr/local/tomcat/webapps/ROOT/META
- legacydependencies}} INF/extension . xed
{noformat}
Applied the suggested
After (
fix \ ) - anchoring the pattern is anchored with the closing {{<}} angle bracket so that only the exact {{}} id line is matched matches :

{ code noformat }
sed
\ -i 's/ <id> org.xwiki.platform:xwiki \ -platform \ -distribution \ -war</ <id> org.xwiki.platform:xwiki \ -platform \ -distribution \ -docker</' \
  /usr/local/tomcat/webapps/ROOT/META-INF/extension
. .. xed
{
code noformat }

Verified against the real
{{ extension.xed }} extracted from the 18.5.0 WAR: the old command rewrites the {{\ -legacydependencies }} line, while the new one leaves it untouched while and still performing performs the intended replacement. \ ( Note the The file also contains a {{ maven.artifactid element holding the same xwiki \ -platform \ -distribution \ -war }} line value , which neither the old nor the new command touches. \ )

Fix applied in
{{ template/Dockerfile }} and the regenerated {{// per-version Dockerfile }} files.