Live data from Hacker News

Man who thought opening a TXT file is fine thought wrong

paulosyibelo.com

221–230 of 316 posts

Re: Man who thought opening a TXT file is fine thought wrong

#221
post #203

Earlier quoted context omitted.

> ...but the fact that file:// schemes can access remote files by appending /net/ followed by a domain name is pretty shocking. Not that shocking. Windows has had that with SMB networking for ages file://SMBSERVERNAME/path/file . Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly.

> Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly. Do note that this has been disabled in the major distributions at compile time for pretty much ever. The debian bug to build bash with that feature by default is ~20 years old (and was closed as wontdo).

On two different Debian 10 boxes bash seems to have it enabled:

  Terminal 1
  $ echo hi > /dev/tcp/127.0.0.1/9999

  Terminal 2
  $ nc -vvvlp 9999
  Listening on [0.0.0.0] (family 2, port 9999)
  Connection from 127.0.0.1 57540 received!
  hi
  $

Re: Man who thought opening a TXT file is fine thought wrong

#222

Meta comment: The custom scroll behaviour on that site is awful. I hate sites that try to "improve" the behaviour of scrolling by making it faster/slower than normal.

Imagine if a site made the user downpress on a link for a longer time before the click would register?

It's actually insane.

Re: Man who thought opening a TXT file is fine thought wrong

#223
post #214

> I found another browser trick that lets force-downloaded TXT files to be opened without user interaction or warning I wish there was more elaboration on this. Opening a downloaded file without user interaction sounds pretty bad.

That is Safari's default behaviour for ZIP files. Only to extract them, though.

Re: Man who thought opening a TXT file is fine thought wrong

#225
post #203

Earlier quoted context omitted.

> ...but the fact that file:// schemes can access remote files by appending /net/ followed by a domain name is pretty shocking. Not that shocking. Windows has had that with SMB networking for ages file://SMBSERVERNAME/path/file . Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly.

> Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly. Do note that this has been disabled in the major distributions at compile time for pretty much ever. The debian bug to build bash with that feature by default is ~20 years old (and was closed as wontdo).

Although it was disabled in Debian bash 2.04-5 on 2000-06-05, it was re-enabled in bash 4.0-5 on 2009-09-13 and is currently enabled. See https://metadata.ftp-master.debian.org/changelogs/main/b/bas...

Re: Man who thought opening a TXT file is fine thought wrong

#226
post #211

Earlier quoted context omitted.

It seems like the only real issue here is that a file:// URL can make a network request. Who could ever think that that would be a good idea?

No, the fact that .TXT files got interpreted as HTML is worse.

Rigidly interpreting documents depending on their file extension is worse than trying to figure out the type of a document before interpreting it. File extensions are a brittle and primitive system that does not fix any security issue.

Re: Man who thought opening a TXT file is fine thought wrong

#227
post #120

Earlier quoted context omitted.

Well, on Unix file extensions are a convention and don't have any strict semantic meaning. Maybe this doesn't make sense in a world where most people do think in terms of file extensions (thanks to the popularity of Windows) but it shouldn't be surprising that non-Windows programs might not special-case file extensions. (Though in fairness, text editors do usually have special casing for file extensions and these day…

This is only a Unix vs Windows thing in terms of the application launcher and how it is implemented. File extensions are semantically meaningful for many unix tools, most notably gcc.

Also meaningless for vastly more UNIX tools. Also, Gnu’s not UNIX.

Re: Man who thought opening a TXT file is fine thought wrong

#229

Two words: excessive complexity. It's always seemed strange that an application called TextEdit is actually more than a text editor. I strongly believe that content-type autodetection, much less HTML rendering(!), most certainly does not belong in a text editor.

I think this captures my sentiment on the matter as well. Applications today want to be a swiss army knife and do just about every job.. and do it poorly. I do expect that level of complexity from RStudio, but probably not from Notepad. I would probably kinda accept it in Notepad++. So real question. Is TextEdit a default text editor in a mac?

TextEdit is closer to WordPad than Notepad in terms of functionality. It supports rich text edition, and is more than a plain text editor.

Re: Man who thought opening a TXT file is fine thought wrong

#230
post #214

> I found another browser trick that lets force-downloaded TXT files to be opened without user interaction or warning I wish there was more elaboration on this. Opening a downloaded file without user interaction sounds pretty bad.

That is Safari's default behaviour for ZIP files. Only to extract them, though.

Still a terrible idea, though.
Post reply on HN