Less than a Month. Which isn’t bad for a baked snak food, but it’s hardly survival food.
Incidentally, around this time of year, you can often buy matzo bread below cost. If you keep the pantry moths out of it, it doesn’t go bad for a very long time. Along with some sealed peanut butter, and of course lots of water, it can make a decent basis for your two weeks of disaster rations. I like to add some canned pineapple or other fruit.
Sugar, in a dry environment, would surely keep a long time.
As others have said, though, an awful lot depends on storage. If you have a truly airtight container, lots of foods will keep a long time without spoiling.
I reckon Marmite would also keep a long time. Some would argue that it couldn’t get any worse, at any rate. (I’m not one of them, BTW)
In that case 99.99% of all food have an infinite shelf life. None will last any longer than the others under ideal conditions.
The only exceptions are those tiny proportions of foods that have ingredients that will chemically react and cause the food to spoil at temperatures of 4oK. Even then, the process would take hundreds of thousands of years.
So any food will last hundreds of thousands of years under your “ideal conditions”. Most foods will last longer than the Earth has existed, which is as close to forever as makes no difference. There just isn’t enough energy in a typical food sample stored at 4oK to allow it to decay at a rate that will render it inedible in less than a few billion years.