Commit 079e01b
committed
external: normalize unambiguous file id lookup
external_lookup_id() uses strict string comparison, so file[0xa:0xa]
and file[10:10] (the same file) wont match when one side emits hex
and the other decimal. Add a numeric comparison path, but only for
unambiguous forms to preserve backward compatibility.
The key insight from avagins review: a component like 11 is ambiguous
it could mean decimal 11 or hex (0x11 = 17 decimal). Without the
explicit 0x prefix, there is no way to know the users intent.
file[11:17] and file[17:23] could silently match incorrectly.
Parse rules:
- 0x... => unambiguous hex (explicit prefix)
- contains hex digits (a-f/A-F) => unambiguous hex
- digits only => ambiguous, do NOT normalize-match
Only normalize when BOTH the mnt_id AND inode components are unambiguous.
Ambiguous IDs retain their literal/exact semantics.
This narrow fix addresses backward compatibility concerns:
- CRIU emits bare hex from %x (e.g., file[a:a]): unambiguous, normalizes
- CRIU emits bare digits from %x (e.g., file[10:10]): ambiguous, doesnt normalize
- User provides file[0xa:0xa]: unambiguous, matches to stored file[0xa:0xa]
- User provides file[10:10]: ambiguous, matches to stored file[10:10]
- file[10:10] will NOT normalize-match file[0xa:0xa] because the latter is unambiguous
Fixes: #2951
Signed-off-by: Farzan Aman Khan <farzanaman99@gmail.com>1 parent c180188 commit 079e01b
1 file changed
Lines changed: 112 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
11 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
12 | 101 | | |
13 | 102 | | |
14 | 103 | | |
| |||
39 | 128 | | |
40 | 129 | | |
41 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
42 | 137 | | |
43 | | - | |
| 138 | + | |
44 | 139 | | |
45 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
46 | 156 | | |
47 | 157 | | |
48 | 158 | | |
| |||
0 commit comments