Bug#1132887: script: "script file -c command" stopped working
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
thank you for the report, CC'ing upstream.
Quoted 10 lines · Evgeny Kapun
Package: bsdutils
Version: 1:2.42-1If 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 <[email protected]> | AuthorDate: Thu May 29 16:39:46 2025 +0800 | Commit: Karel Zak <[email protected]> | CommitDate: Tue Jun 24 12:00:33 2025 +0200 | | script: support non-option argument as command | | [[email protected]: - 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 <[email protected]>
Best,
Chris
Karel Zak
maintainerQuoted 10 lines · Chris Hofstaedtler
Hi,
thank you for the report, CC'ing upstream.
Quoted 5 lines · Evgeny Kapun
Package: bsdutils
Version: 1:2.42-1If I run script(1) as "script file -c command", it returns an error:
Quoted 7 lines
Quoted 5 lines
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
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 1 line · Karel Zak
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.
Karel Zak
maintainerQuoted 8 lines · Evgeny Kapun
Quoted 1 line · Karel Zak
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.
Quoted 5 lines
The value can come from a variable, e.g.
script -I "$VAR"andscript --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 bescript "--log-in=$VAR", but it doesn't seem to be very popular.
I have updated the patch to accept "--" as argument for your cases.
https://github.com/util-linux/util-linux/pull/4326
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Chris Hofstaedtler
AppliedQuoted 6 lines · Karel Zak
Quoted 5 lines · Chris Hofstaedtler
thank you for the report, CC'ing upstream.
Quoted 2 lines · Evgeny Kapun
If I run script(1) as "script file -c command", it returns an error:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 1 line
Seems we will need v2.42.1 ASAP :-)
:-)
Thank you!
Chris