-
Notifications
You must be signed in to change notification settings - Fork 32
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
The 'r' builtin gets in the way of 'r'. What to do about it? #125
Comments
Removing it is changing classic behavior. And you could have a conflict with almost anything out there in the world, anyway. macOS ships /usr/bin/printf, sounds like another conflict. According to 17f81eb What was the rationale for abandoning the aliases in favor of making everything built-ins, anyway? I read the TODO entry, I didn't see the point to it. Now it sounds like having the aliases is desirable. And I don't see the problem with 'unalias' removing them. |
I have never used them but I think having them as an alias rather than as a builtin is easier for users to work with, because they can simply add I personally wouldn't miss any of them but it's very easy for users to unalias them if they need to. |
On second thoughts, they are still useful if one chooses not to, or is unable to use interactive editing. Eg. due to a broken terminal. |
I'm not sure what you mean by "fully interactive command line editing"... ksh has had emacs and vi modes for years. How to retrieve a previous command line varies, and is what's under discussion. |
Myself, rather than dancing the issue, I'll just say I think it should be put back the way it was. You can remove the aliases if you don't like them, you can override them with established methods. But right now you can't do either. |
I definitely support this opinion. especially, converting a single-letter alias like |
It is not, though. Every POSIX compliant OS ships an external |
Thanks for all your comments so far, everyone. Just to make one thing clear: The old set of default aliases is not coming back. This is non-negotiable; please don't bother arguing. There are solid technical reasons for using regular built-in commands instead and that opinion doesn't actually come directly from me (though I underwrite it) but is one I picked up from the Austin group (the POSIX technical standards committee). I could spend hours writing a technical treatise detailing all the corner case bugs and other problems with default aliases, but frankly I don't have either the time or the motivation, and besides, it's off-topic for this issue. This is about whether we want to keep a default However, if using "Do nothing and keep the built-in" is of course also an option. A fourth option is to enable the |
so you want to remove all default aliases, notably
with the important difference that an alias can simply be unaliased. which is a difference that does matter in my view. with a builtin you are "condemned" to rename the external command (silly or not possible in most circumstances) or use full pathnames to call it (totally undesirable).
in case the default alias will not be kept (I've got the message that there are "deep" reasons against default aliases but I am not sure whether they apply categorically or only to certain scenarios and whether the
I would not like this.
I believe |
On Tue, Sep 1, 2020, at 1:41 PM, jghub wrote:
u want to remove all default aliases, notably `alias command='command '`? this simply will cause problems for people relying on established/canonical ksh93 I'd say. sure, one can redefine them but still...
That one is already gone.
…--
Marc Wilson
[email protected]
|
oh really? thanks for the heads up, then. not for me to decide but I find this change unnecessary/problematic from a user perspective. |
I always wondered about that one, and why dgk thought it was a good idea. Let's have Removing it and saying "oh, users can just put the alias in themselves", just means that there's canonical documentation that is now incorrect, because that's not what the canonical documentation says (Bolsky p32 & O'Reilly appendix B.3). Before you could remove it if the conflict existed and bothered you, now you can't. So it's a problem both ways. @McDutchie, I don't think what some other application might do or contain is at all the issue. You will always have the potential for a conflict. Who gets to use the 26 letters of the English alphabet for single-letter commands? Why is what R wants to do, of more importance than what ksh wants to do, and thus ksh should get out of the way? |
Also, from the littler homepage
So they're not too concerned about naming themselves (yes, I know they're specifically referring to case-insensitive filesystems). |
well, ultimately I do agree with that decision to make the alias expansion work on the "real" command to be executed (second word) rather than on the first word ("command" itself).
and other places in that book, notably p.156 were it explicitly advices against modifying/removing the preset aliases for good reasons in my view. although it is not a sacrosanct text of course
+1
I think the relevant point has been made by you and reiterated by me: with aliases the naming collision is a non-problem after it has been recognised since the alias can be modified/renamed. with builtins the naming collision is a problem since it is inconvenient to circumvent (either rename the external program or use full path to it all the time and everywhere). so in my view this strongly indicates that builtins should just not proliferate and "pollute" the name space. |
There was one and only one reason for the Except, this attempt at standards compliance is utterly broken. To see just how broken, try this in non-93u+m ksh:
The cause is revealed if we look at how the
Which means This is also why the whole notion of expanding aliases following To fix this, I've now reimplemented all the standard commands as builtins instead, as well as very common ksh commands such as So, please note that none of the commands that used to be default aliases have been removed in 93u+m; they are just implemented differently. The reason the KornShell book recommends against removing the default aliases (e.g. by using And this means that the whole reason for the @jghub, you said/implied that many user scripts would break as a result of removing the However, you do make a good argument here:
So, after giving it time and thought, I've decided to go back to my original idea and reinstate |
ksh93 has always had an
r
default alias and now 93u+m has anr
built-in command. They are the equivalent ofhist -s
, POSIXly also known asfc -s
. This repeats either the last command in the history or the one specified with a number.The problem is,
r
is the name of a legitimate external utility, part of the "littler" package. It is a scripting and command-line front-end for the GNU R language for statistical computing and graphics.So we really shouldn't have an
r
builtin active by default – particularly as it is also active for scripts, where it is effectively useless.I can see two ways of dealing with this:
/opt/ast/bin/*
paths in the output of thebuiltin
command. By default, those are only run if/opt/ast/bin
is in$PATH
, but they can be turned into proper builtins using thebuiltin
command. Doing this is actually trivial – all that is needed is changing"r"
to"/opt/ast/bin/r"
on this line:ksh/src/cmd/ksh93/data/builtins.c
Line 98 in 77beec1
alias r='fc -s'
in their.kshrc
or.profile
script.Thoughts? Opinions?
The text was updated successfully, but these errors were encountered: