-
Notifications
You must be signed in to change notification settings - Fork 123
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
RFC0007-Weak-Aliases comments #16
Comments
In general I support the RFC. That would be a short term fix. In the long run it would be better if invoke-webrequest provided all of the same functionality as curl. Windows Administrators have had to deal with other changes from commands that were built into the OS. For example, dir /s was an important command pre-PowerShell and we had to adjust to using dir -recurse because dir is an alias for get-childitem. Another option would be to modify the invoke-webrequest cmdlet to look to see if you are on a *nix system and if so if there a parameter error then actually make the call to the curl binary with those parameters. This would allow the functionality to stay the same as it is now for those using the curl alias and also allow the use of the curl binary. The performance impact should be minimal. |
This workaround is even worse. As pointed out in the RFC document:
This difficulty comes from a user who uses scripts but cannot fix a script. It is more than possible that such a user also uses cURL, or use a batch script that relies on it. This is a scenario you cannot fix. I do not think we have to be so upset resolving this issue as everyone out there knows the rule now. And it is costly to compromise backward compatibility since there are scripts no longer maintained by anyone. For now, I think we can implement PowerShell currently makes everything in/out a native utility string. While this works for some people, it won't work if you cannot decide the encoding of the input/output like you can do in I think we eventually will have binary pipe and this should happen in near future with the power of community. Like there is not much sense in piping objects into/out of native utilities, there is also not much sense in using the binary piping syntax with cmdlets/functions. When the binary piping is used, PowerShell should search native utilities and aliases of native utilities only (or at least before searching cmdlets/functions/aliases of them). This will virtually resolve all sensible scenario where cURL is invoked. |
I'm not sure what you mean by a "binary pipe" here, or why that would affect command precedence, but changing command precedence in this way would be such a massive breaking change that it will never happen. (Consider all the discussion that had to go into just removing two fairly little-used aliases, by comparison.) |
My main concern with the weak alias proposal is that cURL and/or wget already exist on many Windows systems. For example, there's a copy of curl.exe on my path as part of msysgit / Git for Windows. Granted, it wasn't shipped as part of the OS, but it still means the weak alias proposal may not help as much as you'd think. |
Unfortunately, this sort of change would have to happen right in the PowerShell engine (which is a pretty ugly hack). The Invoke-WebRequest cmdlet's code won't even start to execute if you pass it parameters that don't match its metadata. |
Personally, I'd be in favor of just sticking the Obsolete attribute on these aliases (and adding plumbing to the engine to write warnings if an obsolete alias is executed, assuming it doesn't exist already) for a while, and eventually removing them in a future release. It's a breaking change, but one with plenty of warning time for people to get their scripts sorted out. The workaround is a clever idea to try to have it both ways, but will likely just introduce more confusion for users when scripts suddenly stop working after some other software package is installed. |
The real underlying problem is that because this alias exists, the term This also reveals a sort of underlying problem in how PowerShell development is being managed as well: there seems to be no path to deprecating features for removal in a future version. You cannot provide backwards compatibility indefinitely and expect the system to remain clean. So maybe before addressing these aliases specifically, we need to ask the question, "How do you deprecate and remove or significantly alter features?" Python has what I consider to be a decent model to consider on that front: the Could something similar be done here? I envision a command or something similar that would remove the aliases in current versions, but in a future version, it would become a no-op because it's the default. It should also just pass if the aliases were removed manually. I would even go so far as to say it should disable all aliases in scripts. I tend to agree that when you're writing code to be run elsewhere, it's better for it to mean exactly what it says. Someone pointed this out in the other issue. This could be implemented in a manner similar to how
Or if you really want to mimic Python:
It would be a little annoying to declare this in all my scripts, but not much more annoying that declaring they require PowerShell 3 or higher. This also significantly lessens ambiguity across the board and encourages the good practice of avoiding aliases in scripts. If you're strongly against disabling all aliases, we could be a bit more selective:
You could still have the additional PowerShell somehow raising notices about the deprecation and impending removal of the aliases when they're used would be important. This would give the impending removal a good chunk of visibility, so users of scripts relying on it would be very aware that their scripts are going to break in a coming version. This of course doesn't address when you're hacking at the command line. I'm much less concerned about this use case. Someone actively crafting their commands on the spot can fairly easily remove the aliases manually to avoid this problem. Again, that's annoying, but if we solve the problem of the scripts, then the aliases can be ditched completely in a future version. So that the annoyance would at least eventually be removed. My paragraph about Python's @dlwyatt You can edit your messages, you know. It would likely be better to combine them into one. |
Im not sure how come my solution (comment) is MISSING from PowerShell/PowerShell#1901 The basic idea is to identify if the user is trying to use curl (correct usage) or WebRequest (incorrect usage)
|
@kuldeepdhaka I think your proposal shares many of the same problems as the current proposal itself. It introduces complexity and creates more ambiguity. It doesn't really solve the problem. It just puts an ugly band aid over it, likely to result in unpredictable/weird behavior sooner or later. |
With extension to the above solution. as you can see,
Edit1: fixed a minor mistake in code. |
@bladeoflight16 imo it is more ugly, since the motivation is to fix someone else code with introducing changes in PowerShell. 👎 this script can reside external to PowerShell code to make sure user/designer can manually changed/remove (in future). |
@kuldeepdhaka If you had bothered to read my post before yours, you would know what I think of the current proposal, and you would have seen an alternative suggestion that I feel would be better in the long run. I am not here to argue. Either be mindful of what's already been said and be courteous to people who disagree with you or don't participate at all, please. Thank you. |
I dont understand why someone want to add weak alias (to be abused too in future?) when a little script can do the trick. |
@bladeoflight16 so you want a beautiful looking solution just drop from heaven to solve the problem? |
@bladeoflight16 i readed your post but you later added (edited) and added the actual long content. |
@bladeoflight16 in future, the script can be remove to remove the backward compatiblity thing. |
This is a false assertion. Once a piece of functionality exists, script writers will write scripts that will break if it is removed. Someone (perhaps a lot of people) will rely on it, and then we'll be having this discussion all over again. |
@bladeoflight16 btw, your
|
(although @jpsnover told me to comment on the issue apparently that is not preferred, so I'm copy/pasting my commentary here) This just trades one breaking change for another. I agree that it's less common that someone will have curl or wget in %path% on Windows, but I do (because they're useful tools), and virtually every *nix user will have one or other or both in $PATH, so existing scripts are still going to break. I think it's time to recognize that the "mimic" aliases have never been satisfactory. Their imitation of the real commands (whether cmd.exe built-ins or unix standalone programs) has only been superficial, and as such they've never been anything more than a crutch to work around some of PowerShell's verbosity. If you really want wget or curl, if you're familiar with their options and capabilities, the aliases are useless anyway. The way forward should be staged deprecation and then removal. Something along the lines of: v.Next: the mimic aliases on by default, some kind of deprecation warning on use, and a single switch to disable them all The only aliases that PowerShell should provide by default are those that are in the PowerShell vernacular; aliases such as iwr and gci, which provide short-hand for PowerShell commands without the misrepresentation that the likes of the curl and ls aliases impose. |
I also don't fully understand why scripts don't start from a fully clean environment; aliases have a role in interactive use, but surely not anywhere else. (though I could be swayed for a few such as 'where' for 'where-object') |
(pasting as well, both @lzybkr and @jpsnover provided incorrect guidance on Twitter) @DrPizza and I came to very similar solutions for apparently very similar reasons. The Weak Alias proposal simply moves the problem around and creates new harder-to-debug ones. Strongly suggest scrapping this idea and simply begin the sunset of built-in aliases across platforms. PowerShell Current Aliases available, normal behavior Aliases available, normal behavior, use emits deprecation warning Aliases unavailable, new behavior, use emits 'behavior changed' warning Aliases unavailable, new behavior, no warning |
PowerShell should fully remove the all unix alias to Microsoft Windows commands. claiming just because If Microsoft is now trying to do (or something similar)
because if curl.exe is not installed, then user (will unknowingly) use Invoke-WebRequest. |
So, what we need is, a full removal of unix -> microsoft windows utilities alias! just place some compatibility code that make sure older code work as expected (for now). |
@DrPizza @riverar I favor (and proposed above) a script level control similar to |
@bladeoflight16 That sounds reasonable to me. Maybe this and a reg flag would do (to cover scenarios where PowerShell and scripts are embedded in some LOB app). |
@kuldeepdhaka - You can submit a new RFC to remove aliases, but this RFC is not for that discussion, this RFC is to discuss the merits of a weak alias that might be used for multiple reasons, one of which is to mitigate usage of I considered your approach of introducing a proxy function - on the surface it seems like an option. The biggest issue is there are real world examples where the usage is ambiguous - a proxy doesn't help at all in such cases. I would also expect other complexities to come up a proxy - e.g. not getting the argument parsing just right. I'm more confident that alias can be implemented in a simple way. |
@bladeoflight16 - I think it's reasonable to propose a new RFC to disallow aliases in scripts, but let's keep the discussion on the pros and cons of this specific proposal. In PowerShell V5, I introduced the |
@lzybkr i DONT thing you are trying to mitigate the im getting a foul smell and this time it would be even more hard to claim that it is wrong. The side effect of weak alias will create problem for the community in future. |
Looks like the PowerShell Team be meeting on Tues (8/30) instead of today. As long as this RFC is open, continue posting comments. Thanks. |
Progressively marking "sham" aliases as deprecated with increasing warnings prior to removal seems like the best path to me. Informally speaking to many I know who have tried and given up on PowerShell as an interactive shell there is a common theme: "the aliases do not do what I mean." Simple memorized keystrokes ('ls -l', 'dir /s') do not do what the user expects and heavily violate POLA. Weak aliases are an interesting solution here but I would be more in favor of simply removing these malapropos entirely. |
Wait, I have to type |
@be5invis The "PowerShell" alias for |
One keystroke for a command used hundreds times per day is many. ???? iPhone ? 2016?9?4??08:19?Keith Hill <notifications@git.luolix.topmailto:notifications@github.com> ??? @be5invishttps://github.com/be5invis The "PowerShell" alias for Copy-Item is cpi. It's just one more character than cp. You are receiving this because you were mentioned. |
@joeyaiello I think a key word that your summary of the analysis/discussion misses is "ambiguity." It's ambiguous what a weak alias would mean. It would call different things on different machines, leading to unpredictable behavior. That unpredictability means that you can't depend on the alias to work across different machines, both at the command line and in scripts. How is an unreliable alias any better than just removing the alias entirely? I don't think it is. Everyone would still need to stop referencing it to get predictable behavior, so what does it accomplish? |
@be5invis no matter what is decided, you will always be able to put In fact, I would hope to see an |
As discussed by the committee, closing this issue as no more comments needed for this rejected RFC |
@microsoft @jpsnover @SteveL-MSFT Nice trick. You were waiting for the community to settle to silently close the RFC. You promised to fix the issue when the issue was at peak and now shamelessly "rejected RFC". !?$#! |
nice one, this is exactly how much you care about open source and the community. no surprises here... |
It is not solving the problem. The true solution may be implementing a typed, parameter-compatible set of Unix tools. ???? iPhone ? 2016?11?17??21:47?brabo <notifications@git.luolix.topmailto:notifications@github.com> ??? nice one, this is exactly how much you care about open source and the community. no surprises here... You are receiving this because you were mentioned. |
@kuldeepdhaka - we are hardly silent here - the discussion is all public, and you can see the rationale for closing in the RFC itself. As previously mentioned, and in line with your suggestion, the next major version of PowerShell (6.0) does not have (and in fact never had) the alias |
To be clear, the new open source implementation of PowerShell that runs on Linux, Mac, Windows does not define the curl alias. |
@lzybkr @rkeithhill I will repeat what is said in #16 (comment):
By full i means Possible pathway: What i see wrong is, Example: people will expect Just removing
BTW, releasing the code under Open Source licence do not make these illict alias, less illict. |
@kuldeepdhaka I stick on making a new set of commands. |
Those aliases, along with curl/wget, have been removed from the Linux versions of PowerShell. I just checked the alpha.13 version for Ubuntu 14.04. |
@rkeithhill He's talking about the Windows version. This is the real "breaking" change -- there may be a lot of scripts are using them. |
@kuldeepdhaka Be smarter (and frankly, more respectful) about what you're requesting. Removing or changing the syntax of commands that have been in use in an environment for 10 years and that may be in production scripts (whether they should be or not is irrelevant) that companies depend on is not really an option, just as going back in time to make sure this doesn't happen isn't an option either. You're wasting the time of yourself and others as long as you're stuck on that point. Even without considering Unix, within the Windows environment PowerShell has used aliases to make transitioning from cmd.exe, a Windows utility, easier. The dir alias is a great example of this. If you were used to running commands like
The first one of those two would probably be better served today by optional modules or code snippets or some other learning feature that would help users transition from one environment to another. But when PowerShell 1.0 came out 10 years ago, aliases made it a lot easier for users to begin PowerShell adoption, and when aliases were presented to users, they were presented as being different from their equivalent native command, as something that should not be used in production scripts, and as a learning tool. Fast forward to today, and you're coming in to PowerShell after 10 years of history, without interest in understanding the past nor the big picture behind the decisions that were made, after changes were already made in the Linux version of PowerShell based on this discussion to adjust how aliases are used there, and demanding changes that will break production scripts. How can you possibly expect to be taken seriously? What is an option is for Windows PowerShell users to recognize the Unix command differences and modify their environment using a profile script. For example, anyone wanting to make the Unix commands act more like Unix on a Windows system can install Cygwin and drop this in their PowerShell profile: That's easy for Windows PowerShell users to do, and simply requires some documentation/blog posts to help them discover why it is beneficial to make such a change. Asking for anything else related to changing the default behaviour of Windows PowerShell is nothing more than a waste of time. |
You didn't want this fix anyway @kuldeepdhaka -- why are you moaning about it (especially all these months later?) Nobody liked this proposal, we need a different fix. Rejecting this proposal doesn't deny the problem. |
@Jaykul I was waiting for people to implement the fix. so, i waited to see what comes out. Not fixing the problem is same as denying the problem. (and rejecting the proposal is the first step) |
@KirkMunro If you are doing mistake for past 10 year of your life, will you keep repeating it just for the sake of hiding it? What im saying is: in the next major release,
You are getting all the benifit by creating chaos, confusion and blurring the UNIX (and derivative platforms) taste and ease of use. Default setting has always been a powerfull tool (+ Microsoft dominant position on OS market.) |
@kuldeepdhaka Every point I made in my last reply stands. There was nothing personal about it, and it wasn't an attack. The reply was an appropriate response to your comments on the thread. You very clearly don't understand. Perhaps it's a language issue. Or perhaps you're not reading the replies that people post to you, nor really trying to understand the bigger picture. In either case:
Anyway, while I thought I might be able to bring you some clarity on this subject, I'm done with this thread now. You can't please everybody. ¯\_(ツ)_/¯ |
Invoke-WebRequest wont work without IE because it's using IE behind the scenes, and that's also the reason for the bloated memory consumption of the command. And as a side note, EU has forbidden the browser to be shipped with Windows (MS rightfully got fined for including it). Users currently having strange problems with Invoke-WebRequest on lawfully installed systems because the browser components are missing. Please remove the command altogether, with its different aliases. |
@kuldeepdhaka it's illict to assume anything was done by MS (you probably spell it with $ at end, right?) here. All aliases that resemble unix/Linux commands are there because of muscle memory of PowerShell team members, and muscle memory of people who think about useful tools, not religious approach to them. Do I want these aliases to behave like same commands on Linux? HELL NO! And if you prefer to use exactly same tools and get the same results yourself - nothing is stopping you from removing/overwriting these aliases on your system. |
@bielawb Im saying: Do not enable these alias by default, let people make their own decision (either a global option OR Illict alias should be dropped! |
@jaetwh Invoke-WebRequest with PowerShell Core 6.0 doesn't depend on IE (try it today on Ubuntu which I assure you doesn't have IE). @kuldeepdhaka the aliases have been removed from PowerShell Core 6.0 for awhile now |
Recommend locking this issue. Clearly, no more discussion is required since the RFC was rejected, and if useful discussion goes beyond this RFC, it belongs elsewhere. (Importantly, locking would starve the trolls feeding here.) |
[PowerShell Committee has Rejected this RFC, see decision for details]
This issue is to discuss the weak aliases RFC.
This proposal helps address issues related to the
curl
/wget
aliases introduced in PowerShell V3.The discussion should focus on the strengths and weaknesses of this specific proposal and on avoiding or minimizing breaking changes. Ideally, existing scripts should continue to run without any changes when a new version of Windows PowerShell is installed.
Note that doing nothing is the only way to completely avoid breaking changes - the goal of this RFC is to find a compromise.
This RFC does propose a breaking change, but only in scripts where
curl
andwget
are meant to callInvoke-WebRequest
butcurl.exe
orwget.exe
are found via the path. We don't have data on how often this might be an issue - but if a future version of Windows installscurl.exe
andwget.exe
by default, then it may be pointless to implement this RFC as that would be equivalent to removing the aliases.The text was updated successfully, but these errors were encountered: