[Tracking Issue] Path/filesystem handling is very scary and type unsafe #937

Open
opened 2025-07-28 02:52:02 +00:00 by jade · 1 comment
Owner
  • chroot stores need to become normal stores
  • CanonPath is unclear what its constructor does, what its performance is, etc
  • Exception behaviour is "lol lmao"
  • May inconsistently use CLOEXEC or not
  • May inconsistently use dirfds or not

From EsperLily on Matrix:

it bothers me how many of our filesystem helpers just happily throw exceptions without necessarily being obvious from the function call that it's going to do that. In many cases yeah a permissions problem should turn into a hard error, but in other cases it shouldn't, and because this is done with exceptions it's a silent problem and too easy to miss

From raito on Matrix:

repairing chroot stores meant that i had to sprinkle a bunch of toRealPath(s) while not being certain all the time
so sometimes you need to do nix $COMMAND $PHYSICAL_PATH --store $CHROOT_STORE or substitute $PHYSICAL_PATH for $LOGICAL_PATH
and there's absolutely NO documentation on which command requires what
but this needs to stop
we need to stop having to use toRealPath manually

- chroot stores need to become normal stores - CanonPath is unclear what its constructor does, what its performance is, etc - Exception behaviour is "lol lmao" - May inconsistently use CLOEXEC or not - May inconsistently use dirfds or not [From EsperLily on Matrix](https://matrix.to/#/!lymvtcwDJ7ZA9Npq:lix.systems/$VHWe6qBHQ_0nD2kTbSJUZZn6wshng0uXy-I0KoJ9GXY?via=lix.systems&via=matrix.org&via=catgirl.cloud): > it bothers me how many of our filesystem helpers just happily throw exceptions without necessarily being obvious from the function call that it's going to do that. In many cases yeah a permissions problem should turn into a hard error, but in other cases it shouldn't, and because this is done with exceptions it's a silent problem and too easy to miss [From raito on Matrix](https://matrix.to/#/!lymvtcwDJ7ZA9Npq:lix.systems/$9qzAl6FkGQEWYRjUnm2SFVSQ-XkZeIfQ-3K7P9WxP3M?via=lix.systems&via=matrix.org&via=catgirl.cloud): > repairing chroot stores meant that i had to sprinkle a bunch of toRealPath(s) while not being certain all the time > so sometimes you need to do nix $COMMAND $PHYSICAL_PATH --store $CHROOT_STORE or substitute $PHYSICAL_PATH for $LOGICAL_PATH > and there's absolutely NO documentation on which command requires what > but this needs to stop > we need to stop having to use toRealPath manually
Owner

(a lot of these ideas comes also from discussion with @pennae fwiw.)

(a lot of these ideas comes also from discussion with @pennae fwiw.)
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#937
No description provided.