Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #244901 > unrolled thread

Printing lots of pages skips a few

Started byPankaj Jangid <pankaj@codeisgreat.org>
First post2022-02-01 10:40 +0100
Last post2022-02-03 05:50 +0100
Articles 11 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-01 10:40 +0100
    Re: Printing lots of pages skips a few Greg Wooledge <greg@wooledge.org> - 2022-02-01 13:30 +0100
      Re: Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-01 18:20 +0100
        Re: Printing lots of pages skips a few Greg Wooledge <greg@wooledge.org> - 2022-02-01 19:10 +0100
          Re: Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-02 11:50 +0100
        Re: Printing lots of pages skips a few Klaus Singvogel <deb-user-ml@singvogel.net> - 2022-02-01 21:40 +0100
          Re: Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-02 11:50 +0100
            Re: Printing lots of pages skips a few Curt <curty@free.fr> - 2022-02-02 15:00 +0100
            Re: Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-03 05:50 +0100
      Re: Printing lots of pages skips a few David Wright <deblis@lionunicorn.co.uk> - 2022-02-02 18:10 +0100
        Re: Printing lots of pages skips a few Pankaj Jangid <pankaj@codeisgreat.org> - 2022-02-03 05:50 +0100

#244901 — Printing lots of pages skips a few

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-01 10:40 +0100
SubjectPrinting lots of pages skips a few
Message-ID<DLXNL-7lF-1@gated-at.bofh.it>
I tried to print ~40 pages using the following combination of commands:

find . -name "pref***.pdf" | xargs lp

The result was that a couple of pages were missed. I tried this four
times with different set of files. The number of skipped pages is not
fixed but it was around 5 pages. That makes it roughly 10%.

The printer is Samsung ML-2161.

Have anyone else faced this issue? Or anyone knows hows to fix this? It
is cumbersome to verify big bunches of papers every time I print.

--8<---------------cut here---------------start------------->8---
pankaj@anant:~$ uname -a
Linux anant 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18) x86_64 GNU/Linux
pankaj@anant:~$ cat /etc/debian_version 
11.2
--8<---------------cut here---------------end--------------->8---

Regards ~Pankaj

[toc] | [next] | [standalone]


#244907

FromGreg Wooledge <greg@wooledge.org>
Date2022-02-01 13:30 +0100
Message-ID<DM0sh-Di-3@gated-at.bofh.it>
In reply to#244901
On Tue, Feb 01, 2022 at 03:04:06PM +0530, Pankaj Jangid wrote:
> I tried to print ~40 pages using the following combination of commands:
> 
> find . -name "pref***.pdf" | xargs lp
> 
> The result was that a couple of pages were missed.

That command is fundamentally broken.  It will fail if any of the
matching filenames contain whitespace, single quotes or double quotes.

A correct version would be:

find . -name "pref*.pdf" -exec lp {} +

That's the preferred one.  If you're really old-fashioned and just cannot
live without xargs, the first thing you must realize is that POSIX xargs
is fundamentally incapable of doing this correctly.  GNU xargs has a -0
extension, though, which makes it possible:

find . -name "pref*.pdf" -print0 | xargs -0 lp

That one is acceptable, albeit longer, less efficient and less portable.

[toc] | [prev] | [next] | [standalone]


#244918

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-01 18:20 +0100
Message-ID<DM4YV-3qO-1@gated-at.bofh.it>
In reply to#244907
Greg Wooledge <greg@wooledge.org> writes:

> On Tue, Feb 01, 2022 at 03:04:06PM +0530, Pankaj Jangid wrote:
>> I tried to print ~40 pages using the following combination of commands:
>> 
>> find . -name "pref***.pdf" | xargs lp
>> 
>> The result was that a couple of pages were missed.
>
> That command is fundamentally broken.  It will fail if any of the
> matching filenames contain whitespace, single quotes or double quotes.
>
> A correct version would be:
>
> find . -name "pref*.pdf" -exec lp {} +
>
> That's the preferred one.  If you're really old-fashioned and just cannot
> live without xargs, the first thing you must realize is that POSIX xargs
> is fundamentally incapable of doing this correctly.  GNU xargs has a -0
> extension, though, which makes it possible:
>
> find . -name "pref*.pdf" -print0 | xargs -0 lp
>
> That one is acceptable, albeit longer, less efficient and less portable.

Thanks for this brief course, Greg. I really liked it.

In my case though, I had verified that the output of find is okay for
xargs. Then I added | xargs lp.

But could this be cause of missing page. The output of find is:

--8<---------------cut here---------------start------------->8---
2018/letters/060718I049905433.pdf
2018/letters/250518I049904099.pdf
2018/letters/150918I049901510.pdf
2018/letters/180518I049903135.pdf
2018/letters/180518I049902524.pdf
2018/letters/191018I049905432.pdf
2018/letters/300718I049902173.pdf
2018/letters/141218I049903816.pdf
2018/letters/261018I049903737.pdf
2018/letters/290618I049904628.pdf
2018/letters/190718I049902138.pdf
2018/letters/230718I049900093.pdf
2018/letters/030818I049903843.pdf
2018/letters/190118I049901374.pdf
2018/letters/150618I049903232.pdf
2018/letters/281218I049903776.pdf
2018/letters/190118I049901373.pdf
2018/letters/240818I049904062.pdf
2018/letters/121218I049903419.pdf
2018/letters/201118I049900883.pdf
2018/letters/021118I049904149.pdf
2018/letters/111018I049901537.pdf
2018/letters/270718I049903199.pdf
2018/letters/211218I049904184.pdf
2018/letters/180518I049902534.pdf
2018/letters/261118I049905674.pdf
2018/letters/210918I049902234.pdf
2018/letters/210918I049906208.pdf
2018/letters/230818I049902830.pdf
2018/letters/150518I049903258.pdf
2018/letters/261018I049903715.pdf
2018/letters/100918I049902331.pdf
2018/letters/180818I049904319.pdf
2018/letters/110518I049903217.pdf
2018/letters/290118I049905290.pdf
2018/letters/121018I049903705.pdf
2018/letters/170518I049901548.pdf
2018/letters/180818I049904094.pdf
2018/letters/191218I049901286.pdf
2018/letters/101018I049905261.pdf
2018/letters/021118I049904059.pdf
2018/letters/060118I049902467.pdf
2018/letters/150618I049903254.pdf
2018/letters/110518I049903022.pdf
2018/letters/270718I049903443.pdf
2018/letters/240818I049904852.pdf
2018/letters/210918I049906209.pdf
2018/letters/300518I049903175.pdf
2018/letters/280918I049901364.pdf
2018/letters/140918I049906491.pdf
2018/letters/010618I049902892.pdf
2018/letters/060618I049904019.pdf
2018/letters/070918I049903663.pdf
2018/letters/301118I049903918.pdf
2018/letters/261018I049901520.pdf
--8<---------------cut here---------------end--------------->8---

six of them were not printed.

Regards ~Pankaj

[toc] | [prev] | [next] | [standalone]


#244924

FromGreg Wooledge <greg@wooledge.org>
Date2022-02-01 19:10 +0100
Message-ID<DM5Lk-3WI-9@gated-at.bofh.it>
In reply to#244918
On Tue, Feb 01, 2022 at 10:42:31PM +0530, Pankaj Jangid wrote:
> Greg Wooledge <greg@wooledge.org> writes:
> > A correct version would be:
> >
> > find . -name "pref*.pdf" -exec lp {} +

> Thanks for this brief course, Greg. I really liked it.
> 
> In my case though, I had verified that the output of find is okay for
> xargs. Then I added | xargs lp.
> 
> But could this be cause of missing page. The output of find is:
> 
> --8<---------------cut here---------------start------------->8---
> 2018/letters/060718I049905433.pdf
> 2018/letters/250518I049904099.pdf
> 2018/letters/150918I049901510.pdf
[..]

OK.  Then there must be something else wrong.

I can't help noticing that none of your filenames begin with "pref",
so none of them actually match the -name pattern that's being given
to find.  One of the obvious ways you could experience this problem
is that the "missing" files don't match the pattern you're using.

Beyond that, perhaps some of the files are empty (either literally
zero bytes, or they contain only "comments" or metadata that doesn't
cause the generation of images using ink on paper when printed).

Or... the files aren't readable due to permissions.  Or they're not in
the directories you think they're in.

Can you identify *which* files aren't being visibly printed?  By process
of elimination, you should be able to find out.  Pick one of them, and
analyze the situation.  If it's not an issue with the name, location or
permissions, then try to open it with a PDF viewer.  If it opens correctly,
try printing it with "lp".

[toc] | [prev] | [next] | [standalone]


#244947

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-02 11:50 +0100
Message-ID<DMln3-4ZL-3@gated-at.bofh.it>
In reply to#244924
Greg Wooledge <greg@wooledge.org> writes:

> I can't help noticing that none of your filenames begin with "pref",
> so none of them actually match the -name pattern that's being given
> to find.  One of the obvious ways you could experience this problem
> is that the "missing" files don't match the pattern you're using.

That "pref" was just an example in the original post. I none of the
files bypassed the pattern.

> Beyond that, perhaps some of the files are empty (either literally
> zero bytes, or they contain only "comments" or metadata that doesn't
> cause the generation of images using ink on paper when printed).
>
> Or... the files aren't readable due to permissions.  Or they're not in
> the directories you think they're in.
>
> Can you identify *which* files aren't being visibly printed?  By process
> of elimination, you should be able to find out.  Pick one of them, and
> analyze the situation.  If it's not an issue with the name, location or
> permissions, then try to open it with a PDF viewer.  If it opens correctly,
> try printing it with "lp".

I could identify and print those files separately later, using "lp
<filename>" command.

[toc] | [prev] | [next] | [standalone]


#244935

FromKlaus Singvogel <deb-user-ml@singvogel.net>
Date2022-02-01 21:40 +0100
Message-ID<DM86v-5dV-23@gated-at.bofh.it>
In reply to#244918
Pankaj Jangid wrote:
> 
> In my case though, I had verified that the output of find is okay for
> xargs. Then I added | xargs lp.
> 
> But could this be cause of missing page. The output of find is:
> 
> --8<---------------cut here---------------start------------->8---
[...]
> --8<---------------cut here---------------end--------------->8---
> 
> six of them were not printed.

Can you look at the webinterface of CUPS regarding the missing jobs?

	http://localhost:631/

-> Printer -> select your default printer (if more) -> finish job (or similar)

Regards,
	Klaus.
-- 
Klaus Singvogel
GnuPG-Key-ID: 1024R/5068792D  1994-06-27

[toc] | [prev] | [next] | [standalone]


#244948

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-02 11:50 +0100
Message-ID<DMln3-4ZL-11@gated-at.bofh.it>
In reply to#244935
Klaus Singvogel <deb-user-ml@singvogel.net> writes:

> Can you look at the webinterface of CUPS regarding the missing jobs?
>
> 	http://localhost:631/
>
> -> Printer -> select your default printer (if more) -> finish job (or
> similar)

I did that when I discovered that some pages were missing. Nothing there
in unfinished jobs.

Also I could identify and print those files separately; using "lp
<filename>".

Regards ~Pankaj

[toc] | [prev] | [next] | [standalone]


#244952

FromCurt <curty@free.fr>
Date2022-02-02 15:00 +0100
Message-ID<DMokW-6L5-7@gated-at.bofh.it>
In reply to#244948
On 2022-02-02, mick crane <mick.crane@gmail.com> wrote:
>> 
>> Also I could identify and print those files separately; using "lp
>> <filename>".
>
> May be an issue with the printer reporting it has printed file when it 
> hasn't.  Perhaps try wait between each print instruction.

It would be edifying to examine, at the very least, the actual command
used rather than the substituted "example" command given (for reasons
which escape your corresondant), as well as a list of the files that
failed to print.


> mick
>

[toc] | [prev] | [next] | [standalone]


#244985

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-03 05:50 +0100
Message-ID<DMCee-6Jm-1@gated-at.bofh.it>
In reply to#244948
mick crane <mick.crane@gmail.com> writes:

> May be an issue with the printer reporting it has printed file when it
> hasn't.
> Perhaps try wait between each print instruction.
>

This could be one reason. But I am not sure how to diagnose
this. Perhaps the procedure suggested by David is a good starting point.

Regards ~Pankaj

[toc] | [prev] | [next] | [standalone]


#244969

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2022-02-02 18:10 +0100
Message-ID<DMriP-j7-15@gated-at.bofh.it>
In reply to#244907
On Tue 01 Feb 2022 at 07:29:09 (-0500), Greg Wooledge wrote:
> On Tue, Feb 01, 2022 at 03:04:06PM +0530, Pankaj Jangid wrote:
> > I tried to print ~40 pages using the following combination of commands:
> > 
> > find . -name "pref***.pdf" | xargs lp
> > 
> > The result was that a couple of pages were missed.
> 
> That command is fundamentally broken.  It will fail if any of the
> matching filenames contain whitespace, single quotes or double quotes.
> 
> A correct version would be:
> 
> find . -name "pref*.pdf" -exec lp {} +
> 
> That's the preferred one.  If you're really old-fashioned and just cannot
> live without xargs, the first thing you must realize is that POSIX xargs
> is fundamentally incapable of doing this correctly.  GNU xargs has a -0
> extension, though, which makes it possible:
> 
> find . -name "pref*.pdf" -print0 | xargs -0 lp
> 
> That one is acceptable, albeit longer, less efficient and less portable.

(… goes off to check .bashrc, and comes back …)

I find frequent use of xargs, and they're almost all on account of

needing  …  -print0 | LC_ALL=C sort -z | xargs -0 …  (± the locale).

And in the OP's case, this might save a little effort, because my
next step in the investigation would be to check the files in
/var/spool/cups/c* to make sure that all the files had actually
been queued. If so, what does each file report as happening.
(The files are timestamped, so their later repeat printings can
be discounted.)

The OP might want to sort on date and/or sequence number if they
were going to bother to sort at all. The sort options are
complicated a little by the choice of ddmmyy, rather than yymmdd,
for the date field.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#244986

FromPankaj Jangid <pankaj@codeisgreat.org>
Date2022-02-03 05:50 +0100
Message-ID<DMCee-6Jm-7@gated-at.bofh.it>
In reply to#244969
David Wright <deblis@lionunicorn.co.uk> writes:

> And in the OP's case, this might save a little effort, because my
> next step in the investigation would be to check the files in
> /var/spool/cups/c* to make sure that all the files had actually
> been queued. If so, what does each file report as happening.
> (The files are timestamped, so their later repeat printings can
> be discounted.)
>
> The OP might want to sort on date and/or sequence number if they
> were going to bother to sort at all. The sort options are
> complicated a little by the choice of ddmmyy, rather than yymmdd,
> for the date field.
>

Thanks for these pointers, David. Today I am travelling. Tomorrow, I’ll
definitely diagnose using the procedure outlined by you.

Regards ~Pankaj

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web