News for hackers. Stuff that matters.
Re:Sudo for Windows by neurostimulant on Thursday February 08, 2024 @04:03PM (#39307659)
I think they should've named it something else to avoid confusion, especially if it doesn't have the same behavior as unix sudo. If it has different arguments and features, imagine the confusion of unsuspecting users searching how to use sudo in the future.
Re:Sudo for Windows by Springtime on Thursday February 08, 2024 @06:11PM (#39309077)
> especially if it doesn't have the same behavior as unix sudo... imagine the confusion of unsuspecting users searching how to use sudo in the future.

It's hard to imagine a company that size would name it so deliberately without realizing it would cause confusion in search engine results and such.

A good faith assumption would be they wanted to make Windows more familiar to users of both but it also means that Windows will get mentioned in more Linux results over time to disambiguate it.

Re:Sudo for Windows by timnetworks on Thursday February 08, 2024 @06:22PM (#39309195)
>It's hard to imagine a company that size would name it so deliberately without realizing it would cause confusion in search engine results and such.

same microsoft as where I'm from?

Re:Sudo for Windows by herbst on Friday February 09, 2024 @03:57AM (#39312871)
So it's just some black hat SEO to seem more relevant to Linux users?
Re:Sudo for Windows by blibble on Thursday February 08, 2024 @06:56PM (#39309487)
that's the standard microsoft way

embrace (copy sudo), extend (add incompatible options), extinguish

Re:Sudo for Windows by Anon1096 on Thursday February 08, 2024 @07:19PM (#39309695)
I can say with 100% certainty that Microsoft is not going to extinguish sudo
Re:Sudo for Windows by xattt on Friday February 09, 2024 @06:39AM (#39313811)
“Please watch this in-terminal ad while you enter your password”
Re:Sudo for Windows by cqqxo4zV46cp on Thursday February 08, 2024 @09:19PM (#39310670)
This really goes to show that no matter how legitimate a viewpoint (Microsoft is into EEE), there are always people looking to pretty unintelligently bandwagon.

Yes, we know. Internet Explorer, yada yada. Beyond the ridiculousness of the notion of sudo specifically being a target for MS, the notion that MS, or any company of its size, is THAT single-minded, is absurd.

Re:Sudo for Windows by jraph on Thursday February 08, 2024 @07:04PM (#39309563)
They've done it with curl: they made an alias to their own program not supporting the same feature set and it inevitably backfired [1]. sudo is a complex program with a lot of different options [2] and as people from MS said here, it's never going to be compatible because of how Windows works differently.

While I understand picking a familiar name, sudo is certainly not the only player, there's also doas. This shows people can adapt to another name and another name would have seemed more appropriate.

edit: whoops, it was already mentioned in this thread [3]

[1] https://daniel.haxx.se/blog/2016/08/19/removing-the-powershe...

[2] https://linux.die.net/man/8/sudo

[3] https://news.ycombinator.com/item?id=39305452#39309126

Re:Sudo for Windows by JoshTriplett on Thursday February 08, 2024 @08:44PM (#39310423)
> sudo is certainly not the only player, there's also doas. This shows people can adapt to another name

The fact that doas has far fewer users, and examples everywhere show `sudo xyz` as the way to run xyz as root, shows that people do not adapt to a different name.

Microsoft has been trying, for years, to get developers to use Windows systems. This is another good step towards doing so.

The answer isn't to use a different name; the answer is to actually support most of the sudo interface.

But that said, there's a subset of the sudo interface that would cover the majority of what most people need on a regular basis:

-H (change home directory)

-i (act like a login shell, which may not be meaningful on Windows but could at least be ignored for compatibility)

-E (preserve the environment)

-u (set the user to something other than root)

-g (set the group)

-s (just run a shell)

Re:Sudo for Windows by snvzz on Thursday February 08, 2024 @09:33PM (#39310744)
>The answer isn't to use a different name; the answer is to actually support most of the sudo interface.

The answer is to do either.

i.e. the complaint about using the name while offering a different, incompatible interface is valid.

Re:Sudo for Windows by JoshTriplett on Thursday February 08, 2024 @09:57PM (#39310861)
Yes, I agree.

I do think it was correct to use the name, though, which means they should be more compatible.

Re:Sudo for Windows by divbzero on Friday February 09, 2024 @04:52AM (#39313228)
Using sudo for a Windows program doesn’t seem as bad as using curl as an alias for Invoke-WebRequest. While the real curl can be installed and fully functional on Windows, sudo is intuitively an OS-level program that deals with OS-level access control.
Re:Sudo for Windows by wvenable on Thursday February 08, 2024 @07:26PM (#39309753)
Windows and Linux already share dozens of commandline commands with the same name and have different behaviors.
Re:Sudo for Windows by jraph on Thursday February 08, 2024 @07:29PM (#39309780)
This doesn't mean this isn't an issue, and that the issue should be worsened.

Of course, it being an issue is an opinion (of mine), see my daniel.haxx.se link from my other comment next to yours for a motivation of this opinion.

Re:Sudo for Windows by wvenable on Thursday February 08, 2024 @07:49PM (#39309952)
The situation with curl is different because these are unix utilities you can run on Windows (hence the issue).

Now "sudo" is not a very Windows-y name for this utility but it has the advantage of being self-descriptive by those most likely to use it. It's sudo... for Windows. You don't have to explain it further.

The command line namespace is flat and there are only so many letter combinations, the idea that an OS shouldn't reuse a command name from a different OS is pretty limiting.

Re:Sudo for Windows by jraph on Thursday February 08, 2024 @08:01PM (#39310063)
> The situation with curl is different because these are unix utilities you can run on Windows (hence the issue).

Good point, the unlikeliness to ever run the real sudo on Windows makes it less an issue. Though doesn't remove it completely. You could for instance imagine a bash script (which you can run on Windows, since you can install Bash there) trying to use sudo if present, or something else, and fail because sudo is present but doesn't have the expected features. In shell land, the name of a command is almost an implicit contract.

> The command line namespace is flat and there are only so many letter combinations, the idea that an OS shouldn't reuse a command name from a different OS is pretty limiting.

In practice:

- Programs are mostly cross platform so many "commands" can work on different OS. Which makes the command line namespace quite shared between OSes

- I've not seen many clashes. I can certainly remember of one: the Chromium browser and the Chromium B.S.U game. It was unintentional. The "sudo" one is. You can certainly avoid it.

Re:Sudo for Windows by al_borland on Friday February 09, 2024 @12:38AM (#39311753)
Either way it’s done it’s an issue. Use a new name and it becomes a training problem, even for the most basic usage. Make it the same name and people expecting certain behaviors might get something slightly different.

At a basic level, I’d wager a vast majority of sudo’s usage is very basic, “run this command as admin”. If it can do that out of the box, it solves for a vast majority of users and they don’t have to learn some kind of new cmdlet to be able to do it.

Re:Sudo for Windows by jraph on Friday February 09, 2024 @01:45AM (#39312118)
This can't fully address the concern I raised. Their curl alias addressed the most basic / common usage and it caused issues.

I also can't imagine a different name to cause such a training issue. We are speaking about people who learned using the terminal on Unix and are using it on Windows. They are likely at ease with computers. If they are confused by a name change, I can't imagine how confused they could be at the first difference they encounter. The same name might as well cause more training issues. I'm not convinced.

Re:Sudo for Windows by magicalhippo on Friday February 09, 2024 @04:31AM (#39313094)
Not like it's unique to Windows. Linux and say FreeBSD are similar in this regard as well, lots of commands with same name but different behavior.
Re:Sudo for Windows by t0ps0il on Thursday February 08, 2024 @08:01PM (#39310056)
> imagine the confusion of unsuspecting users searching how to use sudo in the future.

Linux users can experience this now by using sed on macOS

Re:Sudo for Windows by cqqxo4zV46cp on Thursday February 08, 2024 @09:15PM (#39310639)
People can experience confusion on any operating system by using sed :)
Re:Sudo for Windows by bluish29 on Friday February 09, 2024 @04:47AM (#39313191)
To be fair, you will probably be confused by using sed in general
Re:Sudo for Windows by rjmunro on Friday February 09, 2024 @11:15AM (#39316309)
Or by using a bash builtin that duplicates a normal command.
Re:Sudo for Windows by CrendKing on Thursday February 08, 2024 @09:16PM (#39310646)
I disagree. Although this "Sudo for Windows" is not a one-to-one port from Linux, it does the same function which is to elevate a unprivileged command. Imagine if they announce "Introducing Dosu for Windows", you won't know what the hell that is without reading at least the first paragraph.
Re:Sudo for Windows by soraminazuki on Friday February 09, 2024 @02:09AM (#39312239)
In addition to not being a one-to-one port, Sudo for Windows is a completely unrelated command.

> it does the same function which is to elevate a unprivileged command

That's only one of the use cases of Sudo. Here's a description of Sudo from the official manual [1]:

> sudo, sudoedit — execute a command as another user

Sudo for Windows can't do that. It's mentioned in its FAQ:

> the sudo command on Windows does not support running programs as other users

Sudo for Windows is like a cat command that can't concatenate files or a touch command that doesn't update timestamps.

[1]: https://www.sudo.ws/docs/man/1.8.18/sudo.man/

[2]: https://learn.microsoft.com/en-us/windows/sudo/

Re:Sudo for Windows by Joker_vD on Friday February 09, 2024 @06:14AM (#39313674)
> like a cat command that can't concatenate files

Oh, that's a good counter-example to your own point: 99% of people who use cat don't care about this functionality.

Re:Sudo for Windows by soraminazuki on Friday February 09, 2024 @07:37AM (#39314155)
That's an astonishing claim to make without evidence.

    cat *.txt
is a pattern I see being used everywhere.

Same goes for sudo. If you're going to claim that a whopping 99% of users don't use the CLI options or /etc/sudoers, you'd need solid proof. Because a simple search shows otherwise:

https://grep.app/search?q=sudo%20-&regexp=true

This Sudo for Windows behaves nothing like the actual sudo. It doesn't even achieve the original's stated purpose.

Also considering that search results for anything involving Windows tends to be riddled with spams and outright scams, this will negatively affect non-Windows users searching for sudo as well.

So again, this naming conflict is unfortunate.

Re:Sudo for Windows by Joker_vD on Friday February 09, 2024 @08:14AM (#39314501)
> "cat *.txt" is a pattern I see being used everywhere.

That's an astonishing claim to make without evidence. I don't see "cat *" being used anywhere. In fact, I've just ran search for usage of "cat" over the repository of shell scripts that are used for the various packaging and deployment tasks in my company (and we have to deploy a lot of stuff, written in different programming languages, and every team packages their stuff into their docker containers in their own way but it's all still documented in this repo) and every single use of cat is either

a) reading data into a variable "VAR=$(cat file_with_data)";

b) writing inline data from script into a file "cat >>$TARGET_FILE <<EOF ... EOF";

c) an entirely reasonable use of cat "cat file | utility_that_accepts_filenames_too", sometimes even "cat file | utility".

None of them take a pattern or more than one file.

Re:Sudo for Windows by soraminazuki on Friday February 09, 2024 @09:41AM (#39315262)
The onus isn't on me to disprove that 99% of cat users don't care about concatenation, but here's a non-comprehensive list of projects using cat to concatenate files:

OpenSSL, Curl, Git, Linux, Gettext, NodeJS, zstd, GCC, FFmpeg, OpenJDK, Pyenv

I think users, upstream developers, and downstream packagers of these software will all be upset if cat ceased to concatenate.

Example:

https://sourcegraph.com/search?q=context:global+repo:%5Egith...

Re:Sudo for Windows by Joker_vD on Friday February 09, 2024 @10:06AM (#39315502)
Half of those examples from git don't even invoke cat, another quarter don't concatenate files, and the final quarter use it for preparing test data. Well, I guess the last is a valid use although again, most of those uses could've used printf "$chunk_of_data" >>output instead of writing temporary files all over the temp directory, and I imagine the "git am" test could've been written as "git am patch1 patch2" instead. shrugs I guess it's 80% then.

UPD: And lots of people use "cat file1 >>output; cat file2 >>output" for concatenation anyhow [0]. Apparently shell already can concatenate things well enough, so cat should do one thing and do it we;l: dump a single file contents to stdout /s.

[0] https://grep.app/search?q=cat%20.%2A%3E%3E&regexp=true

Re:Sudo for Windows by soraminazuki on Friday February 09, 2024 @12:19PM (#39317428)
> Half of those examples from git don't even invoke cat

That's because it's a regex search and not relevant to the point at all. What matters is that people use widely advertised features of a popular tool, including sudo and cat. Especially if that feature is the single stated purpose of the tool.

Taking a name of a widely used tool and slapping it on something that doesn't even do what the original was made for isn't a nice thing to do. I don't get why that's controversial to anyone.

> so cat should do one thing

That one thing is con-"cat"-enating files, so to speak. Why should it become something different just to make the name Sudo for Windows appear somehow less misleading?

Also,

    rm out.txt
    for f in *.log; do cat "$f" >> out.txt; done
is a clunky way of concatenating files.

    { for f in *.log; do cat "$f"; done; } | less

Even clunkier.
Re:Sudo for Windows by soraminazuki on Friday February 09, 2024 @04:28PM (#39320748)
> "git am" test could've been written as "git am patch1 patch2" instead

This is off topic, but the Git devs were correct in doing `cat pine patch1 | git am`, since the test in question is

    test_expect_success 'am takes patches from a Pine mailbox'
The test requires the mailbox not be split in two, so `git am pine patch1` is out of the question. patch1 is reused across multiple tests, so it makes sense for it to be in separate files. Concatenating is the logical conclusion.

    cat patch1 >> pine
    git am pine
is possible, but why? It's more code and it mutates the contents of files after initial creation, making the tests as a whole slightly harder to reason about.
Re:Sudo for Windows by cchance on Friday February 09, 2024 @10:21PM (#39323258)
lol i didnt even know cat did that lol!
Re:Sudo for Windows by ninjin on Thursday February 08, 2024 @11:06PM (#39311266)
You are not the only one thinking so. There is already a thread on OpenBSD's tech@ taking swipes at the obvious naming collision:

https://marc.info/?l=openbsd-tech&m=170742832804260&w=2

Re:Sudo for Windows by ape4 on Friday February 09, 2024 @08:32AM (#39314667)
perhaps `admininator`
Re:Sudo for Windows by michaelcampbell on Friday February 09, 2024 @09:54AM (#39315379)
I just hope it's not in the PowerShell zeitgeist of `--Super_Long_Option_Names_that_Use_a_Mix_Of_Caps_And_things`
Re:Sudo for Windows by jodrellblank on Friday February 09, 2024 @09:53PM (#39323109)
PowerShell options are all single dash, tab completable, case insensitive, will match on the shortest unique prefix, and can be aliased with shorter ones like `-EA` is `-ErrorAction, and are consistent because the shell parses them not the cmdlet.
Re:Sudo for Windows by cchance on Friday February 09, 2024 @10:19PM (#39323250)
I always laugh when people from the unix side try to shit on powershell when powershells pretty fucking amazing and has a solid UX for just how many things ... work
Re:Sudo for Windows by michaelcampbell on Saturday February 10, 2024 @12:45PM (#39328362)
Given what it replaces, sure.