Technical article 105000

How does the lp command work in SCO OpenServer Release 5.0?

OpenServer 5.0.0

Written · Last revised

Problem

In previous releases of SCO operating systems, you could print
and then modify or remove the original file and still get the
printout of the original file.  In SCO OpenServer 5.0, if you
modify the original file, the printout may be of the modified file.
If you remove the original file, you may get a printout of this
error:
cat: cannot open /path/filename: No such file or directory (error 2)

Solution

The previous releases of SCO operating systems, by default, used
the -c option of the lp command which meant that lp made a temporary
copy of the original file.  You could print a file, lp would make
a copy, and you could then modify or remove the original and the
copy would print out.
SCO OpenServer 5.0.0 does not use the -c option of the lp command
by default.  This means that no copy of the file is created for the
print process and any subsequent action on the original can be
reflected in the printout.  This may not be a problem, depending
on the sequence of steps taken during printing.
EXAMPLES:

Consider this sequence in previous releases of SCO operating systems:

1. lp largefile 2. lp smallfile 3. rm smallfile

Both 'largefile' and 'smallfile' will print with no problems.

The same sequence of events in SCO OpenServer Release 5 could produce a different result:

1. lp largefile 2. lp smallfile 3. rm smallfile

Largefile will print fine.  But where you expected a printout of
smallfile, the printer may have printed:
cat: cannot open smallfile: No such file or directory (error 2)

In previous releases of SCO operating systems you could do this:

1. lp largefile 2. lp smallfile 3. edit the contents of smallfile

The printout of both largefile and smallfile would be of the
original contents.  The edited version of smallfile would not
print, the original would print.

The same sequence in SCO OpenServer 5 could produce this effect:

1. lp largefile 2. lp smallfile 3. edit the contents of smallfile

The printout of largefile would be fine, but the printout of smallfile could be of the edited version, the original may not be printed.

In previous versions of SCO operating systems you could do this:

1. lp largefile
2. edit largefile

The printout of largefile would be of the original and not the edited version.

The same sequence in SCO OpenServer 5 could produce this effect:

1. lp largefile
2. edit largefile

You will probably see a printout of the edited version of largefile and the original will be lost.

The probability of these events occurring in SCO OpenServer
Release 5.0.0 depend entirely on the amount of time that passes
between the execution of the lp command and any other actions on
the original file.  Because there is no way to determine this time
and because this time factor can be impacted by print speed, system
loads and other performance factors, there is a high probability
that you may see various print results.  You can ensure consistent
print results by creating a simple print script that incorporates
the use of the -c option for lp.

Take these steps to create a print operation that will be consistent with previous releases of SCO operating systems:

1. mv /usr/bin/lp /usr/bin/lp5.0 2. vi /usr/bin/lp CONTENTS OF NEW LP FILE lp5.0 -c $* 3. save the contents of /usr/bin/lp 4. chown bin /usr/bin/lp 5. chgrp lp /usr/bin/lp 6. chmod +x /usr/bin/lp

This basic script will probably work for most print requests, but
if you pass a large number of parameters to your print jobs you
may exceed the number of variables of the shell.  Use this example
as a starting point for your modified lp file, set up and test your
system to determine your requirements.

SCO OpenServer Release 5.0.0 should now perform print jobs with the same results seen in previous releases of SCO operating systems.

You should also be aware that some of your applications from previous
releases of SCO operating systems may fail to print and you may not
see any error messages.  Check for the print line in the application
and try changing the code from "lp filename" to "lp -c filename" to
see if the application will start printing on SCO OpenServer 5.0.0.

This difference in the operation of the lp command has been reported to SCO Engineering.

From the Xinuos technical article database, record 105000. Reproduced with permission. The original is at www.sco.com/ta/105000, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.