From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2 0/4] oe/path: three fixes plus selftest coverage
Date: Fri, 17 Jul 2026 10:34:21 -0400 [thread overview]
Message-ID: <20260717143425.3521709-1-twoerner@gmail.com> (raw)
While adding unit coverage for the copy of oe/path.py vendored into the
standalone wic repository, three real bugs turned up in the shared
meta/lib/oe/path.py. They are fixed here at the source so the whole
project benefits, each as its own standalone commit:
- __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 (leaving a stale entry) 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 extends meta/lib/oeqa/selftest/cases/liboe.py with a
PathTests class 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. oe-selftest -r liboe.PathTests runs 46 tests,
all passing.
changes in v2:
- No source changes; the three oe/path.py fixes are unchanged from v1.
- Expand liboe.PathTests from 37 to 46 cases, mostly around the
harder realpath() contracts (self-referential and A->B->A symlink
loops both raising ELOOP, multi-component resolution under
use_physdir, and the assume_dir ENOENT-vs-tolerated contract), plus
a dangling symlink(), a make_relative_symlink() several directories
below its target, and two more canonicalize() cases.
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
oeqa/selftest/liboe: cover oe.path's own path logic
meta/lib/oe/path.py | 21 +-
meta/lib/oeqa/selftest/cases/liboe.py | 376 ++++++++++++++++++++++++++
2 files changed, 394 insertions(+), 3 deletions(-)
--
2.50.0.173.g8b6f19ccfc3a
next reply other threads:[~2026-07-17 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 14:34 Trevor Woerner [this message]
2026-07-17 14:34 ` [PATCH v2 1/4] oe/path: fix bare `false` NameError in __realpath's isdir guard Trevor Woerner
2026-07-17 14:34 ` [PATCH v2 2/4] oe/path: don't glob-expand the destination in symlink(force=True) Trevor Woerner
2026-07-17 14:34 ` [PATCH v2 3/4] oe/path: canonicalize('') should return '' rather than the cwd Trevor Woerner
2026-07-17 14:34 ` [PATCH v2 4/4] oeqa/selftest/liboe: cover oe.path's own path logic Trevor Woerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260717143425.3521709-1-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox