From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Date: Wed, 5 Jul 2017 09:34:27 +0200 Subject: [U-Boot] [PATCH] tools: buildman: prevent trying to use the working directory as build dorectory Message-ID: <1499240067-9233-1-git-send-email-LW@KARO-electronics.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de When the U-Boot base directory happens to have the same name as the branch that buildman is directed to use via the '-b' option and no output directory is specified with '-o', buildman happily starts removing the whole U-Boot sources eventually only stopped with the error message: OSError: [Errno 20] Not a directory: '..//boards.cfg Add a check to the builderthread.Mkdir function to verify that the path it tries to create does not match the current working directory. Signed-off-by: Lothar Wa=C3=9Fmann --- tools/buildman/builderthread.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread= .py index acaf500..3549029 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -7,6 +7,7 @@ import errno import glob import os import shutil +import sys import threading =20 import command @@ -27,6 +28,9 @@ def Mkdir(dirname, parents =3D False): os.mkdir(dirname) except OSError as err: if err.errno =3D=3D errno.EEXIST: + if os.path.realpath('.') =3D=3D os.path.realpath(dirname): + print "Cannot create the current working directory '%s'!" = % dirname + sys.exit(1) pass else: raise --=20 2.1.4