Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

michaelrsweet opened this issue Nov 4, 2003 · 3 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

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).

@michaelrsweet
Copy link
Collaborator Author

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.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: pfournier.loups

As expected, this fixes the problem.

Thanks!

@michaelrsweet
Copy link
Collaborator Author

"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);

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

No branches or pull requests

1 participant