fail() sentinel fallback does not cover ok_new==true with no obj/err #53
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type
docs
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-lua-common#53
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
fail()'s local sentinel fallback does not fully guarantee adaw_error/v1-shaped return value.
If
pcallsucceeds (ok_new == true) butdaw_error.new()returnsneither
objnorerr(e.g.nil, nil),fail()returnsnil.A caller then does
return nil, nil, silently violating the "alwaysreturn a daw_error/v1 on failure" rule this sentinel path exists to
protect against.
Found while reviewing the daw_i18n/v1 migration of crypto/hash.lua
(DAW/daw-lua-common#48), but the same
fail()shape exists in everyfile migrated so far (base64.lua, config_parser.lua, crypto/hash.lua)
and likely in further not-yet-migrated files using the same pattern.
Scope
fail()implementations using this patternok_new == truebutobj == nilanderr == nilgap,e.g. falling through to the same sentinel object instead of
obj or err(pcall crash) case
Acceptance criteria
fail()implementations identifiedRelated
DAW/daw-lua-common#48
Also affects crypto/init.lua (same fail()/missing() fallback shape as hash.lua and hmac.lua). No separate issue -- covered by this one.
Also affects decimal/util.lua, decimal/init.lua, decimal/convert.lua, decimal/compare.lua, decimal/arith.lua (same fail()/no_util()/missing() fallback shape). No separate issue -- covered by this one.
Also affects fs/dir.lua's err() (same fail()-shape). No separate issue -- covered by this one.