istopwg / ippsample

IPP sample implementations.
http://istopwg.github.io/ippsample
Apache License 2.0
225 stars 83 forks source link

ipptool: problems presenting a large collection like "media-col-database" #241

Closed wifiprintguy closed 2 years ago

wifiprintguy commented 3 years ago

I used the attached .test file to perform a Get-Printer-Attributes on a printer I have, requesting "media-col-database" among other attributes. Unfortunately, while the response included a "media-col-database" attribute and value (large collection), ipptool failed to present it in its textual output.

Here's the textual output:

smitty@Serenity ipptool % ipptool -vt 'ipp://smitty-novelli-mp1.local:631/ipp/print' gpa-media-col-and-printer-input-tray.test
"gpa-media-col-and-printer-input-tray.test":
    Get-Printer-Attributes:
        attributes-charset (charset) = utf-8
        attributes-natural-language (naturalLanguage) = en
        printer-uri (uri) = ipp://smitty-novelli-mp1.local:631/ipp/print
        requested-attributes (1setOf keyword) = media-col-database,media-supported,media-col-supported,media-col-ready,media-ready,printer-input-tray
    Get printer attributes using Get-Printer-Attributes                  [PASS]
        RECEIVED: 110267 bytes in response
        status-code = successful-ok (successful-ok)
        attributes-charset (charset) = utf-8
        attributes-natural-language (naturalLanguage) = en
        media-supported (1setOf keyword) = na_executive_7.25x10.5in,na_letter_8.5x11in,na_govt-letter_8x10in,na_invoice_5.5x8.5in,iso_a5_148x210mm,iso_a4_210x297mm,jis_b5_182x257mm,jpn_hagaki_100x148mm,iso_a6_105x148mm,na_index-4x6_4x6in,na_5x7_5x7in,na_index-5x8_5x8in,na_number-10_4.125x9.5in,iso_dl_110x220mm,iso_c5_162x229mm,iso_c6_114x162mm,na_a2_4.375x5.75in,jpn_chou3_120x235mm,oe_photo_4x12in,jpn_photo-2l_127x177.8mm,jpn_oufuku_148x200mm,iso_b5_176x250mm,om_small-photo_100x150mm,na_monarch_3.875x7.5in,na_personal_3.625x6.5in,oe_photo_5x5in,custom_min_3.625x5in,custom_max_8.5x12in
        media-col-supported (1setOf keyword) = media-type,media-size,media-top-margin,media-left-margin,media-right-margin,media-bottom-margin,media-source,media-size-name
        media-col-database (1setOf collection) =         
        media-ready (1setOf keyword) = na_letter_8.5x11in,na_index-4x6_4x6in
        media-col-ready (1setOf collection) = {media-size={x-dimension=21590 y-dimension=27940} media-top-margin=296 media-bottom-margin=296 media-left-margin=296 media-right-margin=296 media-source=main media-type=stationery},{media-size={x-dimension=21590 y-dimension=27940} media-top-margin=0 media-bottom-margin=0 media-left-margin=0 media-right-margin=0 media-source=main media-type=stationery},{media-size={x-dimension=10160 y-dimension=15240} media-top-margin=296 media-bottom-margin=296 media-left-margin=296 media-right-margin=296 media-source=photo media-type=photographic-glossy},{media-size={x-dimension=10160 y-dimension=15240} media-top-margin=0 media-bottom-margin=0 media-left-margin=0 media-right-margin=0 media-source=photo media-type=photographic-glossy}
        printer-input-tray (1setOf octetString) = type=sheetFeedAutoNonRemovableTray;dimunit=micrometers;mediafeed=279400;mediaxfeed=215900;maxcapacity=100;level=58;unit=percent;status=0;name=Tray\ 1;,type=sheetFeedPull;dimunit=micrometers;mediafeed=152400;mediaxfeed=101600;maxcapacity=-2;level=-2;unit=percent;status=0;name=Tray\ 2;,type=other;dimunit=micrometers;mediafeed=-2;mediaxfeed=-2;maxcapacity=-2;level=-2;unit=percent;status=0;name=auto;
smitty@Serenity ipptool % 

Notice the line:

        media-col-database (1setOf collection) =         

gpa-media-col-and-printer-input-tray copy.test.txt ipptool-query-and-response-no-media-col-database-presented-packet-capture.pcapng.gz

michaelrsweet commented 3 years ago

This is caused by a fixed size (128k) buffer in ipptool, but in this case the size of the media-col-database attribute value exceeds that buffer when converted to a string...

wifiprintguy commented 3 years ago

Does fixing this require changes locally to ipptool or to libcups?

michaelrsweet commented 3 years ago

@wifiprintguy I’ll end up fixing this in CUPS and then merge back into ippsample/ippeveselfcert.

michaelrsweet commented 3 years ago

@wifiprintguy I increased the buffer size to 1MB:

[master 5f5a24a] Merge changes from CUPS master@b94651b24d277d5ff9fe2c3c4756001400bc957b

Let me know how it works for you...

wifiprintguy commented 2 years ago

Sorry for not replying sooner. Problem still seems to exist...

michaelrsweet commented 2 years ago

@wifiprintguy OK, so this still needs to be fixed in CUPS - can you attach the output from:

ipptool --ippserver attributes.conf PRINTER-URI get-printer-attributes.test

That will allow me to do some local testing.

Thanks!

michaelrsweet commented 2 years ago

Tracking in libcups issue 5, so please attach ipptool output there... Thanks!