x265-4.2 sed patch incorrectly expands '&' characters

"Attilio Pavone" ([email protected] via blfs-dev Mailing List) <[email protected]> Fri, 1 May 2026 14:01:38 +0200
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1777636900-1253-27668
Content-Type: multipart/alternative;
 boundary="------------LghxaLh7EcTbkuYl66N2juRd"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------LghxaLh7EcTbkuYl66N2juRd
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

while following the (Development) BLFS instructions for building x265-4.2
https://linuxfromscratch.org/blfs/view/svn/multimedia/x265.html

I noticed a possible issue in the suggested sed patch:
|sed -i 's/FORMAT_ELF/UNIX64 && FORMAT_ELF/' source/common/x86/cpu-a.asm|

Since '&' in sed represents the entire matched pattern, this resulted in 
the following line:
|%elif UNIX64 FORMAT_ELFFORMAT_ELF FORMAT_ELF|

instead of the presumably intended:
|%elif UNIX64 && FORMAT_ELF|

The following escaped form should avoid the issue:
|sed -i 's/FORMAT_ELF/UNIX64 \&\& FORMAT_ELF/' source/common/x86/cpu-a.asm|

Thank you for the invaluable guidance provided in building my system, 
best regards,

Attilio (tilly) Pavone


--------------LghxaLh7EcTbkuYl66N2juRd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; color: rgb(209, 205, 199); font-family: Arial; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 26, 27); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">Hello,</p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">while
        following the (Development) BLFS instructions for building
        x265-4.2 <br>
        <a class="moz-txt-link-freetext" href="https://linuxfromscratch.org/blfs/view/svn/multimedia/x265.html">https://linuxfromscratch.org/blfs/view/svn/multimedia/x265.html</a> </p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">I
        noticed a possible issue in the suggested sed patch: <br>
        <code
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">sed
          -i 's/FORMAT_ELF/UNIX64 &amp;&amp; FORMAT_ELF/'
          source/common/x86/cpu-a.asm</code></p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">Since
        '&amp;' in sed represents the entire matched pattern, this resulted
        in the following line:<br>
        <code
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">%elif
          UNIX64 FORMAT_ELFFORMAT_ELF FORMAT_ELF</code></p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">instead
        of the presumably intended:<br>
        <code
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">%elif
          UNIX64 &amp;&amp; FORMAT_ELF</code></p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">The
        following escaped form should avoid the issue:<br>
        <code
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">sed
          -i 's/FORMAT_ELF/UNIX64 \&amp;\&amp; FORMAT_ELF/'
          source/common/x86/cpu-a.asm</code></p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">Thank
        you for the invaluable guidance provided in building my system,
        best regards,</p>
      <p
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; margin-top: 0px; margin-bottom: 1rem;">Attil<span
          data-darkreader-inline-bgcolor=""
style="box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(221, 221, 221) transparent; background-color: initial; --darkreader-inline-bgcolor: initial;">io
          (tilly) Pavone</span></p>
    </div>
    <p><br>
    </p>
  </body>
</html>

--------------LghxaLh7EcTbkuYl66N2juRd--

------------=_1777636900-1253-27668
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page
------------=_1777636900-1253-27668--