Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
Restart to find out.
"Couldn't reboot because these programs"
9 of them
"Restart anyway?"
Windows has that button, but only if you right-click the drive in file explorer and select "eject". The dialog is very similar, but has the option to continue anyways. That option doesn't appear when ejecting from the taskbar.
Which is weird, because it means that Microsoft went out of their way to make two different, almost identical dialogs. And they made the better one harder to reach.
Either that or they were added at different times by two different teams with two different design philosophies.
It's definitely that one
Not 99%. Windows has many usability issues. I'd vote for "dont steal focus and stick windows in front of where I'm typing" and "don't move things just as I go to click on them" for a start, and also "don't somehow take an hour to delete 50 files."
"Fun" fact: if you think it's slow normally (and to be fair, it is), NTFS seems to have a pathological performance regression when a directory contains more than 10,000 children, any operations on files in that directory slow down by around 95%.
I discovered this on our CCTV system at work (that runs on Windows Server 2022), which creates an inordinate number of small files (each containing at most a few seconds of video). It was causing some of its periodic maintenance tasks to fail, as they'd take longer to run than than the configured interval between them.
Windows also really doesn't like dealing with half-petabyte filesystems, just like... at all.
I can also tell you that if you are working with file numbers in the 10,000, windows will notoriously interfere with their built-in services. When copying or moving, msdefender might delay every file copy because it marks the action as suspicious and begins scanning the files beforehand. And also the trkwrks or however that drive observation service is called may block actions on specific files just because.
In short, you are not only fighting drive formats at that point, you are also fighting your built-in system services. Source: I wanna die.
Deleting files was an amazing one already. Then I recently discovered the joy of deleting 30k emails from Outlook... T-T
I literally cannot understand how Outlook is so awful and unpleasant to use. Constant pauses, regular freezes and a search that will show a document I sent to myself five years ago regardless of search terms but won't surface the perfect match I received yesterday, in the world's most prominent email client.
The only worse software I have to interact with on a daily basis is Adobe's PDF reader, which gives me five popups within one minute of opening it and takes over a minute to do a text search in a five page document.
I copied 400GB of assorted files in an RDP session today and Windows had to think for a minute or two, then copy them ever so slowly, then stop at 99% done, then crash Explorer and disable the start menu and taskbar and CTRL-ALT-DEL and all ways of getting to the Task Manager, and then freeze the whole machine so that I had to travel to the physical machine and hold down the power button, since when it has been unusably slow because Windows now wants to rebuild the RAID array, which takes days. This was a pretty average Windows session.
Shift-Del to delete files is usually much faster, though obviously this skips the recycle bin.
Windows:
Someone else potentially has this file open, would you like to open a read only copy?
Linux:
Someone else potentially has this file open and they may have a newer version than you, would you like to save anyways?
Such a small difference but enough to make Linux superior.
To be relevant to the post:
Windows
Someone is using the drive, you can't eject
Linux
$ umount /mnt
unmount failed: device in use
$ umount -f /mnt
$
The equivalent long option is --fuck-you
It's even more fun when you're trying to do something with a file on a network share. There have been so many times where a user goes "it's telling me i can't save this because Suzie is using it", i close Suzie's abandoned session, and the file is still magically in use by Suzie. Why? Because the dialogue is broken and the file is actually open on John's machine. I fucking hate windows.
My favorite is “Location Not Found”. It’s amazing that both Mac and Linux seem to do a better job on SMB than Windows.
just yank it
fuck whoever is using the drive
I used to do this, because it didn't seem to cause any issues — until it did, and I lost a lot of data.
People who say this I'll tell you what actually happens so you can know. When you tell it to safely eject all the volatile memory saved in RAM it actually writes to the permenant storage memory instead of holding it in volatile storage. Every time you yank you're betting that its not in volatile storage anymore and was written to storage. That's what safely eject does, forces the CPU to write to permenant storage.
Edit: the problem comes from whats doing what at what time and you will see why you can lose everything.
How is linux handle such situations, i'm new using it and haven't looked that up yet, well i didn't got in such a situation yet, but i only used a handful of time a external hard drive
Basically, if you, as a regular user, cannot unmount a device, you can usually just go to root shell (sudo -i), see where the thing is mounted (just use mount) and then unmount it (umount /media/blah/floop). If it says the device is still busy, as root you can remount it as read-only and then unmount it (seeking documentation left as an exericise to the reader, as I'm sitting at a Windows system now).
There's also lsof ("list open files") tool, which can be used to see which exact programs are using files on that device, which you can then use to kill those sneaky processes (ps, kill).
So a complicated set of terminal commands and alternatives you need to have memorized ahead of time. That's definitely the linux solution. You can do it, but no average user would ever be able to when they need it.
Windows probably has some equally complicated way of finding what is locking a file/folder... or you can just install File Locksmith which is a Microsoft PowerToys tool, and just have it in the context menu everywhere.
No average user would be able to look up what commands to run? Because newsflash: unlike Windows, searching for a common problem on Linux normally turns up a solution written by a human who knows what they're talking about.
"Windows doesn't even have basic package management like every Unix-like OS does so you don't have to individually update applications and go find them on the Internet, but this one edge case on Linux requires like two terminal commands (the sudo -i is totally superfluous if you just put sudo in front of commands) instead of installing an entire separate tool you'll ever use one time like on Windows and which an average user wouldn't even know exists. Therefore Linux is more complicated."
Incidentally, here's what Microsoft officially recommends for the "average user" regarding PowerToys:
It's insane how nose-blind Windows users are to how user-unfriendly their OS is.
It’s insane how nose-blind Windows users are to how user-unfriendly their OS is.
Oh the irony. You clearly don't work with any sort of end user.
For 99% of computer users, if the GUI doesn't have an option, it doesn't exist. They aren't searching past a basic Google of the issue showing them step by step instructions of how to use the GUI to fix the problem. If there is no way to do so in the GUI, it's not getting fixed by them, they'll take it to the Geek Squad if they even decide to fix it at all. They're must more likely to just ignore an issue. In this case, just removing the USB drive and complaining about something being corrupt later on. The idea of the terminal scares the average person.
Windows doesn’t even have basic package management like every Unix-like OS does Well that's simply wrong.
winget upgrade --allI just upgraded 44 apps I definitely didn't install via winget, they were all installed via individually downloaded installers at some point in the past, but all upgrade with a single package manager command in a terminal. Certainly seems similar to me. It may not be everything, but it's certainly the majority of things on this system other than the games.
For 99% of computer users, if the GUI doesn’t have an option, it doesn’t exist.
Literally 99% of Windows tech support is
Have you right clicked on Windows menu, selected
Terminal (Admin), then enteredsfc /scannowand thenDISM /Online /Cleanup-Image /CheckHealthandDISM /Online /Cleanup-Image /ScanHealthandDISM /Online /Cleanup-Image /RestoreHealth? ...ohhh shit you're still fucked up - well, maybe you need to completely reinstall windows, well, here's the page on how to do it.
That's the difference with Linux. Your average user never uses terminal, and when they do, they find the tools suck.
They aren’t searching past a basic Google of the issue showing them step by step instructions
Your users are searching for their problems???
Most wouldn't even do that.
If the button isn't right there to fix everything automatically, the problem just stays that way until they (maybe) restart
Alright, so others went over the "easy" way to see which program is being the offender. But I feel like the average Lemmy user just skips GUI at this point.
Say hello to KDE:
KDE also does automatic fsck before mounting, which is why it may take some 2 seconds to mount a drive.
HDDs it properly spins down and unpowers as well.
I don't think an average user is going to know how to interpret the output of mount or findmt
Real answer: it depends.
- Deleting a file in use: no problemo. File is removed from the directory immediately, but exists on disk until last program who had the file open closes. Everyone wins! (Unless you're trying to free up space by deleting a huge file that's being held open by a program and not understanding why the filesystem usage didn't go down)
- Unmounting a hard drive in use: Will error out similarly to Windows.
lsofcan tell you which process has which files open. There's nuance with lazy unmounts and whatnot but that should not be used in most cases.
Now in practice you should be wary of one very important thing that changes compared to Windows: Writes are asynchronous on Linux. First the kernel writes to RAM, then it flushes to disk at a later time for performance reasons (this is one of the reasons why writing a bunch of small files is many times faster on Linux than Windows). The upshot is that just because your file copy is "done" doesn't mean you can just yank the USB cable. Always safely unmount before unplugging a storage device on Linux.
Writes are asynchronous on Linux.
Unless I mount it with sync, which I wish would be default for non-system drives (which are going to be in fstab anyway). I didn't notice any difference, aside from the lack of guessing when the magic is over. 2GiB goes into black hole, now what?
Idk how Linux handles it but today on Mac I accidentally sent a folder to trash that was in use by four programs at once.
Mac OS did not give a shit. It nuked it.
Linux Mint has an eject button that allows any cached writes* to finish, prevents new ones from starting, and un-mounts it. It's actually important to use the eject button as flash drives are slow, and the write cache can obscure the fact that a file isn't done writing yet.
*Copying a file will add it into the write cache while it writes out to the disk. As soon as it is in the cache, you can use the file as if it was already done copying, including making changes.
Many files copied to an external disk are cached, and not written immediately unless you run the "sync" command.
So when you press the "eject" icon, on most frontends a notification will tell you not to unplug it right away, once the write is complete it will send a "it is safe to remove the drive" message. This can take a couple minutes if you are writing a big file to a slow drive.
By default Windows disables file caching on external USB drives. It should be writing those files directly. That doesn't prevent a program from locking a file or folder that it is using though.
Then you stick a usb key in and invariably get the "windroze has detected a problem with the drive, scan or format?"
Do nothing and the drive works perfectly well.
There is a dirty bit indicating the disk was not ejected properly. It stays there until you use the "scan and fix" action. It doesn't indicate corruption directly.
99% of the time the “other program” is a minimized file browser window open to the drive.
Force close Explorer.exe and you'll be able to eject
The USB drives are effectively perma-mounted and the eject command does not work, if even one instance of Explorer is open.
Antivirus, Windows Defender, Bitlocker...
Shall I continue?
Try OpenFilesViewer and Process Explorer, amongst a myriad of other SysInternals utilities..
Told ya, Process Explorer just told me nothing, except Dropbox maybe.
But it doesn't change the usage scenario. I don't care what programs are using the drive. I just need to tell them to fuck off, I need to unplug this drive at this moment.
It's an ongoing PITA. Windows should come with Process Explorer installed by default.
Windows should just tell you "The file is in use by <actual information here>" by default.
I would like there to be a law that mandates a „fuck off“ button in general. Not just „yes, please steal my data now“ or „maybe later“.
Honestly, i have the same on XFCE. But if i press the button to force eject, i get some dbus-black-magic-that-failed error and jank it out anyway.


