hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.2K
active users

@hipsterelectron @zwol Did you miss openat()/the whold *at() family of functions added in POSIX 2008? I think these are exactly what you want. The operate on a relative pathname relative to a given open directory fd, rather than implicitly using the process-global current working directory (which behaves like a hidden file descriptor).

@dalias @zwol fwiw i don't believe there's a rust library that uses openat for traversal yet even though i feel this approach is very appealing to the rust ethos

@hipsterelectron @zwol Probably because Rust is allergic to POSIX and wants non-POSIX Windows runtimes to be first-class... 🙄

Cassandrich

@hipsterelectron Unfortunately there are two philosophies here:

1. POSIX is one of "many" types of platforms, special-cased like "all" the others.

2. POSIX is the agreed-upon standard for how software interfaces with the operating system, and on the ONE system that doesn't at least try to provide it, you patch things up as needed.

Unfortunately Rust seems to be in camp 1...

@hipsterelectron @dalias those who don't learn from Common Lisp pathnames are doomed to reinvent them?

@joe @dalias what's an example of cl pathnames? i should really know more about this

@hipsterelectron @dalias its standard pathname type is both overengineered and underspecified in a way that this conversation reminded me of. they had a similar goal of unifying diverse platforms, but it ended up creating portability issues among lisp implementations of its own cs.cmu.edu/afs/cs.cmu.edu/proj

www.cs.cmu.edu23.1.1. Pathnames

@joe @dalias oh my god

All file systems dealt with by Common Lisp are forced into a common framework,

well there's your first problem

@joe @dalias this is incredibly interesting thank you so much

@joe @dalias cackling

Note that a pathname is not necessarily the name of a specific file. Rather, it is a specification (possibly only a partial specification) of how to access a file. A pathname need not correspond to any file that actually exists, and more than one pathname can refer to the same file.

@hipsterelectron @joe @dalias oh oh! it's like file URIs! we think?

file URIs are neat.

(java is big on URIs for everything, it works alright)

@dalias @hipsterelectron The first one is the objectively correct one. (This doesn't prevent POSIX-specific libraries.)

POSIX's ambient authority is an awful sight.

@lispi314 @hipsterelectron Sorry I can't be bothered to reply to repeated delete-and-redraft. Doesn't your instance have edit if needed??

@dalias @hipsterelectron My client doesn't have it and I haven't yet bothered to patch it.

@dalias @hipsterelectron while posix is common in the server space, it is not the main or even a supported API used by programs on most other platforms, and so it makes sense that the OS interface APIs provided model a common denominator across platforms (which is not posix most importantly)

When you pretend everything is posix, your OS APIs will be modeled after POSIX as well, hardcoding design decisions that are simply not supported on other oses in the same way, if at all.

For example, you might provide a call to get or set the current permissions of a file. on posix this is a simple wrapper around stat and chmod, but what about platforms that only let you mark a file as read only?

you can implement the get the file mode call, sure, but setting it will simply not behave like posix chmod, no matter how hard you try. this will introduce bugs in software that simply doesn’t know or hasn’t accounted for these differences

And this example isn’t taken out of nowhere — that would be how files work without ACLs in windows