Skip to contentSkip to conversation

devtool: provide explicit error for missing "script" command

PATCH In review Walter Werner Schneider 2 participants 2 messages Jun 13 – Jun 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtool: provide explicit error for missing "script" command

Without this "script" command, the "devtool build" provides a very ambigous error: /bin/sh: line 1: script: command not found. With this patch we provide a more detailed error.

On Fedora 43 the "script" command is not present by default, one needs to install the "util-linux-script" package. On other systems it's in a different package.

---
 scripts/lib/devtool/__init__.py | 3 +++
 1 file changed, 3 insertions(+)
scripts/lib/devtool/__init__.py +3 -0
index f47f57c465..58b02eb460 100644
@@ -42,6 +42,9 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
         init_prefix = ''
     if watch:
         if sys.stdout.isatty():
+            import shutil
+            if not shutil.which('script'):
+                raise DevtoolError('The util-linux "script" command was not found')
             # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly)
             cmd = 'script -e -q -c "%s" /dev/null' % cmd
         return exec_watch('%s%s' % (init_prefix, cmd), **options)

---
base-commit: dcaea329458c741f47560d51732e3d9c88f3d5b4
change-id: 20260613-script-command-not-found-14e1a3be7410

Best regards,

Signature · 1 line
Walter Werner Schneider <[email protected]>
#1 lore raw

Hi Walter,

Quoted 8 lines · Walter Werner SCHNEIDER via lists.openembedded.org

Without this "script" command, the "devtool build" provides a very ambigous error: /bin/sh: line 1: script: command not found. With this patch we provide a more detailed error.

On Fedora 43 the "script" command is not present by default, one needs to install the "util-linux-script" package. On other systems it's in a different package.

Just for reference, note that we have it in the list of required packages in the docs, c.f. https://docs.yoctoproject.org/ref-manual/system-requirements.html#fedora-packages.

Cheers,
Quentin