8349350: Unable to print using InputSlot and OutputBin print attributes at the same time#23457
8349350: Unable to print using InputSlot and OutputBin print attributes at the same time#23457GennadiyKrivoshein wants to merge 10 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back GennadiyKrivoshein! A progress list of the required criteria for merging this PR into |
|
@GennadiyKrivoshein This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 196 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@prsadhuk, @prrace, @azuev-java) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@GennadiyKrivoshein The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
| if (options != null && !options.isEmpty()) { | ||
| pFlags |= OPTIONS; | ||
| ncomps+=1; | ||
| optionArgs = options.trim().split("\\s+"); |
There was a problem hiding this comment.
In what format the options are expected for this regex to work? Is it same for both linux and mac?
There was a problem hiding this comment.
The format is space delimited values, each value is a "key=value".
There is no difference between Linux and Mac and there are no changes in the format of the options.
There was a problem hiding this comment.
If it's a space delimited values, then can't we use "options.trim().split(" ")"
same as what we have been using below?
There was a problem hiding this comment.
Sure, done.
|
/reviewers 2 reviewer |
| } | ||
| if ((pFlags & OPTIONS) != 0) { | ||
| for (String option : options.trim().split(" ")) { | ||
| if (optionArgs != null) { |
There was a problem hiding this comment.
I see this block is the same in both branches of the if condition. Can we just move it outside the condition to keep it simpler?
There was a problem hiding this comment.
Yes, these are the same blocks, thanks. I moved options after the if condition.
prrace
left a comment
There was a problem hiding this comment.
I notice that UnixPrintJob is even worse .. it would have the same problem except it doesn't even try to iterate over options, even though they can be specified !
I think it makes sense to fix that too.
| OutputBin outputBin = null; | ||
| MediaTray mediaTray = null; | ||
| for (PrintService ps : printServices) { | ||
| Media[] medias = (Media[]) ps. |
There was a problem hiding this comment.
It looks to me as if this loop needs to reset mediaTray = null.
Otherwise if printer 'N' has a mediaTray, printer 'N+1' will inherit it, even if it does not have one.
There was a problem hiding this comment.
Thank you. Fixed.
| pFlags |= OPTIONS; | ||
| ncomps+=1; | ||
| optionArgs = options.trim().split(" "); | ||
| ncomps+=optionArgs.length; |
There was a problem hiding this comment.
I would have gone for the simpler one line fix of
ncomps+=options.trim().split(" ").length
There was a problem hiding this comment.
Done. I tried to avoid using of the options.trim().split(" ") twice.
|
@prrace UnixPrintJob updated. |
| * @test | ||
| * @bug 8349350 | ||
| * @key printer | ||
| * @summary lpr command syntax for options. lpr [ -o option[=value] ] |
There was a problem hiding this comment.
Sure, added @requires (os.family...
| break; | ||
| } | ||
| } | ||
| if (!success) { |
There was a problem hiding this comment.
Maybe it would be more robust to wrap everything in a try block with a finally to restore the printstream.
There was a problem hiding this comment.
Yes, done.
| * @summary lpr command syntax for options. lpr [ -o option[=value] ] | ||
| * @run main/manual/othervm -Dsun.print.ippdebug=true UnixPrintJobOptionsTest | ||
| */ | ||
|
|
There was a problem hiding this comment.
You also made the test manual, yet it has no user interaction. It ought to be enough that you tagged it as a printer test. I'll approve, but maybe it could be reverted to automated ??
I notice that it actually prints - although it is a blank page.
I suppose it has to, in order to get the command line to be used.
|
/integrate |
|
@GennadiyKrivoshein |
|
/sponsor |
|
Going to push as commit 3da5e3f.
Your commit was automatically rebased without conflicts. |
|
@prrace @GennadiyKrivoshein Pushed as commit 3da5e3f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fix for https://bugs.openjdk.org/browse/JDK-8349350. It's impossible to use more that one print option.
Reason of the bug:
execCmd array uses one index per print flag, but 'OPTIONS' flag can use two indexes for the options.
Fix description:
make the size of the execCmd array dependent on the number of options.
Test:
new test PrintExecCmdOptionTest.java created to check execution with multiple options. (run on MacOS, Windows and linux x86_64)
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23457/head:pull/23457$ git checkout pull/23457Update a local copy of the PR:
$ git checkout pull/23457$ git pull https://git.openjdk.org/jdk.git pull/23457/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23457View PR using the GUI difftool:
$ git pr show -t 23457Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23457.diff
Using Webrev
Link to Webrev Comment