Data loss with JobID >= 99999 on scheduler restart #371

Closed
michaelrsweet opened this Issue Nov 4, 2003 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Nov 4, 2003

Version: 1.1.18
CUPS.org User: pfournier.loups

After looking at 1.2 CVS, this doesn't seem to have been fixed yet.

Since our JobID has been over 99999, restarting cups make us lose any job (already printed or not) above this treshold.

It seems LoadAllJobs() only load the c##### files when they have a length of exactly 6 chars (c + a 5 digit number) thus not loading all the jobs above 99999. Then, when reading the data files for the jobs with ID above 99999, CUPS believes they are orphaned and deletes them (causing loss of data).

Collaborator

michaelrsweet commented Nov 5, 2003

CUPS.org User: mike

Thanks, try the attached patch which should fix the problem.

This fix will be included in 1.1.20 and 1.2.x.

Collaborator

michaelrsweet commented Nov 5, 2003

CUPS.org User: pfournier.loups

As expected, this fixes the problem.

Thanks!

Collaborator

michaelrsweet commented Nov 5, 2003

"str371.patch":

Index: job.c

RCS file: /development/cvs/cups/scheduler/job.c,v
retrieving revision 1.221
diff -u -r1.221 job.c
--- job.c 15 Sep 2003 19:40:46 -0000 1.221
+++ job.c 5 Nov 2003 19:01:44 -0000
@@ -558,7 +558,7 @@
*/

while ((dent = readdir(dir)) != NULL)

  • if (NAMLEN(dent) == 6 && dent->d_name[0] == 'c')
  • if (NAMLEN(dent) >= 6 && dent->d_name[0] == 'c')
    {
    /*
  • Allocate memory for the job...
    @@ -758,14 +758,14 @@
    rewinddir(dir);

while ((dent = readdir(dir)) != NULL)

  • if (NAMLEN(dent) > 7 && dent->d_name[0] == 'd')

  • if (NAMLEN(dent) > 7 && dent->d_name[0] == 'd' && strchr(dent->d_name, '-'))
    {
    /*

  • Find the job...
    */

    jobid = atoi(dent->d_name + 1);

  •  fileid = atoi(dent->d_name + 7);
    
  •  fileid = atoi(strchr(dent->d_name, '-') + 1);
    

    LogMessage(L_DEBUG, "LoadAllJobs: Auto-typing document file %s...",
    dent->d_name);

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment