Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly parse filenames for r and w #29

Closed
aureliojargas opened this issue May 18, 2019 · 1 comment
Closed

Properly parse filenames for r and w #29

aureliojargas opened this issue May 18, 2019 · 1 comment
Labels
Milestone

Comments

@aureliojargas
Copy link
Owner

From the GNU sed documentation:

https://www.gnu.org/software/sed/manual/sed.html#Commands-Requiring-a-newline

The r,R,w,W commands parse the filename until end of the line. If whitespace, comments or semicolons are found, they will be included in the filename, leading to unexpected results.

Sedsed current matching for filenames:

# Regex patterns to identify special entities
patt = {
    #...
    'filename': r'[^\s]+',   # _any_ not blank char (strange..)
    #...
}

There's a clear mismatch here. My code is wrong. Fix it.

aureliojargas added a commit that referenced this issue May 18, 2019
This is a syntax gotcha. From GNU sed documentation:

The r,R,w,W commands parse the filename until end of the line. If
whitespace, comments or semicolons are found, they will be included
in the filename, leading to unexpected results.

So adding that comment after the s///w flag was a mistake. It will
be considered part of the filename. This commit fixes the relevant
test cases.

From the html and token tests fixed in this commit, we can see
that sedsed actually consider that ending a real comment. Issue
#29 was opened to
fix sedsed code to correctly parse that.
@aureliojargas
Copy link
Owner Author

Fixed by the new sedparse parser, see #52.

$ ./sedsed.py -e "rfoo;#bar.txt"
r foo;#bar.txt
$

@aureliojargas aureliojargas added this to the v2.0 milestone Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant