Conversation
|
🌳 🔧 Config Check This pull request has not modified the root BUILD |
There was a problem hiding this comment.
Code Review
This pull request updates the path normalization logic in validate_usr_symlinks.awk to handle redundant leading slashes and dot-slashes, and adds comprehensive test cases to verify these scenarios. Feedback suggests simplifying the normalization loop into a single, more idiomatic AWK sub call using a regular expression to improve efficiency.
| sub(/^\//, "", path) | ||
| # Normalize: strip any combination of leading ./ and / | ||
| # This ensures ./bin, /bin, bin, and even //bin are treated the same. | ||
| while (sub(/^\.\//, "", path) || sub(/^\//, "", path)) ; |
There was a problem hiding this comment.
The while loop for path normalization can be simplified into a single sub call using a regular expression. This is more idiomatic in AWK and avoids the overhead of multiple function calls in a loop. The regex ^(\.\/|\/)+ will match any sequence of leading ./ or / at the start of the string.
sub(/^(\.\/|\/)+/, "", path)
Signed-off-by: Appu Goundan <appu@google.com>
9cbf4a5 to
adb1ccf
Compare
|
🌳 🔄 Image Check |
No description provided.