OT: Why it is better to pretend you know nothing about computers

Sep 17, 2010 234 Replies

Under linux, the only time (in common use) the filename is relevant is when it is opened or stat()-ed.

The open() call returns a file descriptor, so the file may be renamed (within the same filesystem aka "drive") or even deleted. The application will not mind.

However, if the application uses the paradigm: open-read-close then open-write-close it will save to the old filename regardless of what has happened to the previous copy.

Neither scenario will prevent a file being replaced - even a system library - though the correct method is always:

unlink()-open()-write()-close()

A deleted file will still exist on disk until the last open file descriptor to it is closed. A very simple and elegant solution.

But this is generally wrong

open()-trunc()-write()-close() which will confuse applications that have the file open.

Cheers

Tim

Doesn't NFS use open() seek() write() close() for every write?

That will be fun if you rename the file.

Windows notepad and wordpad just make a new file with the old name if you rename it while open. Word locks the file and you can't delete or rename it, or open it for writing just as it should do. There is no reason to allow the file to be deleted or renamed while locked. Linux is different as the apps don't generally use file system level locks to get exclusive access (do the common file systems even have file locking?).

I think that's an Apple-specific thing. It must provide some sort of signal/event for programs to detect filename changes.

You can't just tell programmers to sod off or they will, and then who's going to write the software (see RISC OS again)? Besides, what users think they want or don't want is wrong, they don't know about computers ;-).

For some years x86 CPUs have basically been x86 bytecode machines running on top of whatever it takes to run it fast and there isn't really any RISC/CISC divide. I don't know much about PowerPC, but I think ARM is still pretty much a pure RISC. ARM assembly code is also fairly easy to write and optimise (although different variants require different optimisations to some extent), unlike what is said about most RISCs.

I think (long time since I looked) that NFS clients get a unique identifier for the file when it is 'looked up' (effectively, opened). The file could move, and that identifier wouldn't change. Each read or write has to give that identifier, so it ought to work.

Many NFS servers use a disk address or a combination of inode number and disk number to derive that identifier. If the file was moved to another file system, that might fail, of course.

As one who'd been programming since 1965 (professionally since 1968) I can tell you that many programmers need smacking. Their managers need smacking even harder (then perhaps they'd manage).

Is that really such a problem in practice 'tho?...

In article , Tim Streater scribeth thus

As in reply to Steve, is this really that much of a problem for most users?.

Are you I presume, opening a file, then re naming that and then attempting to open that file in another application whilst the original is open and asking your other app to find that in a moved location?...

Yes, for a start that's a significant reason [1] for having to reboot when applying updates etc.

[1] Another reason seems to be because the programmers can't be bothered to check whether it's really necessary and leave the "Restart required" code enabled. Like when you plug in a new mouse or keyboard (or even the same one into a different USB socket, which is due to a separate example of Windows' idiocy) and get told to reboot even though it's working fine, or you've just installed a sound driver and you can hear that it's working before you reboot.

I'm not worried about the moving part myself. But theer have been plenty of times when I've opened a file in Word (say), then wanted to email a copy of the same file to someone after saving it, but not quitting Word or explicitly closing it.

I beg to differ ... the only Windows releases I have used -- and I think I've used them all apart from Windows 1.0, WinME and some of the server versions -- that have been significant advances over their predecessors without corresponding problems were Windows 3.x (I'll lump

3.0 and 3.1 together, which may not be quite fair) and Windows 2000. Maybe I should allow NT 3.5 as an improvement over NT 3.1, too.

Oh, and of course NT 3.1 was a huge leap forward compared with all other versions of Windows at the time ... but it was a completely new codebase and so didn't strictly speaking have a predecessor.

Win7 really isn't that different from Vista under the covers. The claims about 7 not exhibiting some of Vista's more inexplicable areas of inefficiency seem to be largely untrue, and there are aspects of the Win7 GUI that are irritatingly different from everything that went before (not least the lack of a "Classic" theme, and the confusing merging of the quickstart bar with the active applications on the taskbar). In reality, I'd say 7 and Vista were about equally bad.

Cheers, Daniel.

Yes, but some of them are too stupid to realise it. They just expect computers to be broken because theirs is.

He *may* be doing that, the point being that if the OS can't cope with it then the OS is broken.

Where does one start? I suppose with the fact that the default is still to run with administrative privileges and to happily install viruses, and every other form of malware. With the fact that the filesystem is still set up in the dumbest manner imaginable, that there is still no consistency between applications and in Windows 7 there's precious little display left to work in because of the screen hogging crap that forms much of the interface.

Yes, it shows that the OS was designed by idiots, and purchased by the same.

Only by default. It's easily selectable as one of the predefined themes.

It can be put back as it was.

No, they aren't the defaults, but they're both there if you want them.

I'm opening a file in (say) Word and then finding that I can neither rename the file nor move it, which is ludicrous.

Several ways to do that..

1: click save find the file in explorer send it.

2: use the send to email option in the word menu.

Yes, it happened to me most times I got an attachment, which were mostly docs I was working on. I used Windows for mail solely because win-eudora was better than mac-eudora. For all my other work I used a Mac. Which didn't and doesn't suffer from such 1970's style limitations.

You can do that from within Word.

Classic start menu doesn't exist ... there is a FOSS alternative though.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required