Skip to content

Escape backslashes when building tab-separated row#318

Merged
cvvergara merged 1 commit intopgRouting:developfrom
cvvergara:get-pr-317
Oct 28, 2025
Merged

Escape backslashes when building tab-separated row#318
cvvergara merged 1 commit intopgRouting:developfrom
cvvergara:get-pr-317

Conversation

@cvvergara
Copy link
Member

@cvvergara cvvergara commented Oct 28, 2025

(cherry picked from commit 798d8ec)

The pr #317 was made with the old code, and all tests were failing

@pgRouting/admins

Summary by CodeRabbit

  • Bug Fixes
    • Fixed handling of backslashes in tab-separated data exports to ensure proper escaping and preserve data integrity.

@cvvergara cvvergara added this to the osm2pgrouting 3.0.0 milestone Oct 28, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Walkthrough

Modified the tab_separated function in utilities to escape backslashes within non-empty columns using boost::replace_all, adding a new header inclusion for the string replacement algorithm from Boost.

Changes

Cohort / File(s) Summary
Backslash escaping in tab-separated output
src/utilities/utilities.cpp
Added boost/algorithm/string/replace.hpp header. Introduced backslash escaping logic in tab_separated function to replace single backslashes with double backslashes in non-empty columns before appending to result.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Focus on verifying the escaping logic correctly handles edge cases (consecutive backslashes, empty columns, etc.)
  • Confirm the Boost library usage is consistent with existing codebase patterns

Poem

A rabbit hops through strings so long,
Escaping slashes, making them strong!
Backslashes doubled, safe and sound,
In tabs they're tangled, tightly wound. 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Escape backslashes when building tab-separated row" directly corresponds to the main change in the changeset. The raw summary confirms that backslash escaping was introduced in the tab_separated function using boost::replace_all(column, "\\", "\\\\"), which is precisely what the title describes. The title is concise, specific, and clearly communicates the primary purpose of the change without vague terminology or unnecessary details. A teammate reviewing the commit history would immediately understand that this PR addresses backslash escaping in tab-separated row construction.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a97793 and 6364305.

📒 Files selected for processing (1)
  • src/utilities/utilities.cpp (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Ubuntu psql (17, 3, Release, ubuntu-22.04, clang)
  • GitHub Check: Ubuntu psql (18, 3, Release, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (18, 3, Debug, ubuntu-22.04, clang)
  • GitHub Check: Ubuntu psql (16, 3, Release, ubuntu-latest, gcc-latest)
  • GitHub Check: Ubuntu psql (18, 3, Release, ubuntu-latest, clang)
  • GitHub Check: Ubuntu psql (17, 3, Release, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (17, 3, Debug, ubuntu-22.04, clang)
  • GitHub Check: Ubuntu psql (15, 3, Debug, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (15, 3, Debug, ubuntu-22.04, gcc-latest)
  • GitHub Check: Ubuntu psql (16, 3, Debug, ubuntu-22.04, gcc-latest)
  • GitHub Check: Ubuntu psql (15, 3, Release, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (15, 3, Release, ubuntu-22.04, gcc-latest)
  • GitHub Check: Ubuntu psql (15, 3, Debug, ubuntu-22.04, clang)
  • GitHub Check: Ubuntu psql (16, 3, Debug, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (14, 3, Debug, ubuntu-22.04, clang)
  • GitHub Check: Ubuntu psql (14, 3, Debug, ubuntu-22.04, g++-11)
  • GitHub Check: Ubuntu psql (14, 3, Debug, ubuntu-latest, g++-11)
  • GitHub Check: Ubuntu psql (14, 3, Debug, ubuntu-latest, gcc-latest)
  • GitHub Check: Ubuntu psql (14, 3, Release, ubuntu-latest, clang)
🔇 Additional comments (1)
src/utilities/utilities.cpp (1)

23-23: LGTM!

The include is necessary for boost::replace_all and is correctly added.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cvvergara cvvergara merged commit 0c9f44f into pgRouting:develop Oct 28, 2025
73 of 74 checks passed
@cvvergara cvvergara deleted the get-pr-317 branch October 28, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants