Page MenuHomePhabricator

Long gadget names cause problems in user_properties table
Closed, ResolvedPublic

Description

Author: angus

Description:
...or the prefix used saving the preferences should be shortened. That's because in the new table "user_properties" the maximum key length is 32 bytes. There is already a gadget in eswiki ("herramienta-ver-subpaginas") that can't be saved because of this.

See bug 19408.


Version: unspecified
Severity: enhancement

Details

Reference
bz19410

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:43 PM
bzimport set Reference to bz19410.
bzimport added a subscriber: Unknown Object (MLST).

Suggest WONTFIX. Making gadgets use shorter names is a good temporary workaround; however, bug 19408 should _eventually_ be fixed. Andrew said we wouldn't do it immediately, not that it wouldn't be done.

  • Bug 21414 has been marked as a duplicate of this bug. ***

Re-opening this for now. I think 32 bytes is a reasonable key length. I think the system in which Gadgets rely on text prefixes should be re-examined. This seems prone to accidental overlap in the future and other nastiness.

Without prefix they could override other user preferences.

(In reply to comment #5)

Without prefix they could override other user preferences.

I think I meant suffix, actually. The issue here is that _any_ text name-based key is going to cause problems here, as far as I know. The only way to get around this would be to make the key length 262 bytes (255 bytes for the maximum title length + 7 bytes for "gadget-"). But having such a length key doesn't seem like the right answer. Instead, it probably makes more sense to store these keys using an ID of some kind instead of the gadget name. That should eliminate the possibility of duplicate keys and truncation.

Gadgets 2.0 enforces a 244-byte limit for names due to ResourceLoader::isValidModuleName...it appears that current Gadgets has the same restriction, but isn't enforcing it anywhere :/

(In reply to Kunal Mehta (Legoktm) from comment #8)

Gadgets 2.0 enforces a 244-byte limit for names due to
ResourceLoader::isValidModuleName...it appears that current Gadgets has the
same restriction, but isn't enforcing it anywhere :/

Fix for master in Change-Id: Ib74c0866bb333885c747d318418e2c8685ae339c.

After that's merged, I think we can consider this bug to be fixed with max length set to 244 bytes.

Change 157792 had a related patch set uploaded by Alex Monk:
Check Gadget name is a valid ResourceLoader module name

https://gerrit.wikimedia.org/r/157792

Change 157792 merged by jenkins-bot:
Check Gadget name is a valid ResourceLoader module name

https://gerrit.wikimedia.org/r/157792

Gadget names are required to be a max of 244 bytes.

  • Bug 19245 has been marked as a duplicate of this bug. ***