Skip to content

Fix svn status parsing for paths with extra status flags#174

Open
mostafasoufi wants to merge 1 commit into10up:developfrom
mostafasoufi:fix/svn-status-parsing
Open

Fix svn status parsing for paths with extra status flags#174
mostafasoufi wants to merge 1 commit into10up:developfrom
mostafasoufi:fix/svn-status-parsing

Conversation

@mostafasoufi
Copy link

Summary

Fixes the sed 's/! *//' regex on line 204 of deploy.sh which fails to correctly parse svn status output when columns 2-7 contain non-space status flags (e.g. L for locked).

Root cause: svn status output uses 7 fixed-width single-character columns followed by a space before the path. The current sed regex strips ! plus trailing spaces, but stops at any non-space character in columns 2-7, producing invalid paths like L trunk/views/....

Fix: Replace sed 's/! *//' with cut -c9- which extracts from character 9 onward — always the start of the path regardless of status flags.

-svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %@ > /dev/null
+svn status | grep '^\!' | cut -c9- | xargs -I% svn rm %@ > /dev/null

Details

svn status format (docs):

!  L    trunk/views/components/modals
^^^^^^^
cols 1-7 = status flags, col 8 = space, col 9+ = path

The sed approach works in the common case (columns 2-7 are spaces), but breaks when any flag is set — such as L (locked) which can appear during checkout operations in CI.

Real-world failure: This caused svn: E155007 errors when deploying WP SMS v7.2 which added a new views/ directory tree. The locked entries during svn add left L flags that corrupted the subsequent svn rm paths.

Verification

  • cut -c9- produces identical output to sed 's/! *//' when columns 2-7 are all spaces (the common case)
  • cut -c9- correctly handles all status flag combinations (locked, switched, conflicted, etc.)
  • The 8-character prefix width is part of SVN's stable output format

Fixes #134

The sed regex `s/! *//` stops stripping at non-space characters in
columns 2-7 of svn status output (e.g. lock flag 'L'), leaving
invalid path prefixes like "L    trunk/views/...".

Replace with `cut -c9-` which correctly strips the fixed 8-character
status prefix (7 status columns + 1 space) regardless of flag values.

Fixes 10up#134
@mostafasoufi mostafasoufi requested a review from a team as a code owner March 8, 2026 16:27
@mostafasoufi mostafasoufi requested review from peterwilsoncc and removed request for a team March 8, 2026 16:27
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.

After first action I'm getting "trunk is not a working copy" error

1 participant