Live data from Hacker News

Don't touch my clipboard

alexanderell.is

271–280 of 322 posts

Re: Don't touch my clipboard

#271

Earlier quoted context omitted.

It could be an option that is revealed after a warning. "This page wants to use the javascript 'copy' event to place transformed data on the clipboard. If you accept it would place [data shown] on the clipboard, otherwise it would place [raw text] on the clipboard". What do you want to do? copy text? copy data? [ ]remember my choice for this site. Here, data shown would probably be some info about the data rather tha…

How would you institute that in the clipboard logic and independently of the app? Because we're no longer operating in a world in which apps or processes are trusted or trustable. Maybe the ones you write, maybe if you're really lucky the ones that come with your fully-vetted Linux distro. But not npm installs, not proprietary binaries, not website logic, and most especially not the crap that's distributed on mobile…

The clipboard can’t tell whether the content is “right” nor can the copying be done by the OS/clipboard itself.

In general the application is the only thing that knows what is selected (e.g objects in a cad program) and the OS has no idea of how to serialize these into the clipboard.

Even a text editor has to tell the OS what is selected and the OS can only trust the app to tell the truth.

The only way to “verify it” is to show the copied content to the user (e.g in a notification after the copy). Obviously for anything but plaintext this verification doesn’t help (I can’t tell serialized cad objects from something else - it’s just gibberish). I can however verify that it’s not a script that will erase all my files when pasted into a shell (btw executing on paste is s a horrible behavior by a shell. Pasted data must be treated as untrusted and verified before acted on. Immediate shell execution breaks that).

Re: Don't touch my clipboard

#272
post #175

Earlier quoted context omitted.

PowerShell acknowledged smart quotes and dashes in its language design and allows proper quotes interchangeably with ASCII straight quotes. I always found that an interesting design choice, although I'm not sure how useful it actually is to allow people to copy/paste code from dubious web pages. On the other hand, they'll do that anyway, so why bother making it harder?

This is going down a rabbit hole. “This” is an English quote, whereas „this“ is a German quote; note that the open quote character in the English quote is equal to the close quote character in the German quote. Then there is a less-often used style of quoting, similar to the French style, but: «this» is the French quote, whereas »this« is the German version. Yes, the open and close quotes are swapped. I applaud the i…

Additionally note that «this» is mostly used in French online and in Switzerland, while « this » is more common in professionally typeset works in France. Those are U+202F NARROW NO-BREAK SPACEs between the guillemets.

Re: Don't touch my clipboard

#273

Earlier quoted context omitted.

Maybe run `sudo chmod -R 000 /` instead. Can't get charged with destroying any data, but it's a huge pain to get a system working again from that. Only done it twice; hope never to do so again.

Curious to know how you recover from that? How do you what permissions to assign back to files and directories?

Depending on how you define "fix," the common way (if the machine has already been rebooted and you're locked out of the session) is to boot via a live distro, mount the filesystem, and change permissions to get a usable system back. There are various other methods depending on the machine state and requirements, too, so it's definitely recoverable from a working machine standpoint. Changing permissions back to what they used to be is a rabbit hole that varies depending on your distro, machine-specific requirements, and any special permissions setup by you and your admins.

Re: Don't touch my clipboard

#274
post #203

Earlier quoted context omitted.

The problem, such as it is, is with languages. Terminals (mine at least) handle most of Unicode just fine; admittedly I've seen it choke on emoji, but punctuation, nah. The vast majority of programming languages are defined in terms of ASCII and only ASCII. I don't care for this, personally. I've given some thought to how to do quoting right in a programming language, and implemented «guillemets» as an experiment. Bu…

Having multiple almost identical ways of achieving things is a bug magnet in programming languages. Differing programmers will presumably use different styles (why else even support differences?), and if you mix code like that, bugs ensue. This a hassle not just because autoformatters are liable to make churny changes (which distract from real changes, which makes history harder to understand: bug magnet), but also b…

Many programming languages, certainly not all, offer single and double-quoted strings already. Which is, granted, a perennial source of annoyance for those of us trying to have a consistent formatting style.

I want «guillemet strings» because they use a matched pair, so you can «quote a string «within a string» without escaping» and I think that's a nice property.

I'm not really interested in supporting all the forms in which they're used in European languages, though, that would be a real hassle. Just the one that looks like the other matched pairs we use in programming.

“smart quotes” have ‟at least two styles” and really „three styles”, and the first two are really easy to confuse with "normal double-quotes". I don't want my users to have to deal with "why doesn't this compile”?, and if I allowed it to compile, now you have to escape all the quote characters inside any string, which is messy.

Raku, as a sibling points out, has bitten down on this bullet, and I respect that. I keep meaning to give it a spin, I'm fond of Parsing Expression Grammars and have good feelings about Perl from the early days.

Re: Don't touch my clipboard

#275

Seriously... I want to know the business/legal logic behind adding copyright messages to the clipboard when copying. This has happened for a long time with news sites, Apple Books, etc. No user ever has ever wanted that. So what lawyers, where, ever demanded it, and why? Short snippets fall under fair use anyways ... and even if it didn't such a message doesn't prevent anything (you just delete it after pasting)... a…

It wasn't about copyright or fair use, at least not directly. The intended purpose of this sort of code was to:

1. Make sure many people who shared content from your site would link back to the source

2. Track shares where the full link to the page wasn't copied

3. Trick scrapers/careless plagiarists into linking back to the original source, using their own carelessness to get an extra backlink or two (and tell Google your site was the original).

All of these obviously only worked on people that didn't check what they were copying, but hey, those were some of the reasons behind it.

Re: Don't touch my clipboard

#276
post #105

Earlier quoted context omitted.

Unlikely - see my comment elsewhere in this post.

So yes, I see in your comment that given the context of 'Apple Books' it's probably a contractual issue, I agree there. Though I can see that a reasonable legal opinion might not support my more cynical view, when the risk dynamics are high, a different kind of logic creeps in. I worked for a software platform that refused to provide usable snippets of code anywhere in the documentation for fear of liability. We also…

> Our 'perpetual legal action' was merely cover give the appearance that our brand was being defended, without which action, we could feasibly lose rights to it.

Was that really easier than just licensing your trademark with a strong contract that preserved your rights while letting the website use your name for one specific purpose? Make the licensing costs $1 per decade or something if it is a question of money.

Misusing the legal system in this way seems like it could backfire if the third party did something you genuinely wanted to stop and they could prove your ongoing action was a sham.

Re: Don't touch my clipboard

#277
post #43

Earlier quoted context omitted.

> I can't think of a single time when I want a site to react to my attempt to copy text off if it. Any time you're not interacting with HTML text is a time it could be useful.

In that case there should be no actual text selected. The problem only occurs when there is text visibly selected and you press your copy shortcut. In those cases the only correct behavior is to copy the selected text.

[deleted]

Re: Don't touch my clipboard

#278

Earlier quoted context omitted.

about:config -> dom.event.clipboardevents.enabled = false You can't do it through a user agent, though

Be aware that some websites will completely break when pasting when this is disabled (e.g. Twitter, Facebook, probably more).

Pasting is completely broken on Facebook for me anyway, if I paste at the start of a line it deletes the whole comment box. Originally I thought it was related to this config setting but toggling it made no difference.

So many lost rants ... ;o)

Re: Don't touch my clipboard

#279

Seriously... I want to know the business/legal logic behind adding copyright messages to the clipboard when copying. This has happened for a long time with news sites, Apple Books, etc. No user ever has ever wanted that. So what lawyers, where, ever demanded it, and why? Short snippets fall under fair use anyways ... and even if it didn't such a message doesn't prevent anything (you just delete it after pasting)... a…

It's just advertising surely, like Apple's insistence on "sent from my iPhone" type footers, annoyance is the point.

Re: Don't touch my clipboard

#280

Earlier quoted context omitted.

Maybe run `sudo chmod -R 000 /` instead. Can't get charged with destroying any data, but it's a huge pain to get a system working again from that. Only done it twice; hope never to do so again.

Curious to know how you recover from that? How do you what permissions to assign back to files and directories?

It's a pain-and-a-half. I'm not sure any system ever recovers fully, but you basically run chmod -R's on most of the important directories and then fix the many services that will surely fail once you can get a shell.

More specifically, I used a bunch of these links until I could get a shell, then manually-fixed the rest.

https://askubuntu.com/questions/308939/how-to-reset-default-...

https://askubuntu.com/questions/508359/restore-default-syste...

Post reply on HN