Replies: 6 comments 3 replies
-
I'm a bit torn about this. I don't think we need to care too much about non-POSIX support - if anyone turns up who desperately has to run es on some bizarre OS, they can easily grab an older version - but there's a bit of 'if it isn't broke, don't fix it'. Any time you touch a mostly untested code-base there's the chance that you break something in some strange/unexpected way... but I'm not the one trying to actually work with the code, and haven't been looking at the PRs, so if you'd enjoy doing do some careful cleaning up I'm not going to complain. |
Beta Was this translation helpful? Give feedback.
-
I don't think I mean to do any clean-up just for the sake of clean-up, but -- to look more into my motivating examples here... Autoconf, which is basically our best authority on portability right now, seems upset about using But a fake The Trying to fix this in a way that works for all the UNIXen all the time is complicated, though: back in the day, SysV and BSD created their own incompatible ways to group processes, and the POSIX spec tried to come up with something new that kinda-sorta smooshes the two together, but which more closely matches the BSD way. So the most-correct way to do things seems to be: "do it the POSIX way, unless you can't, in which case do it the BSD way, unless you can't, in which case do it the SysV way." But this is complicated by itself, I don't know how to correctly test for it (autoconf docs aren't much help since they mostly say "everything is POSIX"), and it has subtle semantic implications that I don't understand (what happens on every one of these systems when a backgrounded job reads from the terminal? Outside of POSIX, I couldn't tell you.) So in both of these cases we know how to strive for absolute, maximum portability, but it's strictly harder to implement and I can't even guarantee non-POSIX systems will get the only-mostly-correct behavior I expect, because I can't really find any! |
Beta Was this translation helpful? Give feedback.
-
I tend to lean heavily in favor of careful removal of legacy code instead of leaving it to bitrot. Does es even work on some of these platforms still? |
Beta Was this translation helpful? Give feedback.
-
Relatedly, I just discovered that es seems to mostly work fine on Haiku (impressive!), except that Haiku encodes WIFEXITED/WIFSIGNALED/WIFSTOPPED differently than Linux and friends, meaning that, for example, any normal falsey exit status gets interpreted as a WIFSIGNALED:
and so on. I don't believe POSIX actually specifies how exit statuses should be encoded in wait() -- might be something to be fixed here. |
Beta Was this translation helpful? Give feedback.
-
I would not remove "effectively dead" code unless there is good test coverage, because it's effectively a refactoring. As @wryun mentioned, there is unknown risk associated with all code modifications, even the ones that look reasonable. Doubly so without great test coverage. I've harped on proper test coverage for Assuming I can find the time. 3.5 year old toddlers steal a lot of it... This is such a neat and underrated shell IMHO, though. My latest shell-envy has been of newer shells like NuShell and Murex that permit piping of structured data instead of unstructured strings, but (like most everything unfortunately) they're not particularly "functional" Anyway, I think expecting POSIX is fair. At least POSIX is a standard... |
Beta Was this translation helpful? Give feedback.
-
If you have commits containing better test coverage that you'd be willing to share, I'd be happy to try upstreaming them. I should really get to work on better test coverage myself and I'm feeling a bit guilty about that. (I've even been merging more changes without tests included! Terrible!) At least we've been working on getting stricter compilation and more standards compliance working, that's an improvement at least. Actually, once #163 is merged and the stricter flags are integrated into testing/building, I think the "POSIX-ification project" is basically done! At which point I promise I'll get to writing more tests......
I do think this would be an interesting direction to explore for es. I'm not picturing this being facilitated through pipes in es (personally, I prefer pipes stay pipes and structured data use another mechanism) but some extension of es' native exceptions/rich returns/arguments seems like it should work. I suggested something with this in mind in #67 but I think if we wanted to make it real and worthwhile we'd want to consider first-class environments (which aren't such a crazy idea -- they're something the original authors were considering) as well as something like python's |
Beta Was this translation helpful? Give feedback.
-
There are a few places in es' codebase where it currently fusses about working right in this-or-that buggy or incompatible UNIX from back when that was the way the world looked in the early '90s. These days it seems to me that among the various extant UNIXoid OSes, POSIX support has gotten pretty good and coding es to POSIX APIs would be pretty reasonable.
A couple specific examples I have in mind:
waitpid(3)
inproc.c
? It would be nice to be able to unify on a single system version of wait.setpgid(3)
inprim-sys.c
? The current behavior withsetsid(3)
is actually (IMO) a bug given how differently the two functions behave under POSIX.I'm not trying to yank out current compatible behavior just for the heck of it, but it would be nice to not have to do a, say,
HAVE_WAITPID
test for what seems like it should be extremely standard functionality.Does anyone have a strong reaction to this? Is anyone using es on a not-very-POSIX machine?
Beta Was this translation helpful? Give feedback.
All reactions