All of lore.kernel.org
 help / color / mirror / Atom feed
* [Printing-architecture] [cups-filters] using cups-browsed for DNS-SD/IPP discovery
@ 2016-03-22 20:40 Brian Norris
  2016-04-11 16:51 ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2016-03-22 20:40 UTC (permalink / raw)
  To: printing-architecture; +Cc: till.kamppeter

Hi,

I'm looking at the features of cups-browsed to see if I would want to
use it for my purposes, and I ran across a really confusing piece of
logic in the source code:

    if (!pdl || pdl[0] == '\0' ||
        (!strcasestr(pdl, "application/postscript") &&
         !strcasestr(pdl, "application/pdf") &&
         !strcasestr(pdl, "image/pwg-raster") &&
         ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
           !strcasestr(pdl, "application/PCL") &&
           !strcasestr(pdl, "application/x-pcl")) ||
          ((strncasecmp(make_model, "HP", 2) ||
            strncasecmp(make_model, "Hewlett Packard", 15) ||
            strncasecmp(make_model, "Hewlett-Packard", 15)) &&
           !strcasestr(make_model, "LaserJet") &&
           !strcasestr(make_model, "Mopier"))) &&
         !strcasestr(pdl, "application/vnd.hp-PCLXL"))) {
      debug_printf("cups-browsed: Cannot create remote printer %s (%s) as its PDLs are not known, ignoring this printer.\n",
                   p->name, p->uri);
      goto fail;
    }

First of all, can anyone explain exactly what the block about HP is
really supposed to be doing? I can't honestly figure it out.

But at any rate, I don't see how it could be correct. Particularly, this
clause is always true (at most one of the comparisons will return 0), so
why is it there?

           (strncasecmp(make_model, "HP", 2) ||
            strncasecmp(make_model, "Hewlett Packard", 15) ||
            strncasecmp(make_model, "Hewlett-Packard", 15))

Seems like at a minimum, this block should be corrected to actually
produce the status of "is this an HP model." e.g., does the following
diff make sense?

=== modified file 'utils/cups-browsed.c'
--- utils/cups-browsed.c	2016-02-10 14:18:28 +0000
+++ utils/cups-browsed.c	2016-03-22 20:25:19 +0000
@@ -2784,8 +2784,8 @@
 	 ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
 	   !strcasestr(pdl, "application/PCL") &&
 	   !strcasestr(pdl, "application/x-pcl")) ||
-	  ((strncasecmp(make_model, "HP", 2) ||
-	    strncasecmp(make_model, "Hewlett Packard", 15) ||
+	  ((strncasecmp(make_model, "HP", 2) &&
+	    strncasecmp(make_model, "Hewlett Packard", 15) &&
 	    strncasecmp(make_model, "Hewlett-Packard", 15)) &&
 	   !strcasestr(make_model, "LaserJet") &&
 	   !strcasestr(make_model, "Mopier"))) &&

But I still don't feel like that's really what's intended, so an answer
to my first question would be the most helpful.

Now, besides the correctness of this logic, is this aspect of the daemon
something that people regularly use? I see that it's installed on many
Linux distributions, but it seems like it isn't really exercised for
Bonjour/DNS-SD discovery unless someone modifies the default
cups-browsed.conf to have 'CreateIPPPrinterQueues Yes'.

Regards,
Brian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Printing-architecture] [cups-filters] using cups-browsed for DNS-SD/IPP discovery
  2016-03-22 20:40 [Printing-architecture] [cups-filters] using cups-browsed for DNS-SD/IPP discovery Brian Norris
@ 2016-04-11 16:51 ` Brian Norris
  2016-04-11 18:04   ` Ira McDonald
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2016-04-11 16:51 UTC (permalink / raw)
  To: printing-architecture; +Cc: till.kamppeter

Ping? Should I just file a bug for these sort of questions?

On Tue, Mar 22, 2016 at 01:40:34PM -0700, Brian Norris wrote:
> Hi,
> 
> I'm looking at the features of cups-browsed to see if I would want to
> use it for my purposes, and I ran across a really confusing piece of
> logic in the source code:
> 
>     if (!pdl || pdl[0] == '\0' ||
>         (!strcasestr(pdl, "application/postscript") &&
>          !strcasestr(pdl, "application/pdf") &&
>          !strcasestr(pdl, "image/pwg-raster") &&
>          ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
>            !strcasestr(pdl, "application/PCL") &&
>            !strcasestr(pdl, "application/x-pcl")) ||
>           ((strncasecmp(make_model, "HP", 2) ||
>             strncasecmp(make_model, "Hewlett Packard", 15) ||
>             strncasecmp(make_model, "Hewlett-Packard", 15)) &&
>            !strcasestr(make_model, "LaserJet") &&
>            !strcasestr(make_model, "Mopier"))) &&
>          !strcasestr(pdl, "application/vnd.hp-PCLXL"))) {
>       debug_printf("cups-browsed: Cannot create remote printer %s (%s) as its PDLs are not known, ignoring this printer.\n",
>                    p->name, p->uri);
>       goto fail;
>     }
> 
> First of all, can anyone explain exactly what the block about HP is
> really supposed to be doing? I can't honestly figure it out.
> 
> But at any rate, I don't see how it could be correct. Particularly, this
> clause is always true (at most one of the comparisons will return 0), so
> why is it there?
> 
>            (strncasecmp(make_model, "HP", 2) ||
>             strncasecmp(make_model, "Hewlett Packard", 15) ||
>             strncasecmp(make_model, "Hewlett-Packard", 15))
> 
> Seems like at a minimum, this block should be corrected to actually
> produce the status of "is this an HP model." e.g., does the following
> diff make sense?
> 
> === modified file 'utils/cups-browsed.c'
> --- utils/cups-browsed.c	2016-02-10 14:18:28 +0000
> +++ utils/cups-browsed.c	2016-03-22 20:25:19 +0000
> @@ -2784,8 +2784,8 @@
>  	 ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
>  	   !strcasestr(pdl, "application/PCL") &&
>  	   !strcasestr(pdl, "application/x-pcl")) ||
> -	  ((strncasecmp(make_model, "HP", 2) ||
> -	    strncasecmp(make_model, "Hewlett Packard", 15) ||
> +	  ((strncasecmp(make_model, "HP", 2) &&
> +	    strncasecmp(make_model, "Hewlett Packard", 15) &&
>  	    strncasecmp(make_model, "Hewlett-Packard", 15)) &&
>  	   !strcasestr(make_model, "LaserJet") &&
>  	   !strcasestr(make_model, "Mopier"))) &&
> 
> But I still don't feel like that's really what's intended, so an answer
> to my first question would be the most helpful.
> 
> Now, besides the correctness of this logic, is this aspect of the daemon
> something that people regularly use? I see that it's installed on many
> Linux distributions, but it seems like it isn't really exercised for
> Bonjour/DNS-SD discovery unless someone modifies the default
> cups-browsed.conf to have 'CreateIPPPrinterQueues Yes'.
> 
> Regards,
> Brian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Printing-architecture] [cups-filters] using cups-browsed for DNS-SD/IPP discovery
  2016-04-11 16:51 ` Brian Norris
@ 2016-04-11 18:04   ` Ira McDonald
  0 siblings, 0 replies; 3+ messages in thread
From: Ira McDonald @ 2016-04-11 18:04 UTC (permalink / raw)
  To: Brian Norris, Ira McDonald; +Cc: printing-architecture, Till Kamppeter

[-- Attachment #1: Type: text/plain, Size: 4104 bytes --]

Hi Brian,

Yes, filing a bug is the best idea.

Cheers,
- Ira


Ira McDonald (Musician / Software Architect)
Co-Chair - TCG Trusted Mobility Solutions WG
Chair - Linux Foundation Open Printing WG
Secretary - IEEE-ISTO Printer Working Group
Co-Chair - IEEE-ISTO PWG Internet Printing Protocol WG
IETF Designated Expert - IPP & Printer MIB
Blue Roof Music / High North Inc
http://sites.google.com/site/blueroofmusic
http://sites.google.com/site/highnorthinc
mailto: blueroofmusic@gmail.com
Winter  579 Park Place  Saline, MI  48176  734-944-0094
Summer  PO Box 221  Grand Marais, MI 49839  906-494-2434


On Mon, Apr 11, 2016 at 12:51 PM, Brian Norris <computersforpeace@gmail.com>
wrote:

> Ping? Should I just file a bug for these sort of questions?
>
> On Tue, Mar 22, 2016 at 01:40:34PM -0700, Brian Norris wrote:
> > Hi,
> >
> > I'm looking at the features of cups-browsed to see if I would want to
> > use it for my purposes, and I ran across a really confusing piece of
> > logic in the source code:
> >
> >     if (!pdl || pdl[0] == '\0' ||
> >         (!strcasestr(pdl, "application/postscript") &&
> >          !strcasestr(pdl, "application/pdf") &&
> >          !strcasestr(pdl, "image/pwg-raster") &&
> >          ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
> >            !strcasestr(pdl, "application/PCL") &&
> >            !strcasestr(pdl, "application/x-pcl")) ||
> >           ((strncasecmp(make_model, "HP", 2) ||
> >             strncasecmp(make_model, "Hewlett Packard", 15) ||
> >             strncasecmp(make_model, "Hewlett-Packard", 15)) &&
> >            !strcasestr(make_model, "LaserJet") &&
> >            !strcasestr(make_model, "Mopier"))) &&
> >          !strcasestr(pdl, "application/vnd.hp-PCLXL"))) {
> >       debug_printf("cups-browsed: Cannot create remote printer %s (%s)
> as its PDLs are not known, ignoring this printer.\n",
> >                    p->name, p->uri);
> >       goto fail;
> >     }
> >
> > First of all, can anyone explain exactly what the block about HP is
> > really supposed to be doing? I can't honestly figure it out.
> >
> > But at any rate, I don't see how it could be correct. Particularly, this
> > clause is always true (at most one of the comparisons will return 0), so
> > why is it there?
> >
> >            (strncasecmp(make_model, "HP", 2) ||
> >             strncasecmp(make_model, "Hewlett Packard", 15) ||
> >             strncasecmp(make_model, "Hewlett-Packard", 15))
> >
> > Seems like at a minimum, this block should be corrected to actually
> > produce the status of "is this an HP model." e.g., does the following
> > diff make sense?
> >
> > === modified file 'utils/cups-browsed.c'
> > --- utils/cups-browsed.c      2016-02-10 14:18:28 +0000
> > +++ utils/cups-browsed.c      2016-03-22 20:25:19 +0000
> > @@ -2784,8 +2784,8 @@
> >        ((!strcasestr(pdl, "application/vnd.hp-PCL") &&
> >          !strcasestr(pdl, "application/PCL") &&
> >          !strcasestr(pdl, "application/x-pcl")) ||
> > -       ((strncasecmp(make_model, "HP", 2) ||
> > -         strncasecmp(make_model, "Hewlett Packard", 15) ||
> > +       ((strncasecmp(make_model, "HP", 2) &&
> > +         strncasecmp(make_model, "Hewlett Packard", 15) &&
> >           strncasecmp(make_model, "Hewlett-Packard", 15)) &&
> >          !strcasestr(make_model, "LaserJet") &&
> >          !strcasestr(make_model, "Mopier"))) &&
> >
> > But I still don't feel like that's really what's intended, so an answer
> > to my first question would be the most helpful.
> >
> > Now, besides the correctness of this logic, is this aspect of the daemon
> > something that people regularly use? I see that it's installed on many
> > Linux distributions, but it seems like it isn't really exercised for
> > Bonjour/DNS-SD discovery unless someone modifies the default
> > cups-browsed.conf to have 'CreateIPPPrinterQueues Yes'.
> >
> > Regards,
> > Brian
> _______________________________________________
> Printing-architecture mailing list
> Printing-architecture@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/printing-architecture
>

[-- Attachment #2: Type: text/html, Size: 6270 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-11 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 20:40 [Printing-architecture] [cups-filters] using cups-browsed for DNS-SD/IPP discovery Brian Norris
2016-04-11 16:51 ` Brian Norris
2016-04-11 18:04   ` Ira McDonald

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.