If $linuxdeploy contains the sequence AI\x02 more than once, sed will replace all its occurrences. Instead, it should only replace the first one. This can be achieved either using one of sed's flags/options, or using
For the record, this is not just a theoretical concern: linuxdeploy for linux-aarch64 (at least the linked version) does indeed contain the sequence AI\x02 twice, and the erroneous replacement of the second one makes the command
If
$linuxdeploy
contains the sequenceAI\x02
more than once,sed
will replace all its occurrences. Instead, it should only replace the first one. This can be achieved either using one ofsed
's flags/options, or usingas suggested by the intial author of the patch themselves.
For the record, this is not just a theoretical concern:
linuxdeploy
forlinux-aarch64
(at least the linked version) does indeed contain the sequenceAI\x02
twice, and the erroneous replacement of the second one makes the commandfail.