Bug 788486
Summary: | virt-edit -e: Bareword found where operator expected | ||
---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | Richard W.M. Jones <rjones> |
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | unspecified | CC: | mbooth, virt-maint |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2012-02-08 10:18:26 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Richard W.M. Jones
2012-02-08 09:49:09 UTC
After a lot of experimentation, here is a minimal case for the Bareword error: $ virt-edit -a disk.img /etc/shadow -e 's_^root:_root:7:::_' Bareword found where operator expected at (eval 1) line 1, near "7::" (Missing operator before ::?) syntax error at (eval 1) line 1, near "root:" ...propagated at -e line 1, <STDIN> line 1. Removing more of the pattern gives just a syntax error: $ virt-edit -a disk.img /etc/shadow -e 's_^root:_root:_' syntax error at (eval 1) line 1, near "root:" ...propagated at -e line 1, <STDIN> line 1. The same error happens in plain Perl, eg: $ perl -e 's_^root:_root:7:::_' /etc/passwd Bareword found where operator expected at -e line 1, near "7::" (Missing operator before ::?) syntax error at -e line 1, near "root:" Execution of -e aborted due to compilation errors. I think what is happening is that the Perl lexer treats s_ as a single terminal, not as s followed by a delimiter underscore. Naturally that completely changes the meaning of the expression. The solution would be to use another delimiter, not _. Note that it works fine using, eg. s{}{} Other suggestions here: https://rt.perl.org/rt3//Public/Bug/Display.html?id=68804 |