fs.query exists()/is_dir() silently fold lfs.attributes() errors into false, contradicting their own doc comment #57
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#57
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
fs/query.lua'sexists()andis_dir()collapse everylfs.attributes()outcome into a plain boolean, discarding anyerror:
Both functions' doc comments explicitly claim:
But the implementation doesn't back this claim:
lfs.attributes()can return
nil, errfor reasons other than "path does not exist"(e.g. EACCES on a parent directory, ELOOP on a symlink cycle). Those
cases are currently silently folded into
false, nil-- "confirmedabsent" -- exactly the ambiguity the doc comment says can't happen.
read_attrs()right below handles the samelfs.attributes()failurecorrectly, returning
nil, daw_error/v1(resource_ideead0608-9fb6-4436-9972-96ecd58f8fd6).
exists()/is_dir()don't usethat path.
Found while reviewing the daw_i18n/v1 migration of fs/query.lua
(DAW/daw-lua-common#48). Not an i18n issue, out of scope for #48.
Scope
"confirmed absent/not-a-directory" from "attribute query failed"
(matching their own doc comment), and if so, how
Related
DAW/daw-lua-common#48