Skip to content

fix: use -O flag for script output file (util-linux 2.42 compat)#421

Merged
korewaChino merged 1 commit intoFyraLabs:mainfrom
dylanmtaylor:fix-script-util-linux-242
Apr 5, 2026
Merged

fix: use -O flag for script output file (util-linux 2.42 compat)#421
korewaChino merged 1 commit intoFyraLabs:mainfrom
dylanmtaylor:fix-script-util-linux-242

Conversation

@dylanmtaylor
Copy link
Copy Markdown
Contributor

util-linux 2.42 added + to the getopt string in script(1), which stops option parsing at the first non-option argument. This causes the current invocation:

script -e -f /dev/null -q -c "command"

to fail with unexpected number of arguments, because /dev/null (positional) stops option parsing, leaving -q and -c as unrecognized extra arguments.

The fix uses -O /dev/null (explicit --log-out) instead of a positional argument. This works on both old and new versions of script (-O has been available since util-linux 2.35).

Ref: terrapkg/packages#11057

util-linux 2.42 added '+' to getopt, stopping option parsing at the
first non-option argument. This breaks the old invocation where
/dev/null was passed as a positional arg after the -f flag.

Using -O /dev/null explicitly works on both old and new versions.

Ref: terrapkg/packages#11057
@korewaChino korewaChino merged commit 5d82b70 into FyraLabs:main Apr 5, 2026
2 checks passed
@dylanmtaylor dylanmtaylor deleted the fix-script-util-linux-242 branch April 5, 2026 15:00
@dylanmtaylor
Copy link
Copy Markdown
Contributor Author

To validate:

util-linux 2.41 (Fedora 44)

podman run --rm quay.io/fedora/fedora:44 bash -c '
dnf install -y util-linux-script &>/dev/null
script --version
script -e -f -O /dev/null -q -c "echo works"
'

util-linux 2.42 (Rawhide)

podman run --rm quay.io/fedora/fedora:rawhide bash -c '
dnf install -y util-linux-script &>/dev/null
script --version
script -e -f -O /dev/null -q -c "echo works"
'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants