-
-
Notifications
You must be signed in to change notification settings - Fork 175
[osh refactor] Simplify GlobUnescapeBackslash() even more? #2400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Regarding this comment, I think the original code in your PR was equivalent to this one line And it doesn't break the tests So I wonder if you think this change should be merged, or if I was thinking we should add either
but I didn't get to look into that yet |
another POSIX shell quirk to write about?In (note: ksh/yash are NOT active by default, I added them locally) I am satisfied with what we have, since it matches the common shells But which behavior is POSIX? (this is not even "bashix", it's POSIX - https://github.com/bashix-spec/bashix?tab=readme-ov-file) My ambition for OSH was to be an "executable spec", in a high level language like Python Basically the idea would be that if anyone else writes a shell in the future, they should base it on OSH, because we figured out all these corner cases and exact behavior, which POSIX doesn't I am not sure if we lived up to that ambition, since we still have some questions, and the code is more complex than I'd like. (i.e. I am still not sure about the double-escape-double-unescape algorithm, maybe it was the wrong thing, but it does work now) So questions like this could be something we write about |
|
No, this change is the complete opposite of what it should be. First of all, the renaming of |
|
OK but what was confusing is that in the original code there was: But that is just doing the identity transformation
That is why I changed it And then I realized it can be changed to I thought that you copied the form of But I guess the problem is that we should have a test case to show if this is wrong Right now it passes all tests I agree it is a bit "suspicious", but I don't know exactly why So that is why I sent this, to ask a question -- not saying how the code should be |
|
I don't mind reverting those changes, but it would help if we have a test case to show why they are wrong I also think the code before those changes can be simplified ? But we could do that after reverting it |
|
Also in 0f31a51#diff-3c590faf773bb408e6224c81321d122f1c1c96ece22f49025969535932c853ec I added unit tests for that specific function (not spec tests) I think this is a good way to have more fine-grained assertions and agreement on what the function is supposed to do i.e. is the input allowed to contain And likewise for the other 3 functions -- we have
|
No description provided.