Hacker News new | ask | show | jobs
by jojobas 338 days ago
Every time someone ships successful code that's hard to port to Windows the world becomes a better place.
2 comments

> Every time someone ships successful code that's hard to port to Windows

Until your boss tells you to port your so-far Linux-only code to Windows, and you run that struggle.

Signed, someone who spent the past year or so porting Linux code to Windows and macOS because the business direction changed and the company saw what was the money-maker.

P.S. Not the parent commenter, because I just realised they, too, had a paragraph beginning with 'signed, ...'

just curious, what would be the business direction to "Linux-only code"? Don't need any trade secrets, just quick expression on the area/target auditory.

I.e. - I have tried WSLg (running GUI apps in WSL) but disabled it all together, as after running xclock and couple of things like that to ensure it works, I couldn't find any interest in running GUI apps on Linux.

I can somewhat imagine need for work purposes, if you are falling into some webdev area and need to run some tests against local browser, but that's different from my POV.

> what would be the business direction to "Linux-only code"

Deep interaction with Linux filesystem and kernel behaviour; we've done some intercepting and trampolining Linux syscalls in run-time, and tying it all up to cloud storage APIs.

We had to fundamentally re-architect some of our code to support macOS and Windows.

Looks like you're complaining about too much job security. Also it's you choice to accept that task and make the world a slightly worse place again.
Can you setup Windows to install WSL if it isn't there yet and then set it up, in a Windows installer?
We actually tried that at first.

The technical requirement of installing WSL before installing our software was already a non-starter, since most Windows users expect one installer or zip to do-it-all. WSL2 isn't (yet) like a C/C++/DirectX redistributable which can be plugged in as a dependency to a given program. Additionally our program is expected to work natively with Windows paradigms.

More critically, we work with high-performance filesystems. The performance impact of files going a round-trip through the Linux Plan9 driver, then through a Linux kernel context switch, into the kernel, and down into Hyper-V, and then up back through the Windows Plan9 driver was completely unacceptable. It was deemed worthwhile to rewrite targeting Windows natively. And even then it was only a partial rewrite: we ended up using MinGW because we had too much of a direct dependency on the pthread API.

Forcing Windows users to use WSL is generally a non-starter. That’s just not how things work. You can force someone to change their entire execution environment without further consequences.

If you only support WSL then you don’t support Windows, imho.

I see were you are coming from, but programs also depend on an SQL server, a python installation or a Java instance. You also don't complain about device drivers, support for filesystems, the network stack and hooks to Windows Explorer.

In the end it is just part of the OS and a bunch of extra userspace programs. I mean nobody complains about the Windows Subsystem for Win32.

But yeah, you can just use a non-MS GNU/Windows implementation instead, do you like that better?

Is it possible though? Is it possible to have isolated WSLs (per programm)?

> Is it possible though? Is it possible to have isolated WSLs (per programm)?

Maybe. But my experience is that there is very little “program code” and it’s mostly “library code”.

And if you did have a program that required WSL and you followed the UNIX model of bash chaining programs then you’re now mandating the “meta program” be run under WSL.

I treat WSL as a hacky workaround for dealing with bad citizens. It’s not a desirable target environment. It exists as a gap stop until someone does it right. YMMV.

> But my experience is that there is very little “program code” and it’s mostly “library code”.

Sorry I am confused, what does that refer to?

> you’re now mandating the “meta program” be run under WSL

As long as bash and the tools are in path, can't you run any program normally?

> WSL as a hacky workaround for dealing with bad citizens

Yes, but some parts are out of scope for C and you need to target the OS. Also f.e. passing around file descriptors and sockets are convenient.

wsl also has the issue that when windows decides to auto update and there is a wsl update while there is a wsl instance running, it will just kill it right there and then to carry on with the update.

This has bitten me once when I was doing a distro upgrade and windows just killed the WSL vm midway.

Even if I now MS Windows can be annoying (why I don't use it), I'm completely out-of-touch with the hoops MS Windows user have to jump to have a usable computer. This is kind-of also a disadvantage, because you can't anticipate bugs that you can't imagine.
Attitudes like this are the absolute worst. Fellow HN readers, don’t be like this person.
I'm not sure what to think. What argument do you have for your position?
Windows and *nix are different platforms. Writing crossplatform code is pretty easy and a solved problem. At least 99.5% of code can be platform agnostic. Only a few tiny bits are special.

My background is video games. Which is well known to be a Windows-first environment. I currently work on robotics. The vast majority of robotics ecosystem code is Unix only.

You know what is extremely useful for teleoperation? Virtual reality. You know what platform doesn’t have a way to do VR currently? Linux. Womp womp sad trombone. Mistakes were made.

It’s really easy and not hard to write crossplatform code. My experience is that Linux devs are by far the most resistant to this. It’s very annoying.

Should you care about Windows? I certainly think so. Linux still doesn’t have a good debugger (no, gdb/lldb) aren’t good. Quite frankly every Linux dev would be more productive if they supported Windows where debuggers exist and are decent. So really they’re just shooting themselves in the foot. IMHO.

There are probably international traders who can tell a similar story with Linux replaced with "the US" and Windows replaced with "Russia", but I wouldn't consider that similar story to be an argument for ending the sanctions on Russia.

However, there is an important difference between the sanctions on Russia and the strategy of the pro-Linux "activist" that started this thread: namely, Windows is so heavily entrenched in the niche of enterprise IT that there is no significant chance of Linux's replacing it in that niche with the result that there is no realistic chance of a positive effect of this activism that might cancel out the negative effect you describe. So, I am tentatively in agreement with you.

When I'm writing software, I'm writing it for me, not anyone else. I use linux. If I decide to release anything I wrote, I am under no obligation, nor am I "ethically compelled" to make it cross platform. I wrote it for me. Use it or not.
You're complicit with Windows living on, being long overdue in the landfill of computing history.
Disrespectfully disagree.