From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9_?= =?UTF-8?Q?=D0=9F=D0=B0=D1=80=D0=B0=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2?= Newsgroups: gmane.emacs.bugs Subject: bug#16068: 24.3; Printing doesn't work Date: Sat, 7 Dec 2013 16:40:24 +0400 Message-ID: References: <83siu61hye.fsf@gnu.org> <83r49q1exg.fsf@gnu.org> <83pppa1b12.fsf@gnu.org> <83iov2115s.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b2e4c026eb6af04ecf11355 X-Trace: ger.gmane.org 1386420132 6834 80.91.229.3 (7 Dec 2013 12:42:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Dec 2013 12:42:12 +0000 (UTC) Cc: 16068@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 07 13:42:18 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VpHD7-0006gY-8V for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 13:42:17 +0100 Original-Received: from localhost ([::1]:35564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpHD6-0002HI-TZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 07:42:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpHCy-00026u-0g for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2013 07:42:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpHCt-0008TH-35 for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2013 07:42:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpHCt-0008TA-0W for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2013 07:42:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VpHCs-0007d4-06 for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2013 07:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9_?= =?UTF-8?Q?=D0=9F=D0=B0=D1=80=D0=B0=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2013 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16068-submit@debbugs.gnu.org id=B16068.138642007029268 (code B ref 16068); Sat, 07 Dec 2013 12:42:01 +0000 Original-Received: (at 16068) by debbugs.gnu.org; 7 Dec 2013 12:41:10 +0000 Original-Received: from localhost ([127.0.0.1]:35779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VpHC0-0007bw-2H for submit@debbugs.gnu.org; Sat, 07 Dec 2013 07:41:09 -0500 Original-Received: from mail-oa0-f41.google.com ([209.85.219.41]:35937) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VpHBx-0007bl-82 for 16068@debbugs.gnu.org; Sat, 07 Dec 2013 07:41:06 -0500 Original-Received: by mail-oa0-f41.google.com with SMTP id j17so2040142oag.28 for <16068@debbugs.gnu.org>; Sat, 07 Dec 2013 04:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=JR6MqYruxrJYXZMRgjDseIzPcNVYl6bJF+FCloe2Thg=; b=z6xYHKFn7+yC4eu0fCfpteoWRdDx803gmQmprUk4mJ+AWEGqCP+tG/maOFZWX33E17 kvzVjh5Kqvyifvai26Vu/4d2J3KoLWxg1hdDDMcLbGA0w9SgPuvZuYs+O/LlVIntajLE 20bQXA9VH4zUE/kZxLrQW9mcjSAJWSZCwUV49i3a12reWifxuQooZ2fYlq4ZFscVesPo 6Xm27YcKeFiOc5ER99lY3jBJ6FupWFoB7wznHfZ3uW+uaabtLdGRw3vseA31uE0hV0c4 Al1OzzhuZjvVF7u/q576NwlXB+sOfThPPd0dZSM00nS074J8Z4B1Fd3bU3WYIGXRO5g2 yPWg== X-Received: by 10.182.97.67 with SMTP id dy3mr7097obb.84.1386420064136; Sat, 07 Dec 2013 04:41:04 -0800 (PST) Original-Received: by 10.76.68.36 with HTTP; Sat, 7 Dec 2013 04:40:24 -0800 (PST) In-Reply-To: <83iov2115s.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81589 Archived-At: --047d7b2e4c026eb6af04ecf11355 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you very much for very clear and detailed instructions, Eli! I got the following output: (gdb) print *ppi2 $1 =3D {pServerName =3D 0x0, pPrinterName =3D 0x38a0136 <__register_frame_info+59375926> "RICOH Aficio 2018D PCL 6", pShareName =3D 0x38a0134 <__register_frame_info+59375924> "", pPortName = =3D 0x38a0118 <__register_frame_info+59375896> "82.97.201.165", pDriverName =3D 0x38a00e6 <__register_frame_info+59375846> "RICOH Aficio 2018D PCL 6", pComment =3D 0x38a00e4 <__register_frame_info+59375844> "", pLocation =3D 0x38a00e2 <__register_frame_info+59375842> "", pDevMode =3D 0x389f1c0 <__register_frame_info+59371968>, pSepFile =3D 0x38a00e0 <__register_frame_info+59375840> "", pPrintProcess= or =3D 0x38a00ce <__register_frame_info+59375822> "winprint", pDatatype =3D 0x38a00c6 <__register_frame_info+59375814> "RAW", pParamete= rs =3D 0x38a00c4 <__register_frame_info+59375812> "", pSecurityDescriptor =3D 0x389f088 <__register_frame_info+59371656>, Attributes =3D 576, Priority =3D 1, DefaultPriority =3D 0, StartTime =3D 0, UntilTime =3D 0, Status =3D 0, cJobs =3D 0, AveragePPM =3D 0} I see that pServerName, pShareName are not set, which confuses Fdefault_printer_name big time (e.g. it thinks the printer is local). It seems that in my case the problem lies is a very exotic way of configuration. I'll try to setup printer in the orthodox way when I'm in the office next time. Current configuration was done by IT guy; I'm not sure why he decided to use numeric IP addess and port instead of simple share name. Thank you for your support, Andrey Paramonov 2013/12/6 Eli Zaretskii > > From: =D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9 =D0=9F=D0=B0=D1=80=D0=B0=D0= =BC=D0=BE=D0=BD=D0=BE=D0=B2 > > Date: Fri, 6 Dec 2013 16:00:34 +0400 > > Cc: 16068@debbugs.gnu.org > > > > > Is it possible for you to step through default-printer-name with GDB > > > and see what happens there? I can send you detailed instructions, if > > > you need them. > > > > > > > Please do. > > See below, and thanks in advance. > > > Is it correct that default-printer-name is implemented in C (which is > why I > > need GDB)? > > Yes, this is correct. > > I see that you are using Emacs 24.3, which is an official release. I > suspect that this binary has been stripped of debugging symbols, so > you will be unable to debug it on the C source level. So the first > thing I suggest to do after installing GDB (let me know if you need a > link for a Windows port of GDB) is type this from the shell prompt: > > gdb /path/to/emacs.exe > > If GDB says something like this: > > Reading symbols from D:\foo\bar\emacs.exe...(no debugging symbols > found)...done. > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > then indeed the binary is stripped. In that case, please download a > recent snapshot from here: > > https://sourceforge.net/projects/emacs-bin/files/snapshots/ > > and start by verifying that the same problem still exists there. (It > could be that it was somehow fixed since 24.3 was released, although I > doubt that.) > > Once you establish that the problem still exists in the snapshot, > here's the sequence of commands I'd like you to perform: > > gdb /path/to/emacs.exe > > After GDB starts and displays its startup blurb, do this: > > (gdb) break Fdefault_printer_name > (gdb) run -Q > > The last command runs Emacs. When Emacs starts up, it will show the > *scratch* buffer. Type into that buffer: > > (default-printer-name) > > Then go to the right parenthesis and type C-j. This evaluates the > expression. (Please forgive me if I'm telling you things you know > very well.) > > When you evaluate that expression, the breakpoint you have set will > break, Emacs will stop, and GDB will take control. Switch to the > window where you run GDB, you should see there something like this: > > Breakpoint 1, Fdefault_printer_name () at w32fns.c:7217 > 7217 PRINTER_INFO_2 *ppi2 =3D NULL; > (gdb) > > (Since you don't have the sources, you will probably not see the > second line.) > > If you want to see the source code of default-printer-name, you can > find it here: > > http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/src/w32fns.c > > (The function's source starts around line 7210 in that file.) > > We want to get to line #7252, which is marked in the snippet below: > > err =3D GetPrinter (hPrn, 2, (LPBYTE)ppi2, dwNeeded, &dwReturned); > ClosePrinter (hPrn); > if (!err) > { > xfree (ppi2); > return Qnil; > } > > if (ppi2) <<<<<<<<<<<<<<<<<<<<<<<<<<<<< > { > if (ppi2->Attributes & PRINTER_ATTRIBUTE_SHARED && ppi2->pServerNam= e) > { > > The GDB command to do that is: > > (gdb) until 7252 > > (The "(gdb)" part is GDB's prompt, you don't need to type it.) > > GDB will step Emacs till that line, and respond like this: > > Fdefault_printer_name () at w32fns.c:7252 > 7252 if (ppi2) > (gdb) > > Now please tell GDB to display the contents of the ppi2 structure, > which holds the printer information Windows returned due to the call > to GetPrinter API: > > (gdb) print *ppi2 > > And post here everything you see. > > If you will do this in Emacs 24.3 (in case it does have the debugging > symbols), then please use "until 6943" instead of 7252 above, because > the source line numbers of the snippet I show above are different in > that version. > > Thanks again for your help. > --047d7b2e4c026eb6af04ecf11355 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you very much for very clear and detailed instructio= ns, Eli!
I got the following output:

(gdb= ) print *ppi2
$1 =3D {pServerName =3D 0x0, pPrinterName =3D 0x38a= 0136 <__register_frame_info+59375926> "RICOH Aficio 2018D PCL 6&= quot;,
=C2=A0 pShareName =3D 0x38a0134 <__register_frame_info+59375924>= "", pPortName =3D 0x38a0118 <__register_frame_info+59375896&g= t; "82.97.201.165",
=C2=A0 pDriverName =3D 0x38a00e6 &l= t;__register_frame_info+59375846> "RICOH Aficio 2018D PCL 6", = pComment =3D 0x38a00e4 <__register_frame_info+59375844> "",=
=C2=A0 pLocation =3D 0x38a00e2 <__register_frame_info+59375842> = "", pDevMode =3D 0x389f1c0 <__register_frame_info+59371968>= ,
=C2=A0 pSepFile =3D 0x38a00e0 <__register_frame_info+5937584= 0> "", pPrintProcessor =3D 0x38a00ce <__register_frame_info= +59375822> "winprint",
=C2=A0 pDatatype =3D 0x38a00c6 <__register_frame_info+59375814> = "RAW", pParameters =3D 0x38a00c4 <__register_frame_info+593758= 12> "",
=C2=A0 pSecurityDescriptor =3D 0x389f088 <= ;__register_frame_info+59371656>, Attributes =3D 576, Priority =3D 1, De= faultPriority =3D 0, StartTime =3D 0,
=C2=A0 UntilTime =3D 0, Status =3D 0, cJobs =3D 0, AveragePPM =3D 0}

I see that pServerName, pShareName are not se= t, which confuses Fdefault_printer_name big time (e.g. it thinks the printe= r is local).
It seems that in my case the problem lies is a very exotic way of conf= iguration. I'll try to setup printer in the orthodox way when I'm i= n the office next time. Current configuration was done by IT guy; I'm n= ot sure why he decided to use numeric IP addess and port instead of simple = share name.

Thank you for your support,
Andrey Paramonov<= /div>


20= 13/12/6 Eli Zaretskii <eliz@gnu.org>
> From: =D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0= =B9 =D0=9F=D0=B0=D1=80=D0=B0=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2 <cmr.pent@gmail.com>
> Date: Fri, 6 Dec 2013 16:00:34 +0400
> Cc: 16068@debbugs.gnu.org=
>
> > Is it possible for you to step through default-printer-name with = GDB
> > and see what happens there? =C2=A0I can send you detailed instruc= tions, if
> > you need them.
> >
>
> Please do.

See below, and thanks in advance.

> Is it correct that default-printer-name is implemented in C (which is = why I
> need GDB)?

Yes, this is correct.

I see that you are using Emacs 24.3, which is an official release. =C2=A0I<= br> suspect that this binary has been stripped of debugging symbols, so
you will be unable to debug it on the C source level. =C2=A0So the first thing I suggest to do after installing GDB (let me know if you need a
link for a Windows port of GDB) is type this from the shell prompt:

=C2=A0 gdb /path/to/emacs.exe

If GDB says something like this:

=C2=A0Reading symbols from D:\foo\bar\emacs.exe...(no debugging symbols fou= nd)...done.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ^^^^^^^^^^^^^^^^^^^^^^^^^^
then indeed the binary is stripped. =C2=A0In that case, please download a recent snapshot from here:

=C2=A0 https://sourceforge.net/projects/emacs-bin/files/snap= shots/

and start by verifying that the same problem still exists there. =C2=A0(It<= br> could be that it was somehow fixed since 24.3 was released, although I
doubt that.)

Once you establish that the problem still exists in the snapshot,
here's the sequence of commands I'd like you to perform:

=C2=A0 gdb /path/to/emacs.exe

After GDB starts and displays its startup blurb, do this:

=C2=A0 (gdb) break Fdefault_printer_name
=C2=A0 (gdb) run -Q

The last command runs Emacs. =C2=A0When Emacs starts up, it will show the *scratch* buffer. =C2=A0Type into that buffer:

=C2=A0 (default-printer-name)

Then go to the right parenthesis and type C-j. =C2=A0This evaluates the
expression. =C2=A0(Please forgive me if I'm telling you things you know=
very well.)

When you evaluate that expression, the breakpoint you have set will
break, Emacs will stop, and GDB will take control. =C2=A0Switch to the
window where you run GDB, you should see there something like this:

=C2=A0 Breakpoint 1, Fdefault_printer_name () at w32fns.c:7217
=C2=A0 7217 =C2=A0 =C2=A0 =C2=A0PRINTER_INFO_2 *ppi2 =3D NULL;
=C2=A0 (gdb)

(Since you don't have the sources, you will probably not see the
second line.)

If you want to see the source code of default-printer-name, you can
find it here:

=C2=A0 http://bzr.savannah.gnu.org/lh/emacs/trunk= /annotate/head:/src/w32fns.c

(The function's source starts around line 7210 in that file.)

We want to get to line #7252, which is marked in the snippet below:

=C2=A0 err =3D GetPrinter (hPrn, 2, (LPBYTE)ppi2, dwNeeded, &dwReturned= );
=C2=A0 ClosePrinter (hPrn);
=C2=A0 if (!err)
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 xfree (ppi2);
=C2=A0 =C2=A0 =C2=A0 return Qnil;
=C2=A0 =C2=A0 }

=C2=A0 if (ppi2) =C2=A0<<<<<<<<<<<<<= <<<<<<<<<<<<<<<<
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 if (ppi2->Attributes & PRINTER_ATTRIBUTE_SHARED= && ppi2->pServerName)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {

The GDB command to do that is:

=C2=A0 (gdb) until 7252

(The "(gdb)" part is GDB's prompt, you don't need to type= it.)

GDB will step Emacs till that line, and respond like this:

=C2=A0 Fdefault_printer_name () at w32fns.c:7252
=C2=A0 7252 =C2=A0 =C2=A0 =C2=A0if (ppi2)
=C2=A0 (gdb)

Now please tell GDB to display the contents of the ppi2 structure,
which holds the printer information Windows returned due to the call
to GetPrinter API:

=C2=A0 (gdb) print *ppi2

And post here everything you see.

If you will do this in Emacs 24.3 (in case it does have the debugging
symbols), then please use "until 6943" instead of 7252 above, bec= ause
the source line numbers of the snippet I show above are different in
that version.

Thanks again for your help.

--047d7b2e4c026eb6af04ecf11355--