News for hackers. Stuff that matters.
Re:Git: Malicious repositories can execute remote code while... by sethammons on Tuesday March 09, 2021 @07:27PM (#26406317)
well played. I think that just got added to my standard vocabulary. Caching has caused more errors and bugs that I've had to deal with than I can recall. My favorite was an off by one error where we returned nicely cached info -- just for the previous user who came through our system! :facepalm: That was a bad one.
Re:Git: Malicious repositories can execute remote code while... by anyfoo on Tuesday March 09, 2021 @09:14PM (#26406978)
That's because essentially, "state" and "caching" are the same thing on some level.

And the problem with state is that you have to make sure all your state transitions don't cause bugs. What we know as a "cache" is essentially creating new state representing existing state, with all new transitions...

Re:Git: Malicious repositories can execute remote code while... by branko_d on Wednesday March 10, 2021 @03:47AM (#26409210)
I like to look at caching as a form of denormalization - introducing redundancy to improve performance. And whenever we have redundancy, we have to make sure all our copies are synchronized, which can be tricky, especially in a concurrent environment.

On the other hand, the whole point of normalization in databases is to avoid redundancy and have "single source of truth".

I find the concepts of normalization and denormalization applicable and helpful outside databases as well, though a different terminology is often used.

Re:Git: Malicious repositories can execute remote code while... by adolph on Wednesday March 10, 2021 @08:55AM (#26411210)
In that light, a cache is a form of partition, so it can be available xor consistent with its source.

https://en.wikipedia.org/wiki/CAP_theorem

Re:Git: Malicious repositories can execute remote code while... by bin_bash on Tuesday March 09, 2021 @09:32PM (#26407086)
Cache is a type of state but not necessarily the other way around
Re:Git: Malicious repositories can execute remote code while... by anyfoo on Tuesday March 09, 2021 @09:35PM (#26407100)
In the efficient implementation of a pure functional language (say Haskell without MVars), what really is the difference between state and cache?

I know this is overly philosophical, and in practical scenarios we readily (although not always unambiguously) differentiate between "cache" and "state", but the point about transitions and that being a major source of bugs still stands.

Re:Git: Malicious repositories can execute remote code while... by eru on Tuesday March 09, 2021 @11:08PM (#26407651)
> In the efficient implementation of a pure functional language (say Haskell without MVars), what really is the difference between state and cache?

If you want to unify state and cache, you might want to go down a different route:

Think of log based filesystems (or a log based data base).

Instead of defining your operations in terms of state, you define them as pure functions of the log.

So your log is full of operations. Writing just means appending a symbolic operation like `write(key, value)` to your log.

And you define the result of `read(key)`: scan backwards through the log until you hit the last instance of `write(x, value)` and the return that `value`.

Now state means: compact your log by replacing a swath of `write` log entries with one big `snapshot` operation that encompasses many key/value pairs.

Alternatively, you can also define state to mean caching your `read` operations.

In this approach, it's no coincidence that the log is a data structure that has a linear shape: the evolution of state over time is also linear.

(With some cleverness you can replace the linear structure with eg a DAG; and then also think about how you merge divergent states.)

Re:Git: Malicious repositories can execute remote code while... by saganus on Tuesday March 09, 2021 @07:42PM (#26406429)
Here goes the obligatory

> There are only two hard things in Computer Science...

Re:Git: Malicious repositories can execute remote code while... by jholman on Tuesday March 09, 2021 @08:49PM (#26406832)
I can never remember what they are, though. To avoid this problem, I think I wrote them down on a post-it, but I had too many post-its on my desk so I got rid of them all, and now I can't remember.
Re:Git: Malicious repositories can execute remote code while... by llarsson on Wednesday March 10, 2021 @01:04AM (#26408295)
The two most difficult ones are naming things, cache invalidation, and off-by-one errors. HTH. ;)
Re:Git: Malicious repositories can execute remote code while... by Xelbair on Wednesday March 10, 2021 @03:24AM (#26409073)
I prefer the ordered version.

three most difficult things in CS:

2) Naming Things

1) Cache Invalidation

4) off by one errors

3) Concurrency

Re:Git: Malicious repositories can execute remote code while... by csunbird on Wednesday March 10, 2021 @04:49AM (#26409576)
Another version, about distributed systems:

There are only two hard problems in distributed systems:

2. Exactly-once delivery

1. Guaranteed order of messages

2. Exactly-once delivery

Re:Git: Malicious repositories can execute remote code while... by Viliam1234 on Wednesday March 10, 2021 @06:19PM (#26417845)
two most difficult things in CS:

0) naming things

1) cache invalidation

42) asynchronous callbacks

2) off by one errors

Re:Git: Malicious repositories can execute remote code while... by zaphirplane on Wednesday March 10, 2021 @02:26AM (#26408761)
They are likely making a joke about caching the answer
Re:Git: Malicious repositories can execute remote code while... by samb1729 on Wednesday March 10, 2021 @01:28AM (#26408418)
What does HTH mean?
Re:Git: Malicious repositories can execute remote code while... by mattacular on Wednesday March 10, 2021 @07:44AM (#26410651)
"Hope this helps" (sometimes used sarcastically)
Re:Git: Malicious repositories can execute remote code while... by sgn on Wednesday March 10, 2021 @01:42AM (#26408506)
Hope That Help, HTH.
Re:Git: Malicious repositories can execute remote code while... by kzrdude on Wednesday March 10, 2021 @02:31AM (#26408786)
"Hope this helps"

I see it with HAND "have a nice day" too

Re:Git: Malicious repositories can execute remote code while... by _puk on Wednesday March 10, 2021 @03:12AM (#26408995)
I've always read it as "Happy To Help".

I see that's wrong, but ignorance has made the internet seem just that little bit warmer all these years!

Re:Git: Malicious repositories can execute remote code while... by gwd on Wednesday March 10, 2021 @05:33AM (#26409848)
I think it could probably mean "Happy to help" if said in response to a thanks of some sort. Saying it before someone has said thanks is a bit presumptuous. :-)
Re:Git: Malicious repositories can execute remote code while... by bryanrasmussen on Wednesday March 10, 2021 @04:32AM (#26409475)
this reminds me I was dumpster diving at a place with lots of post-it notes and there was one that said 2HCS => whatchamacallit, CI!

what that you?

on edit: I'm going to let that 'what that you' stand because one of the hardest things about HN posts is grammatical correctitude.

Re:Git: Malicious repositories can execute remote code while... by joubert on Tuesday March 09, 2021 @08:53PM (#26406854)
> wrote them down on a post-it

You write it on local media and kept it on-premises?

Cloud is the new thing, I hear.

Re:Git: Malicious repositories can execute remote code while... by ampdepolymerase on Tuesday March 09, 2021 @09:37PM (#26407115)
The Post-it was but a cache.
Re:Git: Malicious repositories can execute remote code while... by mrathys on Wednesday March 10, 2021 @03:08AM (#26408979)
I would consider the Post-it as persistent storage or the backup. Your memory would be the cache :D
Re:Git: Malicious repositories can execute remote code while... by taf2 on Tuesday March 09, 2021 @07:27PM (#26406324)
Yeah but the speed.