Page MenuHomePhabricator

Store diffs as binary, not UTF-8
Closed, ResolvedPublic

Description

Currently, we store diffs as UTF-8. This is a lovely idea, but diffs are not UTF-8, and they also aren't UTF-8 with only BMP characters, which is what we actually are able to store. This causes various problems which we'd be better off dealing with at a higher level than we do. Particularly, this means arc patch can never work for some set of diffs, which is probably not a reasonable behavior.

We should store diffs as binary and mangle encodings at display time (hopefully with some level of caching so this doesn't destroy performance).

The major issue with this is that it implies an enormous migration for all existing installs.

Related Objects

Event Timeline

NorthIsUp created this task.Nov 1 2013, 9:14 PM
NorthIsUp raised the priority of this task from to Needs Triage.
NorthIsUp updated the task description. (Show Details)
NorthIsUp added a project: Differential.
NorthIsUp added a subscriber: NorthIsUp.
NorthIsUp edited this Maniphest Task.Nov 1 2013, 9:14 PM
NorthIsUp renamed this task from The poop emoji breaks Differential to The poop emoji breaks Differential 💩.Nov 1 2013, 9:15 PM
NorthIsUp updated the task description. (Show Details)

@epriestley pointed me to T1191: Comments are truncated at first non-base-plane character. This is slightly different as this is the diff contents and not just a comment.

See also T3804, T3788, T3801, T3974, and others. I'm going to merge some of those here and make this the master.

epriestley added a subscriber: Unknown Object (User).Nov 4 2013, 4:26 PM

◀ Merged tasks: T3974, T3804.

epriestley renamed this task from The poop emoji breaks Differential to Store diffs as binary, not UTF-8.Nov 4 2013, 4:30 PM
epriestley triaged this task as Normal priority.
epriestley updated the task description. (Show Details)
epriestley edited this Maniphest Task.Nov 4 2013, 7:35 PM

It may make sense to pursue T3788 first, which is likely to cover "I have this non-utf8 diff and need to do something reasonable with it". Once that's in, we can start handing Differential non-utf8 diffs.

MrKroz added a subscriber: MrKroz.Nov 16 2013, 2:47 PM

A messy side effect of this is that we can't use JSON to transport content or filenames in all cases. Conduit probably needs builtin support for encoding/decoding arbitrary fields.

◀ Merged tasks: T4135.

See T1191 for the root issue with valid (but not BMP-only) unicode diffs. This will resolve both BMP truncation and non-utf8 diffs.

champo added a subscriber: champo.Apr 3 2014, 2:05 PM
champo added a comment.Apr 3 2014, 2:07 PM

Is there a timeline for this? We have an active project that has files that can't be parsed regularly.

We don't have a specific timeline on this. There are several steps that need to happen to provide complete support:

  • We need to change the actual column to binary. This is technically simple, but will be a fairly time consuming migration for larger installs.
  • We need to annotate the character set of the stored data, and adjust the write pathways to perform detection/annotation when saving data. We can fake this / build it partially at first to some degree.
  • Conduit uses JSON to transmit data (including diffs), which is not binary safe. We need to introduce a parameter encoding mode which can transmit binary data. This is messy.
  • We need to update arc to transmit data using this encoding mode.
  • When pulling diffs out of the VCS, we may need to adjust encoding flags or environmental variables.
  • When displaying diffs in an unknown or non-UTF8 encoding, we need to convert to UTF8 and reasonably inform the user about errors. This is probably quite messy.

T2999 and T3801 are related.

I would like to fix this relatively soon, but it's complicated and interacts with many other systems, and only affects installs that use non-UTF8 character encodings in source code. This isn't especially unusual, but isn't hugely common either.

epriestley edited this Maniphest Task.Apr 7 2014, 4:57 PM
epriestley edited this Maniphest Task.Apr 12 2014, 1:23 PM
epriestley edited this Maniphest Task.Apr 12 2014, 1:40 PM
epriestley edited this Maniphest Task.Apr 14 2014, 7:06 PM
epriestley edited this Maniphest Task.
frgtn added a subscriber: frgtn.Apr 30 2014, 11:14 AM

This and T1191 are pretty much in positions #1 and #2 on my personal list of dumb, bad technical junk which is embarrassingly broken that we need to fix, but that list is like list #3 or #4 on my list of lists of stuff I need to do.

(Well, T4324 might actually be #1.)

epriestley edited this Maniphest Task.May 25 2014, 2:16 PM
epriestley edited this Maniphest Task.May 25 2014, 3:11 PM
epriestley edited this Maniphest Task.May 25 2014, 3:24 PM
epriestley edited this Maniphest Task.May 25 2014, 4:01 PM
epriestley edited this Maniphest Task.May 25 2014, 4:36 PM
epriestley edited this Maniphest Task.May 25 2014, 5:02 PM
epriestley edited this Maniphest Task.May 25 2014, 6:50 PM
epriestley edited this Maniphest Task.May 25 2014, 7:05 PM
epriestley edited this Maniphest Task.May 25 2014, 9:10 PM
epriestley edited this Maniphest Task.May 30 2014, 10:23 AM
epriestley edited this Maniphest Task.Jun 4 2014, 1:03 AM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Jun 20 2014, 6:49 PM

◀ Merged tasks: T5632.

Is there a way to put phabricator returned to normal?

The phabrcator server have our using data for one year

You can comment out this check in libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php, by making validateUTF8String() just return; until this task and T1191 complete.

Any progress for this? It is currently holding up the import of some of our svn and git repositories (stuck at 99% done due to consistent commit message parse failures due to emoji).

octera added a subscriber: octera.Aug 15 2014, 10:06 PM

◀ Merged tasks: T3493.

Support Impact Broken with no workaround on a nontrivial subset of diffs.

eadler added a subscriber: eadler.Jul 10 2015, 5:05 AM
fanis added a subscriber: fanis.Aug 18 2015, 3:19 PM
andybons removed a subscriber: andybons.Aug 18 2015, 8:22 PM
erich added a subscriber: erich.May 12 2016, 3:26 PM
eadler added a project: Restricted Project.Aug 5 2016, 5:24 PM
epriestley closed this task as Resolved.Dec 13 2016, 5:44 PM
epriestley claimed this task.

This is now better tracked in followups:

  • T8475 / T8623 cover making the storage binary-safe (it has been binary safe for at least 18 months).
  • T11660, T6633 (and others?) deal with non-UTF8 filenames.
  • T5955 discusses Conduit wire protocols.