Mailing List Archive

#1845: VSL-query can only capture last field, if using floats operand.
#1845: VSL-query can only capture last field, if using floats operand.
-------------------------+------------------------
Reporter: xcir | Type: defect
Status: new | Priority: normal
Milestone: | Component: varnishlog
Version: 4.1.1-beta1 | Severity: normal
Keywords: vsl-query |
-------------------------+------------------------
VSL-query was using the VNUM when vsl-query parse the float.[[BR]]

https://github.com/varnish/Varnish-
Cache/blob/1628f0b93e4ba725f2f26ca82a6e794229517475/lib/libvarnishapi/vsl_query.c#L148

But, VNUM does not care a string of multiple field. (ex: - Timestamp
Resp: 1453185650.045902 0.000848 0.000031 )[[BR]]

https://github.com/varnish/Varnish-
Cache/blob/c24650d0f19faaa2f9c629c9d79ccebb940f585b/lib/libvarnish/vnum.c#L104-L105

Therefore, vsl-query can only capture last field.

'''Unpatched(not have output)'''
{{{
[root@ws01 httpd]# varnishlog -q "timestamp:resp[2] > 0." -graw
^C[root@ws01 httpd]#
}}}


'''Patched(value is floats)'''
{{{
xcir@varnish-trunk:~$ sudo /opt/varnish-411/bin/varnishlog -q
"timestamp:resp[2] > 0." -graw
32776 Timestamp c Resp: 1453194103.565767 0.001798 0.000025
^Cxcir@varnish-trunk:~$
}}}

'''Patched(value is not floats/not have output)'''
{{{
xcir@varnish-trunk:~sudo /opt/varnish-411/bin/varnishlog -q
"respheader:b" -graw
2 RespHeader c B: 2.427602foo 4.001516bar 6.000027mage
^Cxcir@varnish-trunk:~$ sudo /opt/varnish-411/bin/varnishlog -q
"respheader:b[1] > 0" -graw
^Cxcir@varnish-trunk:~$
}}}

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by xcir):

Sorry, mistake.[[BR]]

'''Patched(value is not floats/not have output)'''

{{{
xcir@varnish-trunk:~$
xcir@varnish-trunk:~$ sudo /opt/varnish-411/bin/varnishlog -q
"respheader:b" -graw
32782 RespHeader c B: 2.427602foo 4.001516bar 6.000027mage
^Cxcir@varnish-trunk:~$ sudo /opt/varnish-411/bin/varnishlog -q
"respheader:b[1] > 0." -graw
^Cxcir@varnish-trunk:~$

}}}

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by fgsch):

Broken in 9bb8f96223d248beb5962961b493b16dcc8ecc2a.

VNUMpfx() will skip trailing whitespaces so I don't think this patch is
correct. It is passing the tests because what was after the space was a
digit/+/-.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:2>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by fgsch):

Proposed patch attached.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:3>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by xcir):

r01845.patch is change some other function action, if string including
spaces. (std.duration, VNUM, VNUM_2bytes)
Impact range is worrisome.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:4>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by fgsch):

I should have added, I've checked all instances and I couldn't find any
issues.
Specifically for the functions you have mentioned:

1. std.duration() does the skipping in the code.
2. VNUM_2bytes() allows for a space after the number.
3. VNUM is mostly used for converting arguments so the space is a non-
issue.

If this is a concern we could use VNUMpfx() and do the whitespace skipping
dance explicitly, however.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:5>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by fgsch):

Actually, my previous patch had a bug.

I've also reconsidered the approach and to remain inline with the previous
behaviour I've moved the whitespace skipping out of VNUMpfx and into the
functions that call it.

Attached is a revisited patch that should address xcir concerns and the
bug itself.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:6>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by xcir):

I tried this patch.
looks good to me. :-)

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:7>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by xcir):

Sorry, I found a problem at std.real

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:8>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+--------------------------
Reporter: xcir | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution:
Keywords: vsl-query |
------------------------+--------------------------

Comment (by fgsch):

Good catch!

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:9>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+---------------------------------------------
Reporter: xcir | Owner: Federico G. Schwindt <fgsch@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution: fixed
Keywords: vsl-query |
------------------------+---------------------------------------------
Changes (by Federico G. Schwindt <fgsch@…>):

* owner: => Federico G. Schwindt <fgsch@…>
* status: new => closed
* resolution: => fixed


Comment:

In [0e0b37412e1766bccb8e0db447784ce2f23fb307]:
{{{
#!CommitTicketReference repository=""
revision="0e0b37412e1766bccb8e0db447784ce2f23fb307"
Handle whitespace after floats in test fields

Broken in 9bb8f96223d248beb5962961b493b16dcc8ecc2a.
Committed solution proposed by phk@, discussed with phk@ and martin@.

Fixes #1845.
}}}

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:10>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1845: VSL-query can only capture last field, if using floats operand. [ In reply to ]
#1845: VSL-query can only capture last field, if using floats operand.
------------------------+---------------------------------------------
Reporter: xcir | Owner: Federico G. Schwindt <fgsch@…>
Type: defect | Status: closed
Priority: normal | Milestone:
Component: varnishlog | Version: 4.1.1-beta1
Severity: normal | Resolution: fixed
Keywords: vsl-query |
------------------------+---------------------------------------------

Comment (by Lasse Karstensen <lkarsten@…>):

In [152dd84ad66717e2b248d57840cf6c26269d3648]:
{{{
#!CommitTicketReference repository=""
revision="152dd84ad66717e2b248d57840cf6c26269d3648"
Handle whitespace after floats in test fields

Broken in 9bb8f96223d248beb5962961b493b16dcc8ecc2a.
Committed solution proposed by phk@, discussed with phk@ and martin@.

Fixes #1845.
}}}

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1845#comment:11>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs