diff mbox series

[v2,1/4] test: Include /sbin to the PATH when creating ext4 disk image

Message ID 20210211144012.55676-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit 9262fe15599a388e365cca3091e4852be8f23f11
Delegated to: Tom Rini
Headers show
Series [v2,1/4] test: Include /sbin to the PATH when creating ext4 disk image | expand

Commit Message

Andy Shevchenko Feb. 11, 2021, 2:40 p.m. UTC
On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
for mere users. Include /sbin to the PATH when creating ext4 disk image,
so that users won't get a scary traceback from Python.

Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: used '/sbin' as is (Simon)
 test/py/tests/test_env.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko Feb. 11, 2021, 2:46 p.m. UTC | #1
On Thu, Feb 11, 2021 at 04:40:09PM +0200, Andy Shevchenko wrote:
> On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating ext4 disk image,
> so that users won't get a scary traceback from Python.

Note, patches 1 and 4 may be applied to U-Boot sources directly (while patches
2 and 3 are based on top of dm/test-working). Moreover, patch 4 fixes a quite
annoying fix, without which I have got reprimanded by an admin of our build
system.

Please, consider to apply patch 4 ASAP.

> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: used '/sbin' as is (Simon)
>  test/py/tests/test_env.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> index 940279651da0..9bed2f48d77e 100644
> --- a/test/py/tests/test_env.py
> +++ b/test/py/tests/test_env.py
> @@ -414,6 +414,8 @@ def mk_env_ext4(state_test_env):
>      if os.path.exists(persistent):
>          c.log.action('Disk image file ' + persistent + ' already exists')
>      else:
> +        # Some distributions do not add /sbin to the default PATH, where mkfs.ext4 lives
> +        os.environ["PATH"] += os.pathsep + '/sbin'
>          try:
>              u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent)
>              u_boot_utils.run_and_log(c, 'mkfs.ext4 %s' % persistent)
> -- 
> 2.30.0
>
Simon Glass Feb. 18, 2021, 4:45 a.m. UTC | #2
On Thu, 11 Feb 2021 at 07:40, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating ext4 disk image,
> so that users won't get a scary traceback from Python.
>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: used '/sbin' as is (Simon)
>  test/py/tests/test_env.py | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Andy Shevchenko March 15, 2021, 1:59 p.m. UTC | #3
On Thu, Feb 11, 2021 at 04:40:09PM +0200, Andy Shevchenko wrote:
> On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating ext4 disk image,
> so that users won't get a scary traceback from Python.


It has been a long. Is it any news about this series? Can it be applied
(at least patches that are fine against U-Boot current master)?

> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: used '/sbin' as is (Simon)
>  test/py/tests/test_env.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> index 940279651da0..9bed2f48d77e 100644
> --- a/test/py/tests/test_env.py
> +++ b/test/py/tests/test_env.py
> @@ -414,6 +414,8 @@ def mk_env_ext4(state_test_env):
>      if os.path.exists(persistent):
>          c.log.action('Disk image file ' + persistent + ' already exists')
>      else:
> +        # Some distributions do not add /sbin to the default PATH, where mkfs.ext4 lives
> +        os.environ["PATH"] += os.pathsep + '/sbin'
>          try:
>              u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent)
>              u_boot_utils.run_and_log(c, 'mkfs.ext4 %s' % persistent)
> -- 
> 2.30.0
>
Tom Rini March 18, 2021, 4:56 p.m. UTC | #4
On Thu, Feb 11, 2021 at 04:40:09PM +0200, Andy Shevchenko wrote:

> On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating ext4 disk image,
> so that users won't get a scary traceback from Python.
> 
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 940279651da0..9bed2f48d77e 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -414,6 +414,8 @@  def mk_env_ext4(state_test_env):
     if os.path.exists(persistent):
         c.log.action('Disk image file ' + persistent + ' already exists')
     else:
+        # Some distributions do not add /sbin to the default PATH, where mkfs.ext4 lives
+        os.environ["PATH"] += os.pathsep + '/sbin'
         try:
             u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent)
             u_boot_utils.run_and_log(c, 'mkfs.ext4 %s' % persistent)