Hugo reported the following bug in apsfilter (v. 5.1): 3) when printing with lpr -Pauto temporary files in /tmp never seem to be removed. The reason is that the trap lines in file /usr/share/apsfilter/bin/apsfilter do not seem to be working. The relevant lines are # # Ignore hangup, keyboard interrupt, quit from keyboard, and broken pipes. # Other signals for abort and on exit we should remove our temp file # trap "echo" SIGHUP SIGINT SIGQUIT SIGPIPE trap "rm -f $TMP_PRINTOUT $APS_HEADER $TMP_FILE $TMP_FILE2" \ EXIT SIGTRAP SIGBUS SIGKILL \ SIGUSR1 SIGUSR2 SIGTERM I dont know why this line fails but the second last line in the apsfilter file is rm ${APS_HEADER} so I suspect failure to delete tmp files is a common problem. The fix I implemented here is to add the lines rm -f ${TMP_PRINTOUT} rm -f ${TMP_FILE} rm -f ${TMP_FILE2} after the rm ${APS_HEADER} line to explicitly remove all temp files. As an added note perhaps the trap is failing on my machine because I have my /tmp mounted as a separate partition with the hardened /etc/fstab options /dev/hdc6 /tmp ext2 defaults,errors=remount-ro,rw,nosuid,nodev,noexec 0 1
Turns out there was a trap in print_ascii_a2ps that was overriding the top-level trap. I removed this trap and moved the temporary file removal to the top-level trap. With this change, the need to have an explicit removal of APS_HEADER (mentioned in the workaround above) is no longer necessary. Here is the patch: cd /usr/share/apsfilter/bin/ diff -u /usr/share/apsfilter/bin/apsfilter- /usr/share/apsfilter/bin/apsfilter --- /usr/share/apsfilter/bin/apsfilter- Thu Jan 13 08:21:36 2000 +++ /usr/share/apsfilter/bin/apsfilter Wed Mar 7 15:06:22 2001 @@ -62,13 +62,14 @@ APS_HEADER=`tempfile` || exit 1 TMP_FILE=`tempfile` || exit 1 TMP_FILE2=`tempfile` || exit 1 +LPRNG_CF=`tempfile` || exit 1 # # Ignore hangup, keyboard interrupt, quit from keyboard, and broken pipes. # Other signals for abort and on exit we should remove our temp file # trap "echo" SIGHUP SIGINT SIGQUIT SIGPIPE -trap "rm -f $TMP_PRINTOUT $APS_HEADER $TMP_FILE $TMP_FILE2" \ +trap "rm -f $TMP_PRINTOUT $APS_HEADER $TMP_FILE $TMP_FILE2 $LPRNG_CF" \ EXIT SIGTRAP SIGBUS SIGKILL \ SIGUSR1 SIGUSR2 SIGTERM @@ -465,10 +466,8 @@ # get job, user and host ... if [ ! -z "$CONTROL" ]; then - # for LPRng - CF=`tempfile` || exit 1 - trap "rm -f $CF" 0 1 9 15 - echo "$CONTROL" > $CF + echo "$CONTROL" > $LPRNG_CF + CF=$LPRNG_CF else # for Berkeley lpr SPOOL_DIR=`dirname ${ACCTFILE}` @@ -1253,6 +1252,4 @@ esac ;; esac - - rm ${APS_HEADER} fi Diff finished at Wed Mar 7 15:06:42 -- Bill Wohler <[EMAIL PROTECTED]> http://www.newt.com/wohler/ GnuPG ID:610BD9AD Maintainer of comp.mail.mh FAQ and mh-e. Vote Libertarian! If you're passed on the right, you're in the wrong lane.