Re: [PATCH] sepolicy: Call os.makedirs() with exist_ok=True

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2022 at 4:24 PM James Carter <jwcart2@xxxxxxxxx> wrote:
>
> On Mon, Dec 12, 2022 at 12:49 PM Petr Lautrbach <lautrbach@xxxxxxxxxx> wrote:
> >
> > Since commit 7494bb1298b3 ("sepolicy: generate man pages in parallel")
> > man pages are generated in parallel and there's a race between
> > os.path.exists() and os.makedirs().
> >
> > The check os.path.exists() is not necessary when os.makedirs() is called
> > with exist_ok=True.
> >
> > Fixes:
> > /usr/bin/sepolicy manpage -a -p /__w/usr/share/man/man8/ -w -r /__w/
> > FileExistsError: [Errno 17] File exists: '/__w/usr/share/man/man8/'
> >
> > Signed-off-by: Petr Lautrbach <lautrbach@xxxxxxxxxx>
>
> Acked-by: James Carter <jwcart2@xxxxxxxxx>

Merged.
Thanks,
Jim

>
> > ---
> >  python/sepolicy/sepolicy/manpage.py | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
> > index edeb3b77e759..1bff8f9acb49 100755
> > --- a/python/sepolicy/sepolicy/manpage.py
> > +++ b/python/sepolicy/sepolicy/manpage.py
> > @@ -376,8 +376,7 @@ class ManPage:
> >
> >          self.fcdict = sepolicy.get_fcdict(self.fcpath)
> >
> > -        if not os.path.exists(path):
> > -            os.makedirs(path)
> > +        os.makedirs(path, exist_ok=True)
> >
> >          self.path = path
> >
> > --
> > 2.38.1
> >



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux