<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15188</bug_id>
          
          <creation_ts>2023-08-10 15:38:31 +0000</creation_ts>
          <short_desc>AB-INT PTEST: util-linux script: options, script/options-size failures</short_desc>
          <delta_ts>2026-01-15 16:15:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Package Testing (ptest)</product>
          <component>ptest</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>AB-INT</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexandre Belloni">alexandre.belloni</reporter>
          <assigned_to name="Paul Barker">paul</assigned_to>
          <cc>hongxu.jia</cc>
    
    <cc>joaomarcos.costa</cc>
    
    <cc>paul</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96238</commentid>
    <comment_count>0</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2023-08-10 15:38:31 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/5245/steps/13/logs/stdio

qemuarm64-ptest ubuntu1804-arm-1

diff-{{{
--- /usr/lib/util-linux/ptest/tests/expected/script/options-size
+++ /usr/lib/util-linux/ptest/tests/output/script/options-size
@@ -3,7 +3,6 @@
·
 Script done on 2015-05-24 17:43:18+00:00 [&lt;max output size exceeded&gt;]
 Script started on 2015-05-24 17:43:18+00:00 [COMMAND=&quot;echo 2:1234567890&quot; &lt;not executed on terminal&gt;]
-2:1234567890
-
+2:1234567890
 Script done on 2015-05-24 17:43:18+00:00 [&lt;max output size exceeded&gt;]
 1
}}}-diff

FAIL:        script: options: [05] size                            (script/options-size)
FAIL:        script: options                                       (1 from 5 sub-tests)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97126</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-30 15:37:28 +0000</bug_when>
    <thetext>Build move to 5.0 -- ../Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97844</commentid>
    <comment_count>2</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2024-01-17 13:50:05 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/5844/steps/12/logs/stdio

qemux86-64-ptest rocky9-ty-1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98041</commentid>
    <comment_count>3</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2024-01-25 16:10:09 +0000</bug_when>
    <thetext>Both happened more than 3 months ago, closing as agreed on the triage call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98255</commentid>
    <comment_count>4</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2024-02-22 15:15:37 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6273/steps/12/logs/stdio

Failed ptests:
{&apos;util-linux&apos;: [&apos;script:_options:_[05]_size&apos;, &apos;script:_options&apos;]}

qemux86-64-ptest fedora38-ty-2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98796</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-04-24 20:30:26 +0000</bug_when>
    <thetext>Bulk move from 5.0* to 5.99 to indicate that there isn&apos;t any one available to work on this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99579</commentid>
    <comment_count>6</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2024-08-28 15:04:27 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6937/steps/12/logs/stdio

qemux86-64-ptest debian12-ty-1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101554</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-04-03 14:38:43 +0000</bug_when>
    <thetext>Not seen in about 8 months.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102488</commentid>
    <comment_count>8</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-07-21 07:58:43 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/valkyrie/#/builders/56/builds/227/steps/12/logs/stdio

Failed ptests:{&apos;util-linux&apos;: [&apos;script:_options:_[05]_size&apos;, &apos;script:_options&apos;]}

qemuriscv64-ptest ubuntu2204-vk-2

Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102502</commentid>
    <comment_count>9</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2025-07-24 14:40:07 +0000</bug_when>
    <thetext>Valid reopen</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103173</commentid>
    <comment_count>10</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-11-03 09:19:56 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/valkyrie/#/builders/56/builds/696/steps/13/logs/stdio

Failed ptests:{&apos;util-linux&apos;: [&apos;script:_options:_[05]_size&apos;, &apos;script:_options&apos;]}

qemuriscv64-ptest ubuntu2404-vk-3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103425</commentid>
    <comment_count>11</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-11-27 18:39:20 +0000</bug_when>
    <thetext>One of the many AB-INT bugs that would be nice to have soemeone fix.
Please assign it to yourself if you are able to start working on it.
Feel free to ask questions once you&apos;ve taken a look at the data and code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103563</commentid>
    <comment_count>12</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-12-15 16:39:05 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/valkyrie/#/builders/56/builds/833/steps/13/logs/stdio

Failed ptests:{&apos;util-linux&apos;: [&apos;script:_options:_[05]_size&apos;, &apos;script:_options&apos;]}

qemuriscv64-ptest debian12-vk-4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103586</commentid>
    <comment_count>13</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2025-12-18 09:30:28 +0000</bug_when>
    <thetext>I&apos;ve picked this up and started looking in to it.

The test case is running the `script` utility with the --output-limit / -o option which stores the limit in the maxsz variable. It then compares the generated output to the expected output linked above. If the output differs, the test fails.

In `script`, the amount of output generated is checked against maxsz each time callback_log_stream_activity() is called by the common pty I/O handling. If the maximum output has been reached, the program terminates early. The whole of the current buffer is logged to the output file *before* this check occurs, so more than maxsz characters can be written to the output before the program terminates.

In the util-linux library functions, handle_io() simply reads up to BUFSIZ bytes from the pty using the read() syscall. These reads are buffered, so it&apos;s not guaranteed that the string &quot;2:1234567890\n&quot; printed by the echo command to the pty master arrives in a single read() call from the pty slave. Most of the time it will, but it&apos;s not guaranteed. This string is 13 characters long, and maxsz is 9 in the test, so if the last 1-3 characters aren&apos;t seen in the first read() call the program will terminate early (as maxsz has been reached) and the remaining characters will be lost. If this happens, the test output won&apos;t match the expected output and the test case will fail.

There&apos;s a couple of ways to fix this, either maxsz can be enforced as a hard limit so that the number of characters printed is predictable, or the comparison with the expected output can be changed to allow for the expected differences. We should raise this with upstream.

Links:

- The failing test case: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/tests/ts/script/options?h=v2.41.2#n60

- Expected output: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/tests/expected/script/options-size?h=v2.41.2

- Handling of maxsz in the script utility, in callback_log_stream_activity(): https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/term-utils/script.c?h=v2.41.2#n691

- Main pty I/O handler which calls callback_log_stream_activity() via a callback: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/lib/pty-session.c?h=v2.41.2#n449</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103588</commentid>
    <comment_count>14</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2025-12-18 15:26:17 +0000</bug_when>
    <thetext>I built the current HEAD of util-linux, commit e4656fa9765f (&quot;zramctl: Add note about column descriptions&quot;), and ran the offending test case in a loop on my local machine, while running builds in the background:

$ for i in $(seq 0 4095); do SCRIPT_TEST_SECOND_SINCE_EPOCH=1432489398 TZ=GMT ../util-linux/test_script -o 9 --command &quot;echo 1:1234567890&quot; test$i &gt; /dev/null &lt; /dev/null 2&gt;&amp;1 ; done

I got 3849 runs with the expected output (94%):

&gt; Script started on 2015-05-24 17:43:18+00:00 [COMMAND=&quot;echo 1:1234567890&quot; &lt;not executed on terminal&gt;]
&gt; 1:1234567890
&gt;
&gt; Script done on 2015-05-24 17:43:18+00:00 [&lt;max output size exceeded&gt;]

I got 247 runs with newlines missing (6%):

&gt; Script started on 2015-05-24 17:43:18+00:00 [COMMAND=&quot;echo 1:1234567890&quot; &lt;not executed on terminal&gt;]
&gt; 1:1234567890
&gt; Script done on 2015-05-24 17:43:18+00:00 [&lt;max output size exceeded&gt;]

I didn&apos;t get any other variants of the output.

So, the test case is definitely flaky. I&apos;ll start talking to upstream.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103608</commentid>
    <comment_count>15</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2025-12-18 20:24:37 +0000</bug_when>
    <thetext>Email sent to util-linux mailing list: https://lore.kernel.org/util-linux/978c83bdf7596879458f39f1789da016150a72d4.camel@pbarker.dev/T/#u

&gt; I see two possible ways to fix this flaky test:
&gt;
&gt; 1) Modify `script` to never print more characters than the requested
&gt;    output limit. This will ensure that the generated output is always
&gt;    consistent, regardless of the influence of I/O buffering.
&gt;
&gt; 2) Modify the test case to accept both of the above possible output
&gt;    variants.
&gt;
&gt; We would like some input from folks more familiar with util-linux on
&gt; which of those options is preferred.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103684</commentid>
    <comment_count>16</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2026-01-05 09:48:21 +0000</bug_when>
    <thetext>No reply from upstream, I suggest we patch out this test for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103734</commentid>
    <comment_count>17</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2026-01-07 14:18:26 +0000</bug_when>
    <thetext>This should be fixed by:

  util-linux: Disable flaky script/options-size test
  https://lore.kernel.org/openembedded-core/20260105-util-linux-ptest-v1-1-d9d99a147a2b@pbarker.dev/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103930</commentid>
    <comment_count>18</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2026-01-15 16:15:42 +0000</bug_when>
    <thetext>https://git.openembedded.org/openembedded-core/commit/?id=b7a698d81b7435143525e7ef408c322b11937596</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>