normalize_newlines & text_replaced should not use a dictionary
Bug #1190 reported by
Carlos Perelló Marín
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Low
|
Unassigned |
Bug Description
Dictionaries are unordered
Dictionaries are unordered. If I have text that is:
\r\n\r\r\n
And the \r -> \n replacement runs first, I get
\n\n\n\n\n
When \r\n replacement runs, nothing changes (no \r).
Now if the operation runs in reverse (\r\n -> \n first):
\r\n\r\r\n
becomes
\n\r\n
And then I suspect
\n\n
Which is different. Isn't that a pretty evil bug? Why are we using
dictionaries?
Ah, by looking at text_replaced, I am seeing we iterate over
replacements.
right way to do it.. if we have clauses that do
\n -> \r
\r -> \x
\x -> \n
Then the ordering matters very much.
Changed in rosetta: | |
assignee: | nobody → stevea |
status: | New → Accepted |
Changed in launchpad-foundations: | |
assignee: | Steve Alexander (stevea) → nobody |
tags: |
added: tech-debt removed: infrastructure |
To post a comment you must log in.
Rosetta is the only user of this ancient function.