Commit 11a3d91
committed
Fix handling of version files that contain CRLFs
From looking at metrics, I noticed that the `cat --show-nonprinting`
approach added in #1783 to aid the visualisation of invisible characters
(such as ASCII control characters) also escapes carriage return
characters (to `^M`), which we don't want.
Instead, `sed` is now used which replaces anything not matching the
`:print:` and `:space:` groups with the Unicode substitution character
(`�`) - which means the classic buildpack now also matches the CNB's
behaviour:
https://github.com/heroku/buildpacks-python/blob/f2fdd00edf0f63b298cf88c82377885c88666440/src/python_version_file.rs#L16-L19
For a mapping of what `:print:` and `:space:` cover, see the chart at
the bottom of this page:
https://en.cppreference.com/w/cpp/string/byte/isprint
GUS-W-18225347.1 parent 7f983c3 commit 11a3d91
File tree
5 files changed
+14
-4
lines changed- lib
- spec
- fixtures/python_version_file_invalid_version
- hatchet
5 files changed
+14
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
| 525 | + | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| |||
0 commit comments