<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>202363</bug_id>
          
          <creation_ts>2019-09-30 06:59:51 -0700</creation_ts>
          <short_desc>[GTK] Printing not working with bubblewrap sandbox enabled</short_desc>
          <delta_ts>2022-08-28 23:56:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2004725</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>206533</blocked>
    
    <blocked>244332</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Master One">masterone</reporter>
          <assigned_to name="Carlos Garcia Campos">cgarcia</assigned_to>
          <cc>abukolt58</cc>
    
    <cc>adam</cc>
    
    <cc>alex.go4more</cc>
    
    <cc>andrea.vai</cc>
    
    <cc>aperez</cc>
    
    <cc>braden</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>bugzilla</cc>
    
    <cc>bugzilla-webkit</cc>
    
    <cc>cgarcia</cc>
    
    <cc>chris</cc>
    
    <cc>dan</cc>
    
    <cc>gpoo</cc>
    
    <cc>ht990332</cc>
    
    <cc>kip</cc>
    
    <cc>lui</cc>
    
    <cc>maierw</cc>
    
    <cc>markus.pohle</cc>
    
    <cc>matthias.andree</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mcrha</cc>
    
    <cc>mgorse</cc>
    
    <cc>mike</cc>
    
    <cc>noein93</cc>
    
    <cc>pgriffis</cc>
    
    <cc>robert</cc>
    
    <cc>shawn</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1575251</commentid>
    <comment_count>0</comment_count>
    <who name="Master One">masterone</who>
    <bug_when>2019-09-30 06:59:51 -0700</bug_when>
    <thetext>This bug was originally posted as https://gitlab.gnome.org/GNOME/epiphany/issues/957 but I was advised to put this here.

On a fresh installation of Arch Linux with Gnome 3.34.0 I can not make Epiphany to print anything. Printers are setup correctly and work from other applications. I have attached 3 screenshots:

When I press Ctrl-p or select printing from the menu, the Gnome print dialog comes up as expected.

https://gitlab.gnome.org/GNOME/epiphany/uploads/9265d127fad8c3afccaa0c4ec56d027c/epiphany_print1.png

When I select a printer (in my case &quot;netbrother&quot; or PDF) and click Print, the print dialog disappears and the error message &quot;Printer not found&quot; is shown.

https://gitlab.gnome.org/GNOME/epiphany/uploads/319edb378b6dda5bd1598c5d9d331231/epiphany_print2.png

When I select &quot;Print to File&quot; and click Print, the print dialog disappears and the error &quot;No such file or directory&quot; is shown.

https://gitlab.gnome.org/GNOME/epiphany/uploads/d5e6f967b493abe1778ac5c4e4f61bac/epiphany_print3.png</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575462</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2019-10-01 01:14:02 -0700</bug_when>
    <thetext>Does this happen with sandboxing disabled?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575474</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2019-10-01 02:36:24 -0700</bug_when>
    <thetext>It works with WEBKIT_FORCE_SANDBOX=0, so I guess it&apos;s trying to print from the web process? That&apos;s weird.

Would be good to fix bug #192748 at the same time. Switching WebKitPrintOperation to use either GtkPrintOperation or the printing portal directly should suffice for both bugs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1665305</commentid>
    <comment_count>3</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-06-22 23:14:21 -0700</bug_when>
    <thetext>The dialog runs in the UI process, and the generated settings are sent to the web process. In the web process we use GtkPrintJob, which requires a GtkPrinter object, so we also use gtk_enumerate_printers() to find the selected printer. I guess gtk_enumerate_printers it&apos;s failing, that&apos;s why the error is printer not found. GtkPrintJob will probably fail too if we get the printer, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1706841</commentid>
    <comment_count>4</comment_count>
    <who name="">dan</who>
    <bug_when>2020-11-12 07:07:49 -0800</bug_when>
    <thetext>This is a problem for Evolution in Fedora 33.  Users are unable to print an email from within Evolution.

As a workaround, starting Evolution with:

$ WEBKIT_FORCE_SANDBOX=0 evolution

permits the behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709009</commentid>
    <comment_count>5</comment_count>
    <who name="Markus Pohle">markus.pohle</who>
    <bug_when>2020-11-19 01:54:34 -0800</bug_when>
    <thetext>can confirm that this workaround works for fedora 33 users to make evolution print again

will this bug be solved in the near future?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1714987</commentid>
    <comment_count>6</comment_count>
    <who name="Luigi">lui</who>
    <bug_when>2020-12-15 18:12:11 -0800</bug_when>
    <thetext>Just tested the patch and it works for me so thank-you for the patch.
Hope it is &quot;officially&quot; fixed in some update soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1725082</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Gratton">mike</who>
    <bug_when>2021-02-03 04:34:45 -0800</bug_when>
    <thetext>This also breaks printing to PDF from the sandbox, presumably because the destination location isn&apos;t writable.

Adding all of ~ as writable to the sandbox seems to fix it: https://gitlab.gnome.org/GNOME/geary/-/merge_requests/655 - but this (to my mind at least) makes the sandbox substantially less useful.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1725134</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-02-03 07:34:03 -0800</bug_when>
    <thetext>Yeah that effectively disables the entire sandbox. Until we manage to fix this, you should not enable the sandbox if you need printing to work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1725330</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Gratton">mike</who>
    <bug_when>2021-02-03 13:48:20 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #8)
&gt; Yeah that effectively disables the entire sandbox. Until we manage to fix
&gt; this, you should not enable the sandbox if you need printing to work.

Well printing to PDF is an important use case (I care a lot less about printing to actual printers, tbh) so I&apos;m going to merge that MR.

I&apos;d be willing to consider narrowing the focus down to just say XDG_DOWNLOADS and XDG_DOCUMENTS if WebKitGTK at least produced an error signal/dialog/whatever when the operation fails, instead of doing so silently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1725335</commentid>
    <comment_count>10</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-02-03 14:20:00 -0800</bug_when>
    <thetext>Just remove the code that enables the sandbox instead. That makes more sense than enabling the sandbox and allowing everything through. Also, I&apos;ll probably make it crash in the future if you try to enable access to ~, since we don&apos;t want to allow that in GTK 4, whereas you know for sure the sandbox will remain off by default for the lifetime of GTK 3 to avoid breaking existing apps. So it&apos;s better to just disable the sandbox until you&apos;re ready to try again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726458</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Gratton">mike</who>
    <bug_when>2021-02-06 23:29:13 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #10)
&gt; Just remove the code that enables the sandbox instead.

Sure, done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726459</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Gratton">mike</who>
    <bug_when>2021-02-06 23:31:43 -0800</bug_when>
    <thetext>Is there likely to be any movement on improving completely broken printing situation in WebkitGTK under modern deployment situations?

It would be a shame to hold off the port of Geary to GTK4 because of it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726475</commentid>
    <comment_count>13</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-02-07 06:36:25 -0800</bug_when>
    <thetext>It&apos;s on my to-do list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1771008</commentid>
    <comment_count>14</comment_count>
    <who name="">shawn</who>
    <bug_when>2021-06-18 07:04:11 -0700</bug_when>
    <thetext>Michael, would love to see this fixed.  Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1773746</commentid>
    <comment_count>15</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-30 08:05:15 -0700</bug_when>
    <thetext>*** Bug 192748 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884032</commentid>
    <comment_count>16</comment_count>
    <who name="Adam Bukolt">abukolt58</who>
    <bug_when>2022-07-15 08:15:37 -0700</bug_when>
    <thetext>The now closed https://gitlab.gnome.org/GNOME/epiphany/-/issues/1831 refers to apparently the same problem on a different flavour of Linux and and with a non-flatpak installation of Gnome Web (Epiphany). 

If it is the same issue, other applications (Epiphany, Firefox) can print both to a file and to a physical printer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1893679</commentid>
    <comment_count>17</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-08-25 04:45:04 -0700</bug_when>
    <thetext>Let&apos;s split this, because bubblewap and flatpak require different solutions. To make it work with bubblewrap we need to move the part to handle printers to the UI process, for flatpak we need to use the portal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1893682</commentid>
    <comment_count>18</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-08-25 05:08:04 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/3651</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1894412</commentid>
    <comment_count>19</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-08-28 23:56:35 -0700</bug_when>
    <thetext>Committed 253895@main (d5158b635f0e): &lt;https://commits.webkit.org/253895@main&gt;

Reviewed commits have been landed. Closing PR #3651 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>