Closed
Bug 415378
Opened 18 years ago
Closed 7 years ago
[INFOBOT] Problems parsing regular expression (regexp)
Categories
(Webtools Graveyard :: Mozbot, defect)
Webtools Graveyard
Mozbot
Tracking
(Not tracked)
RESOLVED
INACTIVE
People
(Reporter: Cww, Assigned: Cww)
Details
(Whiteboard: [has-attachment-])
Attachments
(2 files, 3 obsolete files)
|
2.43 KB,
patch
|
Details | Diff | Splinter Review | |
|
1.08 KB,
patch
|
wolf
:
review-
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: mozbot 2.5 (...Infobot...)
Slashes in regexp break EditFactoid.
Reproducible: Always
Steps to Reproduce:
1. firebot testslashes is this/is/a/path
2. firebot testslashes =~ s/\/a\//n't\/a\//
3. Try other things to get this/isn't/a/path
Actual Results:
Bad things. Some syntaxes replace, some cause Infobot to hang.
Expected Results:
Something so we can edit URLs in factoids.
A fix:
Change the sanitizeRegexp routine in mozbot.pl to sanitize / in search terms:
sub sanitizeRegexp {
my $self = shift;
my ($regexp) = @_;
if (defined($regexp)) {
$regexp =~ s#(?<!\\)\/#\\\/#; # escape all non-escaped /'s
# XXX this should also check that it's not something truly bizarre
# like \\/ and need escaping but this will do for now.
eval {
'' =~ /$regexp/;
};
$self->debug("regexp |$regexp| returned error |$@|, quoting...") if $@;
return $@ ? quotemeta($regexp) : $regexp;
} else {
$self->debug("blank regexp, returning wildcard regexp //...");
return '';
}
}
Use the attached, modified Infobot module:
The module supports using any non-whitespace character as a deliminator: #!$%a-z etc. (Matched brackets ie: s{something}somethingelse} doesn't work.)
It also allows the chosen deliminator (or the default /) to be escaped in the search and result strings without breaking.
After making both changes the following things work:
test is this/is/a/path$
test =~ s$/is/a/$/isn't/just/a/$ gives this/isn't/just/a/path$
test =~ /\/is\/a\//\/isn't\/just\/a\// gives the same
test =~ s$\$$$ gives this/isn't/a/path
test =~ s$\$$\$\$$ gives this/is/a/path$$
Updated•18 years ago
|
Assignee: ian → bugzilla.cww
OS: Windows XP → All
Hardware: PC → All
Comment 2•18 years ago
|
||
Comment on attachment 301048 [details]
New Infobot module
Please attach your modifications as a patch to the Infobot.bm module in CVS.
Attachment #301048 -
Attachment is obsolete: true
Attachment #301048 -
Attachment mime type: application/octet-stream → text/plain
Updated•18 years ago
|
Severity: minor → normal
Summary: Infobot regexp bugs → [INFOBOT] Problems parsing regular expression (regexp)
Comment 3•18 years ago
|
||
cvs diff -up6 (or so.) is your friend there.
Comment 5•18 years ago
|
||
You don't need write access to the repository to make a patch. See http://developer.mozilla.org/en/docs/Mozilla_Source_Code_(CVS) for more information.
Doh, using the patch command does not do what it says it should. Thanks for the link.
Updated•18 years ago
|
Attachment #301057 -
Flags: review?(timeless)
Comment on attachment 301057 [details] [diff] [review]
The patch this time
tabs are taboo. i'm not sure i'm a legal reviewer for mozbot. the regexp /seems/ ok, but i'm bleary eyed.
sorry
Attachment #301057 -
Flags: review?(timeless) → review-
Ooooops, I just realized what you mean by "Tabs are taboo". Man, notepad++'s tabs to spaces module doesn't work apparently. In fact it somehow changes spacing on every single line.
I've manually put spaces where I had tabs and did a -w which SHOULD be OK. I hope.
Attachment #301057 -
Attachment is obsolete: true
| Assignee | ||
Comment 10•18 years ago
|
||
Ugh, tabs to spaces. Tabs to spaces.
Attachment #302949 -
Attachment is obsolete: true
Updated•18 years ago
|
Whiteboard: [has-attachment]
Comment 11•18 years ago
|
||
Comment on attachment 302950 [details] [diff] [review]
Mozbot patch (manual tabs to spaces)
mozbot shouldn't be 5.10 only.
Needs to addtionally support 5.8 for sure.
Attachment #302950 -
Flags: review-
Updated•18 years ago
|
Whiteboard: [has-attachment] → [has-attachment-]
Updated•7 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Updated•7 years ago
|
Product: Webtools → Webtools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•