istopwg / ippeveselfcert

IPP Everywhere Printer Self-Certification Tools
https://www.pwg.org/ipp/everywhere.html
Apache License 2.0
21 stars 6 forks source link

IPP Everywhere v1.1 ipp-test.sh I-10. printer-alert test incorrect failure for -1 alert-group-index value #58

Closed crizzo-xerox closed 4 years ago

crizzo-xerox commented 4 years ago

Per RFC3805 prtAlertGroupIndex can have the value -1:

-- NOTE: In RFC 1759, the range was not defined. SYNTAX Integer32 (-1..2147483647) MAX-ACCESS read-only STATUS current DESCRIPTION "The low-order index of the row within the table identified by prtAlertGroup that represents the sub-unit of the printer that caused this alert, or -1 if not applicable. The combination of the prtAlertGroup and the prtAlertGroupIndex defines exactly which printer sub-unit caused the alert; for example, Input #3, Output#2, and Marker #1. Every object in this MIB is indexed with hrDeviceIndex and optionally, another index variable. If this other index variable is present in the table that generated the alert, it will be used as the value for this object. Otherwise, this value shall be -1. NOTE: The above description has been modified from RFC 1759 for clarification." ::= { prtAlertEntry 5 }

ipp-test.sh is failing a device for having a -1 value for alert-group-index:

`code=subunitPowerSaver;index=5;severity=warningBinaryChangeEvent;training=noInterventionRequired;group=generalPrinter;groupindex=-1;location=155100;time=1595604499;

I-10. Get-Printer-Attributes Operation (default)                     [FAIL]
    RECEIVED: 17763 bytes in response
    status-code = successful-ok (successful-ok)
    EXPECTED: printer-alert WITH-ALL-VALUES /^code=[A-Za-z]+(;index=[0-9]+|;severity=[A-Za-z]+|;training=[A-Za-z]+|;group=[A-Za-z]+|;groupindex=[0-9]+|;location=[0-9]+|;time=[0-9]+){0,};?$/
    GOT: printer-alert="code=tonerLow;index=2;severity=warningBinaryChangeEvent;training=trained;group=markerSupplies;groupindex=2;location=956700;time=1595600296;"
    GOT: printer-alert="code=subunitPowerSaver;index=5;severity=warningBinaryChangeEvent;training=noInterventionRequired;group=generalPrinter;groupindex=-1;location=155100;time=1595604499;"`

groupIndex=-1 is the cause of failure, but per RFC 3805 -1 is a valid value.

wifiprintguy commented 4 years ago

Good catch, Chris!

The ABNF in 5100.9 isn't specific as to the allowable range of values:

alert-group-index = "groupindex" "=" 1*DIGIT
; integer value as a numeric string mapped directly mapped from ; 'prtAlertGroupIndex' in [RFC1759] [RFC3805] 

I'm not an experience user of ABNF, but the ABNF seems to be lacking a provision for the -1 value. The regex created from the ABNF is correspondingly lacking elements that would accept a -1 value.

I think two things need to be done:

  1. An errata report should be filed on the pwg site for PWG 5100.9 to correct the ABNF: https://www.pwg.org/dynamo/issues.php?L+Z9 to specify something like this:
alert-group-index = "groupindex" "=" negative-one / positive-integer
negative-one = "-" %x31
positive-integer = 1*DIGIT
  1. Add to the regex in ipp-tests.test I-10 elements to support "-1" or a positive integer for the "group-index" key embedded in the string value - perhaps something like this:

Chris, you could try adding the "-1|" characters right after "groupindex=" to see if that test now passes.

crizzo-xerox commented 4 years ago

I think the groupindex regex has to look like this:

(-1|[0-9]+)http://regexr.com/591o0

(parenthesis added)

I tested with a non-negative one alert, and just adding -1| broke the non-negative regex test

Thanks, Chris

Christopher Rizzo Xerox Corporation GDG/Discovery/Advance Technology 26600 SW Parkway Ave. Wilsonville, OR 97070-9251 Phone: (585) 314-6936 Email: Christopher.Rizzo@xerox.com

"The realization came over me with full force that a good part of the remainder of my life was going to be spent in finding errors in my own programs." -Maurice Wilkes, Memoirs of a Computer Pioneer

From: Smith Kennedy notifications@github.com Reply-To: istopwg/ippeveselfcert reply@reply.github.com Date: Monday, July 27, 2020 at 10:13 AM To: istopwg/ippeveselfcert ippeveselfcert@noreply.github.com Cc: Christopher Rizzo Christopher.Rizzo@xerox.com, Author author@noreply.github.com Subject: Re: [istopwg/ippeveselfcert] IPP Everywhere v1.1 ipp-test.sh I-10. printer-alert test incorrect failure for -1 alert-group-index value (#58)

Good catch, Chris!

The ABNF in 5100.9 isn't specific as to the allowable range of values:

alert-group-index = "groupindex" "=" 1*DIGIT

; integer value as a numeric string mapped directly mapped from ; 'prtAlertGroupIndex' in [RFC1759] [RFC3805]

I'm not an experience user of ABNF, but the ABNF seems to be lacking a provision for the -1 value. The regex created from the ABNF is correspondingly lacking elements that would accept a -1 value.

I think two things need to be done:

  1. An errata report should be filed on the pwg site for PWG 5100.9 to correct the ABNF: https://www.pwg.org/dynamo/issues.php?L+Z9 to specify something like this:

alert-group-index = "groupindex" "=" negative-one / positive-integer

negative-one = "-" %x31

positive-integer = 1*DIGIT

  1. Add to the regex in ipp-tests.test I-10 elements to support "-1" or a positive integer for the "group-index" key embedded in the string value - perhaps something like this:

    • Old: groupindex=[0-9]+|;
    • New: groupindex=-1|[0-9]+

Chris, you could try adding the "-1|" characters right after "groupindex=" to see if that test now passes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/istopwg/ippeveselfcert/issues/58#issuecomment-664524170, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABR66KVVHJJ3VVP3BWL4O3LR5WYQLANCNFSM4PI34QWA.

michaelrsweet commented 4 years ago

Definitely we'll need parenthesis for grouping.

michaelrsweet commented 4 years ago

[master 2177308] Allow index of -1 (Issue #58)