Re: [yocto-patches] [wic][PATCH 0/4] oe/path: three fixes plus unit coverage

Paul Barker <[email protected]> Wed, 15 Jul 2026 19:01:25 +0100
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
On Thu, 2026-07-09 at 16:52 -0400, Trevor Woerner via
lists.yoctoproject.org wrote:
> This series continues the standalone unit-test work, this time over
> oe/path.py. It follows the same shape the suite settled on: each
> source fix is its own standalone commit, and the green test module
> lands last, so the suite passes at every commit.
> 
> Three fixes come first, each independent of the others:
> 
>   - __realpath's isdir guard assigns a bare `false`, which is not a
>     Python name; when os.path.isdir() raises, the handler meant to
>     absorb the error raises NameError instead. Use the builtin False.
>   - symlink(force=True) cleared the destination through remove(), which
>     globs its argument; a destination containing glob metacharacters
>     could fail to match itself or match unrelated files. Remove the
>     literal destination instead.
>   - canonicalize('') and canonicalize(None) returned the current
>     working directory, because os.path.realpath('') does; a stray
>     separator injected a spurious cwd entry too. Skip empty tokens.
> 
> The final commit adds tests/unit/test_oe_path.py, covering oe/path's
> own logic (join, is_path_parent, symlink, make_relative_symlink,
> canonicalize, which_wild, realpath) and locking in the three fixes.
> Backing any fix out turns the matching test red. The suite is green
> and ruff-clean, and the series passes oe-core's wic oe-selftest with
> no regressions.
> 
> Trevor Woerner (4):
>   oe/path: fix bare `false` NameError in __realpath's isdir guard
>   oe/path: don't glob-expand the destination in symlink(force=True)
>   oe/path: canonicalize('') should return '' rather than the cwd
>   tests/unit/test_oe_path: cover oe/path's own path logic
> 
>  src/wic/oe/path.py         |  21 ++-
>  tests/unit/test_oe_path.py | 298 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 316 insertions(+), 3 deletions(-)
>  create mode 100644 tests/unit/test_oe_path.py

Hi Trevor,

As src/wic/oe/path.py is a copy of meta/lib/oe/path.py from OE-core, I
you should propose the fixes on the OE-core mailing list so that the
rest of the project can benefit from them. The fix for bb/utils.py in
the previous series was not applicable in bitbake itself, but the fixes
here are definitely applicable in OE-core.

It would also be better for unit tests covering these functions to live
in the OE-core selftest suite if possible. Tests in wic are better than
no tests though!

What we should avoid though is the library functions copied in from
bitbake & OE-core diverging in wic, as that just complicates
maintenance.

Best regards,

-- 
Paul Barker
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----

iIcEABYKAC8WIQSzjPXf5Y1BDWhU2iCrY1Tsnbr0bgUCalfK9REccGF1bEBwYmFy
a2VyLmRldgAKCRCrY1Tsnbr0bkO6AQCpfOoyOvB3FXt4z2qTphT4q+QbEkYwl/Iv
/8aCCHh6FgEA6LUF0qMFmC6+a07QIJzigc6g/xBRAHW1YbcHTSfKbw4=
=Ca5J
-----END PGP SIGNATURE-----