From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Subject: [wic][PATCH v2 1/4] oe/path: fix bare `false` NameError in __realpath's isdir guard
Date: Fri, 24 Jul 2026 07:50:17 -0400 [thread overview]
Message-ID: <20260724115020.38079-2-twoerner@gmail.com> (raw)
In-Reply-To: <20260724115020.38079-1-twoerner@gmail.com>
__realpath() finishes by deciding whether the resolved path is a
directory, tolerating any error from the stat:
try:
is_dir = os.path.isdir(file)
except:
is_dir = false
but `false` is not a Python name -- the intended value is the builtin
False. os.path.isdir() swallows almost everything and simply returns
False for a path it cannot stat, so the except branch is rarely taken;
that is why the typo has stayed hidden. But when isdir() does raise --
for instance an OSError deep in os.stat() on a broken mount -- the
handler that was meant to absorb the error instead raises
NameError: name 'false' is not defined, masking the original failure
with a misleading one.
Use the builtin False so the fallback behaves as intended: a path that
cannot be stat'd is simply reported as not-a-directory.
AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v2:
- No change; carried over from v1.
---
src/wic/oe/path.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wic/oe/path.py b/src/wic/oe/path.py
index 3e95ea0ec923..862edc532ade 100644
--- a/src/wic/oe/path.py
+++ b/src/wic/oe/path.py
@@ -233,7 +233,7 @@ def __realpath(file, root, loop_cnt, assume_dir):
try:
is_dir = os.path.isdir(file)
except:
- is_dir = false
+ is_dir = False
return (file, is_dir)
--
2.50.0.173.g8b6f19ccfc3a
next prev parent reply other threads:[~2026-07-24 11:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 11:50 [wic][PATCH v2 0/4] oe/path: three fixes plus unit coverage Trevor Woerner
2026-07-24 11:50 ` Trevor Woerner [this message]
2026-07-24 11:50 ` [wic][PATCH v2 2/4] oe/path: don't glob-expand the destination in symlink(force=True) Trevor Woerner
2026-07-24 11:50 ` [wic][PATCH v2 3/4] oe/path: canonicalize('') should return '' rather than the cwd Trevor Woerner
2026-07-24 11:50 ` [wic][PATCH v2 4/4] tests/unit/test_oe_path: cover oe/path's own path logic Trevor Woerner
2026-07-24 15:04 ` [yocto-patches] [wic][PATCH v2 0/4] oe/path: three fixes plus unit coverage Paul Barker
2026-07-30 11:55 ` Trevor Woerner
2026-07-30 12:04 ` Paul Barker
2026-07-30 15:57 ` 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=20260724115020.38079-2-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=yocto-patches@lists.yoctoproject.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