diff mbox series

[1/2] test/py: efi_secboot should not assume sbin is in the path

Message ID 20200422155255.148711-2-xypron.glpk@gmx.de
State New
Headers show
Series test/py: fix test_efi_secboot/conftest.py | expand

Commit Message

Heinrich Schuchardt April 22, 2020, 3:52 p.m. UTC
For non-root users /sbin is typically not in the path. So use absolute
paths to mkfs.vfat and sgdisk.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 test/py/tests/test_efi_secboot/conftest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.26.1

Comments

AKASHI Takahiro April 23, 2020, 12:03 a.m. UTC | #1
Heinrich,

On Wed, Apr 22, 2020 at 05:52:54PM +0200, Heinrich Schuchardt wrote:
> For non-root users /sbin is typically not in the path. So use absolute
> paths to mkfs.vfat and sgdisk.

As Stephen pointed out somewhere else else before, you should
set $PATH properly instead of using an absolute path directly.

Thanks,
-Takahiro Akashi



> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  test/py/tests/test_efi_secboot/conftest.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
> index e542fef6e8..40cdf15bf2 100644
> --- a/test/py/tests/test_efi_secboot/conftest.py
> +++ b/test/py/tests/test_efi_secboot/conftest.py
> @@ -48,12 +48,12 @@ def efi_boot_env(request, u_boot_config):
>          # create a disk/partition
>          check_call('dd if=/dev/zero of=%s bs=1MiB count=%d'
>                              % (image_path, image_size), shell=True)
> -        check_call('sgdisk %s -n 1:0:+%dMiB'
> +        check_call('/sbin/sgdisk %s -n 1:0:+%dMiB'
>                              % (image_path, part_size), shell=True)
>          # create a file system
>          check_call('dd if=/dev/zero of=%s.tmp bs=1MiB count=%d'
>                              % (image_path, part_size), shell=True)
> -        check_call('mkfs -t %s %s.tmp' % (fs_type, image_path), shell=True)
> +        check_call('/sbin/mkfs.%s %s.tmp' % (fs_type, image_path), shell=True)
>          check_call('dd if=%s.tmp of=%s bs=1MiB seek=1 count=%d conv=notrunc'
>                              % (image_path, image_path, 1), shell=True)
>          check_call('rm %s.tmp' % image_path, shell=True)
> --
> 2.26.1
>
Heinrich Schuchardt May 15, 2020, 3:39 p.m. UTC | #2
On 22.04.20 17:52, Heinrich Schuchardt wrote:
> For non-root users /sbin is typically not in the path. So use absolute
> paths to mkfs.vfat and sgdisk.

Ilias pointed me to virt-make-fs (Debian package libguestfs-tools). With
this command the creation of file systems would become much easier.

Best regards

Heinrich

>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  test/py/tests/test_efi_secboot/conftest.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
> index e542fef6e8..40cdf15bf2 100644
> --- a/test/py/tests/test_efi_secboot/conftest.py
> +++ b/test/py/tests/test_efi_secboot/conftest.py
> @@ -48,12 +48,12 @@ def efi_boot_env(request, u_boot_config):
>          # create a disk/partition
>          check_call('dd if=/dev/zero of=%s bs=1MiB count=%d'
>                              % (image_path, image_size), shell=True)
> -        check_call('sgdisk %s -n 1:0:+%dMiB'
> +        check_call('/sbin/sgdisk %s -n 1:0:+%dMiB'
>                              % (image_path, part_size), shell=True)
>          # create a file system
>          check_call('dd if=/dev/zero of=%s.tmp bs=1MiB count=%d'
>                              % (image_path, part_size), shell=True)
> -        check_call('mkfs -t %s %s.tmp' % (fs_type, image_path), shell=True)
> +        check_call('/sbin/mkfs.%s %s.tmp' % (fs_type, image_path), shell=True)
>          check_call('dd if=%s.tmp of=%s bs=1MiB seek=1 count=%d conv=notrunc'
>                              % (image_path, image_path, 1), shell=True)
>          check_call('rm %s.tmp' % image_path, shell=True)
> --
> 2.26.1
>
AKASHI Takahiro May 18, 2020, 12:47 a.m. UTC | #3
On Fri, May 15, 2020 at 05:39:31PM +0200, Heinrich Schuchardt wrote:
> On 22.04.20 17:52, Heinrich Schuchardt wrote:
> > For non-root users /sbin is typically not in the path. So use absolute
> > paths to mkfs.vfat and sgdisk.
> 
> Ilias pointed me to virt-make-fs (Debian package libguestfs-tools). With
> this command the creation of file systems would become much easier.

Okay, and are you going to revert this change and submit another patch?

-Takahiro Akashi

> Best regards
> 
> Heinrich
> 
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> > ---
> >  test/py/tests/test_efi_secboot/conftest.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
> > index e542fef6e8..40cdf15bf2 100644
> > --- a/test/py/tests/test_efi_secboot/conftest.py
> > +++ b/test/py/tests/test_efi_secboot/conftest.py
> > @@ -48,12 +48,12 @@ def efi_boot_env(request, u_boot_config):
> >          # create a disk/partition
> >          check_call('dd if=/dev/zero of=%s bs=1MiB count=%d'
> >                              % (image_path, image_size), shell=True)
> > -        check_call('sgdisk %s -n 1:0:+%dMiB'
> > +        check_call('/sbin/sgdisk %s -n 1:0:+%dMiB'
> >                              % (image_path, part_size), shell=True)
> >          # create a file system
> >          check_call('dd if=/dev/zero of=%s.tmp bs=1MiB count=%d'
> >                              % (image_path, part_size), shell=True)
> > -        check_call('mkfs -t %s %s.tmp' % (fs_type, image_path), shell=True)
> > +        check_call('/sbin/mkfs.%s %s.tmp' % (fs_type, image_path), shell=True)
> >          check_call('dd if=%s.tmp of=%s bs=1MiB seek=1 count=%d conv=notrunc'
> >                              % (image_path, image_path, 1), shell=True)
> >          check_call('rm %s.tmp' % image_path, shell=True)
> > --
> > 2.26.1
> >
> 
>
diff mbox series

Patch

diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
index e542fef6e8..40cdf15bf2 100644
--- a/test/py/tests/test_efi_secboot/conftest.py
+++ b/test/py/tests/test_efi_secboot/conftest.py
@@ -48,12 +48,12 @@  def efi_boot_env(request, u_boot_config):
         # create a disk/partition
         check_call('dd if=/dev/zero of=%s bs=1MiB count=%d'
                             % (image_path, image_size), shell=True)
-        check_call('sgdisk %s -n 1:0:+%dMiB'
+        check_call('/sbin/sgdisk %s -n 1:0:+%dMiB'
                             % (image_path, part_size), shell=True)
         # create a file system
         check_call('dd if=/dev/zero of=%s.tmp bs=1MiB count=%d'
                             % (image_path, part_size), shell=True)
-        check_call('mkfs -t %s %s.tmp' % (fs_type, image_path), shell=True)
+        check_call('/sbin/mkfs.%s %s.tmp' % (fs_type, image_path), shell=True)
         check_call('dd if=%s.tmp of=%s bs=1MiB seek=1 count=%d conv=notrunc'
                             % (image_path, image_path, 1), shell=True)
         check_call('rm %s.tmp' % image_path, shell=True)