Skip to content

Commit

Permalink
Add hack to fix bogus contentsize check in client
Browse files Browse the repository at this point in the history
A recent bug in swupd-client prevents users from updating due to a
maximum contensize check that was a couple orders of magnitude off.
These clients are broken and cannot update if they have installed
bundles that violate this maximum.

To allow these broken clients to update temporarily set the maximum
contentsize to the bogus contentsize expected by the client.

Remove this check once a format bump has occurred.

Signed-off-by: Matthew Johnson <[email protected]>
  • Loading branch information
matthewrsj authored and tmarcu committed Apr 3, 2018
1 parent 2995143 commit 16bb0ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions swupd/create_manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ func CreateManifests(version uint32, minVersion uint32, format uint, statedir st
continue
}

// TODO: remove this after a format bump in Clear Linux
// this is a hack to set maximum contentsize to the incorrect maximum
// set in swupd-client v3.15.3
bMan.setMaxContentSizeHack()
// end hack

// sort by version then by filename, previously to this sort these bundles
// were sorted by file name only to make processing easier
bMan.sortFilesVersionName()
Expand Down
13 changes: 13 additions & 0 deletions swupd/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,3 +984,16 @@ func writeIndexManifest(c *config, ui *UpdateInfo, bundles []*Manifest) (*Manife

return idxMan, nil
}

// this is a hack to allow users to update using swupd-client v3.15.3 which performs a
// check on contentsize with a maximum a couple of orders off the intended maximum.
// Remove this code (and the caller) when a format bump has occurred in Clear.
var badMax uint64 = 2000000000

func (m *Manifest) setMaxContentSizeHack() {
if m.Header.ContentSize >= badMax {
m.Header.ContentSize = badMax - 1
}
}

// end hack

0 comments on commit 16bb0ed

Please sign in to comment.