public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Bug#1132887: script: "script file -c command" stopped working
       [not found] <88e0b54d-3c86-46ca-ab3f-e116073216d6@gmail.com>
@ 2026-04-07  8:17 ` Chris Hofstaedtler
  2026-04-07 13:26   ` Karel Zak
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Hofstaedtler @ 2026-04-07  8:17 UTC (permalink / raw)
  To: Evgeny Kapun, 1132887; +Cc: util-linux, wanbingjiang

Hi,

thank you for the report, CC'ing upstream.

On Tue, Apr 07, 2026 at 07:07:59AM +0300, Evgeny Kapun wrote:
> Package: bsdutils
> Version: 1:2.42-1
> 
> If I run script(1) as "script file -c command", it returns an error:
> 
> script: unexpected number of arguments
> Try 'script --help' for more information.
> 
> It used to work in earlier versions, so now scripts that rely on the old
> behavior are broken.

Can you check if reverting this commit makes it work again?

| commit 7268e79bc5365034a6e5b38ac5d9bf635e2dafc2
| Author:     WanBingjiang <wanbingjiang@webray.com.cn>
| AuthorDate: Thu May 29 16:39:46 2025 +0800
| Commit:     Karel Zak <kzak@redhat.com>
| CommitDate: Tue Jun 24 12:00:33 2025 +0200
| 
|     script: support non-option argument as command
| 
|     [kzak@redhat.com: - don't use POSIXLY_CORRECT, use "+" in getopt_long(),
|                       - use strv_join() rather than local concat function]
| 
|     Based-on: https://github.com/util-linux/util-linux/pull/3599
|     Fixes: https://github.com/util-linux/util-linux/issues/3481
|     Signed-off-by: Karel Zak <kzak@redhat.com>


Best,
Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug#1132887: script: "script file -c command" stopped working
  2026-04-07  8:17 ` Bug#1132887: script: "script file -c command" stopped working Chris Hofstaedtler
@ 2026-04-07 13:26   ` Karel Zak
  2026-04-08 13:36     ` Evgeny Kapun
  2026-04-10  8:42     ` Chris Hofstaedtler
  0 siblings, 2 replies; 4+ messages in thread
From: Karel Zak @ 2026-04-07 13:26 UTC (permalink / raw)
  To: Chris Hofstaedtler; +Cc: Evgeny Kapun, 1132887, util-linux, wanbingjiang

On Tue, Apr 07, 2026 at 10:17:45AM +0200, Chris Hofstaedtler wrote:
> Hi,
> 
> thank you for the report, CC'ing upstream.
> 
> On Tue, Apr 07, 2026 at 07:07:59AM +0300, Evgeny Kapun wrote:
> > Package: bsdutils
> > Version: 1:2.42-1
> > 
> > If I run script(1) as "script file -c command", it returns an error:
> > 
> > script: unexpected number of arguments
> > Try 'script --help' for more information.
> > 
> > It used to work in earlier versions, so now scripts that rely on the old
> > behavior are broken.
> 
> Can you check if reverting this commit makes it work again?

I have created bugfix for this, see https://github.com/util-linux/util-linux/pull/4201

Seems we will need v2.42.1 ASAP :-)

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug#1132887: script: "script file -c command" stopped working
  2026-04-07 13:26   ` Karel Zak
@ 2026-04-08 13:36     ` Evgeny Kapun
  2026-04-10  8:42     ` Chris Hofstaedtler
  1 sibling, 0 replies; 4+ messages in thread
From: Evgeny Kapun @ 2026-04-08 13:36 UTC (permalink / raw)
  To: Karel Zak; +Cc: Chris Hofstaedtler, 1132887, util-linux, wanbingjiang

On 4/7/26 16:26, Karel Zak wrote:
> I have created bugfix for this, see https://github.com/util-linux/util-linux/pull/4201

It seems that this fix doesn't handle the case where -- is used as an
argument to an option. For example, `script -I --` before v2.42 would
interpret -- as an argument to -I, but the pre-scanning in that PR would
break it.

The value can come from a variable, e.g. `script -I "$VAR"` and `script
--log-in "$VAR"` will usually work, but break if $VAR is --. Similarly,
`script "-I$VAR"` will usually work, but break if $VAR is the empty
string. The only approach without special cases seems to be `script
"--log-in=$VAR"`, but it doesn't seem to be very popular.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug#1132887: script: "script file -c command" stopped working
  2026-04-07 13:26   ` Karel Zak
  2026-04-08 13:36     ` Evgeny Kapun
@ 2026-04-10  8:42     ` Chris Hofstaedtler
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Hofstaedtler @ 2026-04-10  8:42 UTC (permalink / raw)
  To: Karel Zak, 1132887; +Cc: Evgeny Kapun, util-linux, wanbingjiang

On Tue, Apr 07, 2026 at 03:26:58PM +0200, Karel Zak wrote:
> On Tue, Apr 07, 2026 at 10:17:45AM +0200, Chris Hofstaedtler wrote:
> > thank you for the report, CC'ing upstream.
> > 
> > On Tue, Apr 07, 2026 at 07:07:59AM +0300, Evgeny Kapun wrote:
> > > If I run script(1) as "script file -c command", it returns an error:
> > > 
> > > script: unexpected number of arguments
> > > Try 'script --help' for more information.
> > > 
> > > It used to work in earlier versions, so now scripts that rely on the old
> > > behavior are broken.
> 
> I have created bugfix for this, see https://github.com/util-linux/util-linux/pull/4201

I've applied this fix to Debian as 2.42-2.

> Seems we will need v2.42.1 ASAP :-)

:-)


Thank you!
Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-10  8:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <88e0b54d-3c86-46ca-ab3f-e116073216d6@gmail.com>
2026-04-07  8:17 ` Bug#1132887: script: "script file -c command" stopped working Chris Hofstaedtler
2026-04-07 13:26   ` Karel Zak
2026-04-08 13:36     ` Evgeny Kapun
2026-04-10  8:42     ` Chris Hofstaedtler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox