altstoreio / altstoreio/AltStore

Make app attribute "size" unsigned

Open
#222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
14.4k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/rileytestut/AltStore/blob/f96de8d082872e37b369fb3dcc9faaa2ec27c59a/AltStore/Model/StoreApp.swift#L133

Why is this an Int32? A negative filesize doesn't make sense, and neither does a 2 GiB cap - Why not at least a UInt32 to disable negative numbers and double the cap to 4 GiB, without any extra memory?

Additionally, why just 32 bits? Why not 64 bits, UInt64, so that it could hold an essentially unlimited size?

It seems illogical that a filesize of 2GiB is the cap (to the user anyway, not so much to a developer) when apple only sells iDevices with 256GB now as the lowest i believe (and even if not, any modern iDevice has at least 32 GB of storage)

And i understand there must be a cap somewhere, but why at 2 GiB? An arbitrary cap of 8192 PiB (UInt64) would be much less intrusive, considering that no iPhone has more than 512 GB of storage, and no iDevice that runs AltStore has more than 1 TB of storage

And even if you want to save memory space by like 4 bytes per app by not using a 64-bit integer, there's no reason to not double the cap for free to 4 GiB since filesizes cannot legitimately be negative

The new code here after this fix would be:
self.size = try container.decode(UInt64.self, forKey: .size)
And naturally, this line:
https://github.com/rileytestut/AltStore/blob/f96de8d082872e37b369fb3dcc9faaa2ec27c59a/AltStore/Model/StoreApp.swift#L39
Would be changed to:
@NSManaged private(set) var size: UInt64
Along with a couple other tweaks in a couple other places, probably

Also, could size be optional? So it won't show a size when it's omitted (or 0), instead of an error, because while it is nice that it's a thing, imo it doesn't really make sense that it's mandatory for every app?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in AltStore/Model/StoreApp.swift at the size property around line 39 and its decoding around line 133, then inspect the other references to size mentioned in the issue. Determine consistent unsigned and optional behavior, including omitted or zero values, and verify that existing app records still decode and display correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.