[PATCH] Checking integrity of installed packages in cygcheck
Igor Pechtchanski
pechtcha@cs.nyu.edu
Sat Aug 9 19:52:00 GMT 2003
On Sat, 9 Aug 2003, Christopher Faylor wrote:
> On Sat, Aug 09, 2003 at 12:29:39PM -0400, Christopher Faylor wrote:
> >On Sat, Aug 09, 2003 at 12:12:11PM -0400, Christopher Faylor wrote:
> >>On Thu, Aug 07, 2003 at 06:50:10PM -0400, Igor Pechtchanski wrote:
> >>>Hi,
> >>>
> >>>This patch adds most of the capability of the script from
> >>><http://cygwin.com/ml/cygwin-apps/2003-08/msg00106.html> to cygcheck.
> >>>It is triggered by the "-c" flag to cygcheck. "Integrity" is a rather
> >>>strong word, actually, as all this checks for is the existence of files
> >>>and directories, but this could be further built upon (for example, tar
> >>>has a diff option that could be useful). The patch is against cvs HEAD
> >>>with my previous micropatch
> >>>(<http://cygwin.com/ml/cygwin-patches/2003-q3/msg00058.html>) applied.
> >>>Comments and suggestions welcome.
> >>
> >>I'm getting some odd errors when I apply this patch:
> >>
> >>"4NT: Unknown command f:"
> >>
> >>(as you can see I use 4NT).
> >>
> >>I haven't had time to debug where these are coming from but I get one
> >>for every file displayed.
> >
> >The enclosed patch fixes that.
> >
> >I'll check this in but it would be nice if (WBNI) this used a mingw gzip
> >library rather than calling gzip directly. That's a fair amount of
> >work but I could resurrect the zlib library in winsup if necessary.
> >
> >I wonder why setup is using gzip rather than bzip2 for the package files...
>
> On checking this patch a little further, I see that it gives a
> misleading "OK" when the package file is missing. Could you detect
> that case?
>
> cgf
Yes. The attached patch (against the initial one applied) does just that.
Igor
==============================================================================
ChangeLog:
2003-08-09 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* dump_setup.cc (dump_setup): Check for the existence
of the package list file.
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
-------------- next part --------------
--- dump_setup.cc~ 2003-08-07 18:40:22.000000000 -0400
+++ dump_setup.cc 2003-08-09 15:48:16.000000000 -0400
@@ -238,11 +238,17 @@ static bool
check_package_files (int verbose, char *package)
{
bool result = true;
- char filelist[4096] = " -dc /etc/setup/";
+ char filelist[4096] = "etc/setup/";
strcat(strcat(filelist, package), ".lst.gz");
+ if (!file_exists(false, filelist, NULL, NULL))
+ {
+ if (verbose)
+ printf ("Missing file list /%s for package %s\n", filelist, package);
+ return false;
+ }
char *zcat = cygpath("/bin/gzip.exe", NULL);
char command[4096];
- strcat(strcpy(command, zcat), filelist);
+ strcat(strcat(strcpy(command, zcat), " -dc /"), filelist);
FILE *fp = popen (command, "rt");
char buf[4096];
while (fgets (buf, 4096, fp))
More information about the Cygwin-patches
mailing list