google-cloud-print-connector FTBFS (focal)

Bug #1859685 reported by Rafael David Tinoco
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
golang-codegangsta-cli (Ubuntu)
Invalid
Medium
Unassigned
golang-github-urfave-cli (Ubuntu)
Invalid
Medium
Unassigned
google-cloud-print-connector (Ubuntu)
Fix Released
Medium
Rafael David Tinoco

Bug Description

[Impact]

 * google-cloud-print-connector FTBFS in Focal because of recent CUPS version being used in that Ubuntu version (2.3.0-7ubuntu1)

[Test Case]

 * dpkg-buildpackage -b -us -uc in google-cloud-print-connector source package directory.

[Regression Potential]

 * There are 2 ways to fix the issue:

   1) allow print-connector to keep accessing IPP internal structures, like it was before, disconsidering the fact that recent CUPS might not like it (since it removed the feature, not it may consider they're dynamic and not accessible externally).

   2) fix print-connector by changing internal (to IPP) data structure access (IPP status, basically) for the CUPS functions that make internal structures data available.

(1) is faster and safer for now, specially considering the fact that this package might be EOL soon. chances of regression are reduced if using (1) to fix FTBFS.

[Other Info]

ORIGINAL DESCRIPTION:

While trying to generate binary package for google-cloud-print-connector, we get:

github.com/coreos/go-systemd/journal
github.com/google/cloud-print-connector/log
github.com/google/cloud-print-connector/cups
# github.com/google/cloud-print-connector/cups
cgo-gcc-prolog: In function ‘_cgo_033c9b726dd2_Cfunc_cupsGetPPD3’:
cgo-gcc-prolog:95:2: warning: ‘cupsGetPPD3’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
In file included from src/github.com/google/cloud-print-connector/cups/cups.h:15,
                 from src/github.com/google/cloud-print-connector/cups/core.go:14:
/usr/include/cups/ppd.h:360:22: note: declared here
  360 | extern http_status_t cupsGetPPD3(http_t *http, const char *name, time_t *modtime, char *buffer, size_t bufsize) _CUPS_DEPRECATED_1_6_MSG("Use cupsCopyDestInfo and friends instead.");
      | ^~~~~~~~~~~
# github.com/google/cloud-print-connector/cups
cups.c: In function ‘getIPPRequestStatusCode’:
cups.c:42:12: error: dereferencing pointer to incomplete type ‘ipp_t’ {aka ‘struct _ipp_s’}
   42 | return ipp->request.status.status_code;
      | ^~
cups.c: In function ‘getAttributeDateValue’:
cups.c:47:13: error: dereferencing pointer to incomplete type ‘ipp_attribute_t’ {aka ‘struct _ipp_attribute_s’}
   47 | return attr->values[i].date;
      | ^~
crypto
crypto/internal/randutil
bufio

Changed in google-cloud-print-connector (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Rafael David Tinoco (rafaeldtinoco)
status: New → In Progress
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Reported issue upstream, as it also happens with latest source:

https://github.com/google/cloud-print-connector/issues/476

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

doing a quick research it looks like we're missing the "internal" (to cups) structures definitions. This is usually enabled compilation time using -D_IPP_PRIVATE_STRUCTURES=1.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

https://github.com/google/cloud-print-connector/issues/476#issuecomment-574354522

" This might happen because, at least from cups README.md file, from CUPS v2.3b4: Removed support for -D_IPP_PRIVATE_STRUCTURES=1 developer cheat - the IPP accessor functions should be used instead. "

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

I have suggested 3 patches to fix the FTBFS at:

https://github.com/google/cloud-print-connector/pull/477

Waiting upstream maintainer to give a look and provide feedback.

Patches are "workarounds" for new features introduced in new CUPs version AND some build issues with golang-github-codegangsta-cli-dev and golang-github-urfave-cli-dev.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

New CUPSs do not provide _IPP_PRIVATE_STRUCTURES feature. Missing IPP internal data should be acquired by using the proper new functions provided by CUPS.

    Fix FTBFS with urfave/cli BoolFlag DefaultText variable

    Without this, the code FTBFS with the following error:

    src/github.com/google/cloud-print-connector/gcp-connector-util/gcp-cups-connector-util.go:112:5:
    unknown field 'DefaultText' in struct l eral of type cli.BoolFlag
    src/github.com/google/cloud-print-connector/gcp-connector-util/main_unix.go:61:3:
    unknown field 'DefaultText' in struct literal of type cli.BoolFlag
    src/github.com/google/cloud-print-connector/gcp-connector-util/main_unix.go:66:3:
    unknown field 'DefaultText' in struct literal of type cli.BoolFlag
    src/github.com/google/cloud-print-connector/gcp-connector-util/main_unix.go:71:3:
    unknown field 'DefaultText' in struct literal of type cli.BoolFlag

For some reason, cloud-print-connection was FTBFS because of golang-github-codegangsta-cli-dev, complaining about types. (codegangsta-cli-dev hasn't changed from previous working version in Ubuntu).

    Fix types for cli.Command assignments

    Without this, code FTBFS with the following error:

    google/cloud-print-connector/gcp-connector-util/main_unix.go:106:15:
    cannot use append(unixCommands, commonCommands...) (type []*cli.Command)
    as type []cli.Command in assignment

Also, for some reason, golang-github-urfave-cli-dev is having problems with BoolFlag DefaultText field. We have moved from previous working version 1.20.0-1 to 1.22.2-1 in recent Ubuntu.

    Workaround for no _IPP_PRIVATE_STRUCTURES in newer CUPS versions

    Added hardcoded ipp-private.h as workaround for the lack of the
    _IPP_PRIVATE_STRUCTURES feature, dropped in CUPS v2.3b4. Without this
    feature, all the IPP private structures, needed by cups/core.go, to get
    the IPP Request Status Code, will not exist making code FTBFS.

    Correct fix for this is to rely on new functions, provided by CUPS, in
    order to obtain internal structure data access (C or go).

Changed in golang-github-urfave-cli (Ubuntu):
status: New → Confirmed
Changed in golang-codegangsta-cli (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in golang-github-urfave-cli (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Worst case scenario:

I can apply those 3 patches to our source package and get rid of FTBFS issue, at least until upstream fixes cloud-print-connector for newer cups versions (and/or we get rid of issues from those 2 golang libraries).

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

You can safely ignore any CUPS warnings about deprecated PPD file support functions here. The deprecation in CUPS means that these functions are removed in a later feature release of CUPS (not necessarily the next feature release). The next feature release happens near the end of this year at the earliest, but Google Cloud Print will be discontinued at the end of this year, where google-cloud-print-connector will get useless and therefore removed from the distro. So it does not make sense to migrate the PPD API use to newer IPP-based CUPS APIs.

So the only thing to do here is to not consider warnings as errors in the build of this package and also make sure to use accessor functions for the IPP data structures.

Also do not hesitate to use distro patches in this package, due to the fact that its live ends this year, it is possible that the upstream maintainer does not care about this package much any more.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Till,

Before they were DEPRECATED warnings, now, in focal, with the new CUPs, they're actually FTBFS errors, because IPP private structures aren't exposed any longer. Thats why I'm including the ipp-private.h header in cups-private.h in my patch.

Thanks for letting me know about EOL for this package! I'll go with easier approach (patching like I did, without waiting for upstream moves).

Thanks for the feedback!

tags: added: update-excuse
tags: added: ftbfs
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Awesome, it appears that, our version does not need the go patches, just the includes, which turns this much easier. Attaching the debdiff in 5m.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :
Changed in golang-codegangsta-cli (Ubuntu):
status: Confirmed → Invalid
Changed in golang-github-urfave-cli (Ubuntu):
status: Confirmed → Invalid
tags: added: patch
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

$ sudo gdebi ./google-cloud-print-connector_1.12-1ubuntu1_amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done

Google Cloud Print CUPS Connector
 Share CUPS printers with ChromeOS and Android devices, via Google Cloud Print.
 Share hundreds of printers on a powerful server, or two printers on a
 Raspberry Pi.
 .
 Lots of help can be found in the wiki
 (https://github.com/google/cloud-print-connector/wiki).
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
  c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
Selecting previously unselected package google-cloud-print-connector.
(Reading database ... 172932 files and directories currently installed.)
Preparing to unpack .../google-cloud-print-connector_1.12-1ubuntu1_amd64.deb ...
Unpacking google-cloud-print-connector (1.12-1ubuntu1) ...
Setting up google-cloud-print-connector (1.12-1ubuntu1) ...
(c)rafaeldtinoco@netsnmp:~/.../netsnmp-rebuild-failures$
(c)rafaeldtinoco@netsnmp:~/.../netsnmp-rebuild-failures$
(c)rafaeldtinoco@netsnmp:~/.../netsnmp-rebuild-failures$ dpkg -L google-cloud-print-connector
/.
/usr
/usr/bin
/usr/bin/gcp-connector-util
/usr/bin/gcp-cups-connector
/usr/share
/usr/share/doc
/usr/share/doc/google-cloud-print-connector
/usr/share/doc/google-cloud-print-connector/changelog.Debian.gz
/usr/share/doc/google-cloud-print-connector/copyright
(c)rafaeldtinoco@netsnmp:~/.../netsnmp-rebuild-failures$ /usr/bin/gcp-connector-util
NAME:
   gcp-connector-util - Google Cloud Print Connector for CUPS utility tools

USAGE:
   gcp-connector-util [global options] command [command options] [arguments...]

VERSION:
   DEV

COMMANDS:
   init, i Creates a config file
   monitor, m Read stats from a running connector
   delete-all-gcp-printers Delete all printers associated with this connector
   backfill-config-file Add all keys, with default values, to the config file
   sparse-config-file Remove all keys, with non-default values, from the config file
   delete-gcp-job Deletes one GCP job
   cancel-gcp-job Cancels one GCP job
   delete-all-gcp-printer-jobs Delete all queued jobs associated with a printer
   cancel-all-gcp-printer-jobs Cancels all queued jobs associated with a printer
   show-gcp-printer-status Shows the current status of a printer and its jobs
   share-gcp-printer Shares a printer with user or group
   unshare-gcp-printer Removes user or group access to printer
   update-gcp-printer Modifies settings for a printer
   help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config-filename value Connector config filename (default: "gcp-cups-connector.config.json")
   --help, -h show help
   --version, -v print the version
(c)rafaeldtinoco@netsnmp:~/.../netsnmp-rebuild-failures$ /usr/bin/gcp-cups-connector
Google Cloud Print Connector for CUPS version DEV-linux
Ready to rock in local-only mode

Shutting down

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

So I guess this patch is good to upload, need a +1 here. This will help unblocking net-snmp (that is why we cared for this in the beginning). It also looks like this package will be removed in 20.04 (before freeze, perhaps ?) A statement about this would also be good as this package will be EOL in 2020 (as stated by upstream).

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

It is an ugly, but effective workaround to get back to the status-quo it had before.
After the input by Till that this is about to die anyway it seems even more reasonable to give it that quick-shot to be working for the time being.

You have upstreamed it (if they want to consider it at all), the patch and headers look good, the argument and documentation of choice is good and the changelog looks ok.

+1 on the fix as attached here.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Christian,

Thanks a lot for reviewing this. And, yes, +1 on everything you said about ugly/effective. I thought that had less chances to introduce a bug then changing the functions to new CUPS functions (which I would have tried with upstream if better maintained).

Thanks! Uploading it...

description: updated
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading google-cloud-print-connector_1.12-1ubuntu1.dsc: done.
  Uploading google-cloud-print-connector_1.12-1ubuntu1.debian.tar.xz: done.
  Uploading google-cloud-print-connector_1.12-1ubuntu1_source.buildinfo: done.
  Uploading google-cloud-print-connector_1.12-1ubuntu1_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package google-cloud-print-connector - 1.12-1ubuntu1

---------------
google-cloud-print-connector (1.12-1ubuntu1) focal; urgency=medium

  * Fix FTBFS for recent CUPS whithout IPP private structures (LP: #1859685)

 -- Rafael David Tinoco <email address hidden> Thu, 16 Jan 2020 17:24:12 +0000

Changed in google-cloud-print-connector (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.