Bug 790 - RFE: Xprt should store the output of the spooler command in the "xp-spooler-command-results" resource
Summary: RFE: Xprt should store the output of the spooler command in the "xp-spooler-c...
Status: RESOLVED FIXED
Alias: None
Product: xprint
Classification: Unclassified
Component: Server: Spooler support: Other (show other bugs)
Version: unspecified
Hardware: All All
: high enhancement
Assignee: Roland Mainz
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 789
Blocks: 2960
  Show dependency treegraph
 
Reported: 2004-06-22 03:06 UTC by Roland Mainz
Modified: 2005-05-02 16:48 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Prototype patch (11.60 KB, patch)
2005-04-04 18:02 UTC, Roland Mainz
no flags Details | Splinter Review
Prototype patch (working) (60.06 KB, patch)
2005-04-08 14:29 UTC, Roland Mainz
no flags Details | Splinter Review
Snapshot 2005-04-08 (81.04 KB, patch)
2005-04-09 02:42 UTC, Roland Mainz
no flags Details | Splinter Review
Snapshot 2005-04-09 (88.92 KB, patch)
2005-04-09 19:48 UTC, Roland Mainz
no flags Details | Splinter Review
Patch for 2005-04-10-trunk (91.55 KB, patch)
2005-04-10 18:03 UTC, Roland Mainz
no flags Details | Splinter Review

Description Roland Mainz 2004-06-22 03:06:24 UTC
RFE: Xprt should store the output of the spooler comment in the
"xp-spooler-command-results" resource as described in the original CDE Xprint
specification.
Comment 1 Roland Mainz 2004-06-22 03:07:38 UTC
s/comment/command/
Comment 2 Roland Mainz 2004-06-24 17:09:00 UTC
I found a small problem while working on the patch:
The output from the print command may contain random characters like '"', '\'',
'#', '\\' etc. - we need a function which escapes the strings before they get
merged into the resource pool. Does anyone know a function which does that job ?
Comment 3 Roland Mainz 2005-04-04 18:02:00 UTC
Created attachment 2334 [details] [review]
Prototype patch

Prototype patch.

Unfortunately there is a weired problem:
When printing with Mozilla the function |Tailf()| in attributes.c correctly
causes the Xprt server to print all output from the spooler command to stderr
(fd=2), however when I am using the "xphelloworld" sample applicatation the
output is _not_ send to stderr.
Either this is some kind of race condition or something else (maybe it's
Linux-specific ?!). In both cases the xp-spooler-command-results resource is
set correctly.
Comment 4 Roland Mainz 2005-04-04 19:14:37 UTC
(In reply to comment #3)
> Created an attachment (id=2334) [edit]
> Prototype patch
> 
> Prototype patch.
> 
> Unfortunately there is a weired problem:
> When printing with Mozilla the function |Tailf()| in attributes.c correctly
> causes the Xprt server to print all output from the spooler command to stderr
> (fd=2), however when I am using the "xphelloworld" sample applicatation the
> output is _not_ send to stderr.
> Either this is some kind of race condition or something else (maybe it's
> Linux-specific ?!).

Small update: The issue isn't Linux-specfic, the same problem happens when
"Xprt" is running on Solaris 8, too: Mozilla causes the Xprt server to print the
spooler command output to stderr but "xphelloworld" does not - which is a
complete mystery for me as the issue seems to be only client-specific ("Mozilla
1.8" vs. "xphelloworld") and not depend on OS, used network protocol (unix
socket, network etc.) or something else.
Comment 5 Roland Mainz 2005-04-08 14:29:36 UTC
Created attachment 2357 [details] [review]
Prototype patch (working)

The new prototype patch fixes the original problem which was a simple race
condition between Xprt main process and fork()'ed spooler child - file
descriptors duplicated using |dup()| and |fork()| still share the same file
pointer in the kernel which includes attributes like the current file position
- and that screwed up the whole thing (many thanks for the folks in
irc://freenode/#solaris who pointed that issue out, I totally forgot about this
little detail in Unix fork() after all the years...)
Comment 6 Roland Mainz 2005-04-09 02:42:41 UTC
Created attachment 2361 [details] [review]
Snapshot 2005-04-08

More or less complete snapshot. Missing items are:
- Xprt should capture stderr (fd=2), too - however "valgrind" then bites when
it sends it's output to stderr, too
- "xlogo"&co. needs to be updated
Comment 7 Roland Mainz 2005-04-09 19:48:06 UTC
Created attachment 2369 [details] [review]
Snapshot 2005-04-09

More or less final patch, just needs to be proofread once I am awake
Comment 8 Roland Mainz 2005-04-10 18:03:53 UTC
Created attachment 2379 [details] [review]
Patch for 2005-04-10-trunk

Final patch (mainly indentical to attachment #2369 [details] [review] except one comment and the
Changelog diff)
Comment 9 Roland Mainz 2005-04-10 18:11:55 UTC
Patch checked-in into Xorg trunk...

/cvs/xorg/xc/ChangeLog,v  <--  xc/ChangeLog
new revision: 1.864; previous revision: 1.863
/cvs/xorg/xc/programs/Xserver/Xprint/attributes.c,v  <-- 
xc/programs/Xserver/Xprint/attributes.c
new revision: 1.9; previous revision: 1.8
/cvs/xorg/xc/programs/glxgears/glxgears.c,v  <-- 
xc/programs/glxgears/glxgears.c
new revision: 1.11; previous revision: 1.10
/cvs/xorg/xc/programs/xdbedizzy/xdbedizzy.c,v  <-- 
xc/programs/xdbedizzy/xdbedizzy.c
new revision: 1.3; previous revision: 1.2
/cvs/xorg/xc/programs/xedit/Imakefile,v  <--  xc/programs/xedit/Imakefile
new revision: 1.7; previous revision: 1.6
/cvs/xorg/xc/programs/xedit/Xedit-xprint.ad,v  <-- 
xc/programs/xedit/Xedit-xprint.ad
new revision: 1.3; previous revision: 1.2
/cvs/xorg/xc/programs/xedit/util.c,v  <--  xc/programs/xedit/util.c
new revision: 1.4; previous revision: 1.3
/cvs/xorg/xc/programs/xedit/xedit.h,v  <--  xc/programs/xedit/xedit.h
new revision: 1.6; previous revision: 1.5
/cvs/xorg/xc/programs/xlogo/print.c,v  <--  xc/programs/xlogo/print.c
new revision: 1.3; previous revision: 1.2
/cvs/xorg/xc/programs/xlogo/xlogo.c,v  <--  xc/programs/xlogo/xlogo.c
new revision: 1.7; previous revision: 1.6
/cvs/xorg/xc/programs/xlogo/xlogo.h,v  <--  xc/programs/xlogo/xlogo.h
new revision: 1.2; previous revision: 1.1
/cvs/xorg/xc/programs/xman/Imakefile,v  <--  xc/programs/xman/Imakefile
new revision: 1.7; previous revision: 1.6
/cvs/xorg/xc/programs/xman/print.h,v  <--  xc/programs/xman/print.h
new revision: 1.3; previous revision: 1.2
/cvs/xorg/xc/programs/xmore/Imakefile,v  <--  xc/programs/xmore/Imakefile
new revision: 1.3; previous revision: 1.2
/cvs/xorg/xc/programs/xmore/print.c,v  <--  xc/programs/xmore/print.c
new revision: 1.7; previous revision: 1.6
/cvs/xorg/xc/programs/xmore/print.h,v  <--  xc/programs/xmore/print.h
new revision: 1.5; previous revision: 1.4
/cvs/xorg/xc/programs/xmore/printdialog.c,v  <-- 
xc/programs/xmore/printdialog.c
new revision: 1.6; previous revision: 1.5
/cvs/xorg/xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c,v  <-- 
xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c
new revision: 1.5; previous revision: 1.4
/cvs/xorg/xc/programs/xphelloworld/xphelloworld/xphelloworld.c,v  <-- 
xc/programs/xphelloworld/xphelloworld/xphelloworld.c
new revision: 1.4; previous revision: 1.3
/cvs/xorg/xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c,v 
<--  xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c
new revision: 1.4; previous revision: 1.3
/cvs/xorg/xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c,v  <-- 
xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c
new revision: 1.4; previous revision: 1.3
/cvs/xorg/xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c,v  <-- 
xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c
new revision: 1.4; previous revision: 1.3
Mailing the commit message to xorg-commit@lists.freedesktop.org...

... marking bug as FIXED:
Comment 10 Roland Mainz 2005-04-10 18:37:49 UTC
I filed bug 2960 ("Spooler command output stored in "xp-spooler-command-results"
job attr has the wrong encoding (local encoding instead of COMPOUND_TEXT)") to
deal with the issue that the output stored in the "xp-spooler-command-results"
has the wrong encoding.
Comment 11 Kean Johnston 2005-05-03 09:48:08 UTC
Just FYI, using pread() now breaks the SCO build, whose libc doesn't have it. I
cant point you to them but I bet that some other older systems dont have pread()
either. Is there a way to address this that doesn't involve pread()? I grep of
the source tree indicates that this is the only program in the entire tree that
uses it.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.