Thanks for the bug report Joachim. Attached is a patch that appears to fix this bug. I've tested it both with and without recursion (-r option). Please feel free to test it and let me know if it works to your satisfaction.
Cheers, Ryan PS: Git packaging branch containing the patch: git://git.debian.org/users/ryanakca-guest/lintex.git -- |_)|_/ Ryan Kavanagh | GnuPG key | \| \ http://ryanak.ca/ | 4A11C97A (Transitioning from E95EDDC9) () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Ol qrpelcgvat guvf zrffntr lbh ner va ivbyngvba bs gur QZPN!
# 04_dont_delete_readonly.diff by Ryan Kavanagh <ryana...@kubuntu.org> # Description: Don't delete readonly temporary files. Closes # http://bugs.debian.org/588777 Index: lintex/lintex.c =================================================================== --- lintex.orig/lintex.c 2010-07-12 09:31:33.670280260 -0400 +++ lintex/lintex.c 2010-07-12 15:32:58.942282007 -0400 @@ -7,6 +7,8 @@ | WWW: http://wwwcdf.pd.infn.it/~loreti/mlo.html | *------------------------------------------------------* + Copyright (C) 2010 Ryan Kavanagh <ryana...@kubuntu.org> + $Id: lintex.c,v 1.6 2006/09/11 12:47:38 loreti Exp $ @@ -39,6 +41,7 @@ cleanup. 1.05 - 2001-12-02 , linked list structure optimized. 1.06 - 2002-09-25 , added .pdf extension. + 2010-07-11 , don't delete read only files ---------------------------------------------------------------------*/ @@ -51,6 +54,7 @@ #include <string.h> #include <time.h> #include <ctype.h> +#include <unistd.h> #include <sys/types.h> /* Unix proper */ #include <sys/stat.h> @@ -93,6 +97,7 @@ typedef struct sFnode { time_t mTime; struct sFnode *next; + int write; char name[1]; } Fnode; @@ -138,7 +143,7 @@ static Froot *buildTree(char *, Froot *); static void clean(char *); static void examineTree(Froot *, char *); -static void insertNode(char *, size_t, time_t, Froot *); +static void insertNode(char *, size_t, time_t, int, Froot *); static void noMemory(void); static void nuke(char *); static void releaseTree(Froot *); @@ -196,7 +201,7 @@ strcpy(bExt, *argv); to_bExt = FALSE; } else { - insertNode(*argv, 0, 0, dirNames); + insertNode(*argv, 0, 0, 0, dirNames); } } } @@ -231,6 +236,7 @@ char *name, size_t lName, time_t mTime, + int write, Froot *root ){ @@ -253,6 +259,7 @@ noMemory(); } pFN->mTime = mTime; + pFN->write = write; pFN->next = 0; if (lName == 0) { @@ -403,7 +410,7 @@ #endif /* FULLDEBUG */ if (recurse) { - insertNode(tName, 0, 0, subDirs); + insertNode(tName, 0, 0, 0, subDirs); } continue; } @@ -433,7 +440,7 @@ for (pTT = teXTree; pTT->extension != 0; pTT++) { if (strcmp(pFe, pTT->extension) == 0) { - insertNode(pDe->d_name, nameLen, sStat.st_mtime, pTT); + insertNode(pDe->d_name, nameLen, sStat.st_mtime, access(tName, W_OK), pTT); #ifdef FULLDEBUG printf(" - inserted in tree"); @@ -536,7 +543,14 @@ pComp->name[0] = '\0'; if (difftime(pComp->mTime, pTeX->mTime) > 0.0) { - nuke(cName); + if (pComp->write == 0) { + nuke(cName); + } else { +#ifdef FULLDEBUG + printf("*** %s readonly; perms are %d***\n", cName, pComp->write); +#endif /* FULLDEBUG */ + printf("*** %s not removed; it is read only ***\n", cName); + } } else { printf("*** %s not removed; %s is newer ***\n", cName, tName); }
signature.asc
Description: Digital signature