Index: [Article Count Order] [Thread]

Date:  Thu, 23 Feb 2006 23:23:38 -0500
From:  "Brian N. Smith" <brian (at mark) nuonce.net>
Subject:  [coba-e:04158] Re: Use of uninitialized value, Quota? <= SOLUTION
To:  <coba-e (at mark) bluequartz.org>
Message-Id:  <002801c638fa$16616960$fe00a8c0 (at mark) nuonce.net>
References:  <004601c638c2$04b0e2f0$0301a8c0@Jerrycp>
X-Mail-Count: 04158

This is a bug related to BlueQuartz.  It appears when you remove a virtual 
site, it may not be deleted 100%.  I do NOT know if it only effects the CD 
available from my website, or if it effects everyone no matter how they 
installed.  Down at the bottom shows how to fix it though.

Use of uninitialized value in subroutine entry at 
/usr/sausalito/swatch/bin/am_disk.pl
line 410, <GEN2> line 25.

This is because $gid is NULL, it has no value.  I tracked that down to this 
line:

my ($name, $null, $gid) = getgrnam($site);

Now, it should return $name & $gid ... $name should be the same as $site, 
and $gid is the Group ID.  Problem though is that the $site no longer 
exists, but still shows up.  Which made me think, WTF?

So, I tracked $site down to:

foreach my $site (@some_sites) {

Which took me too

@some_sites = grep !/^\./, readdir(HASH);

Which finally showed me this line

opendir(HASH, $hash);

So, I capture the output of $hash, which is nothing more then;

hash - /home/.sites/33
hash - /home/.sites/85
hash - /home/.sites/70
hash - /home/.sites/64
hash - /home/.sites/132
hash - /home/.sites/28
hash - /home/.sites/106

Which, as we all know is just the way that Sausalito stores Virtual sites. 
Well, back to the problem. Long story short, it looks inside the "$hash" 
(directory) for additional directories.  Well, each sub directory then looks 
like so;

[root (at mark) mail bin]# ls -l /home/.sites/132
total 8
drwxrwsr-x  7 nobody site12 4096 Feb 11 04:06 site12
drwxrwsr-x  7 nobody    522 4096 Feb 16 04:06 site21

As you see, that is where the "$site" comes from ...  Now the problem here 
is that the contents of "site21" should NOT be there anymore.  I looked in 
/home/sites, and there isn't any reference to a site21.  I also looked in 
the /var/db/group.db file (fyi, to see that file, do this: strings 
/var/db/group.db).  site21 is NOT there.  Which tells me that the virtual 
site got removed,  BUT, it didn't get deleted.

Solutions.

1) - Fix the "vsite_destroy.pl" file and make sure it deletes the "basedir" 
for virtual site.
2) - Write a quick "hack" into the am_disk.pl that checks if $gid is NULL or 
not.

            # do query
 if ( $gid ) {
              my ($used, $quota) = Quota::query($dev, $gid, $is_group);

              if (! defined $quota || $quota == 0) {
                # no quota set
                $DEBUG && print "no quota set on $name, skipping\n";
                next;
              }

              if ($used > $quota) {
                $DEBUG && print "$name is over quota. used $used of 
$quota\n";
                push @sites_over_quota, $name;
              } else {
                $DEBUG && print "$name is NOT over quota.\n";
              }
}

You add this line:
   if ( $gid ) {

Then add this
 }

Since the group doesn't exist, no need to report on it in the GUI.  Of 
course it would be nice if it didn't exist, and you can go through and clean 
it up manually too.  That will also take care of it as well.


Thank You,

Brian N. Smith
NuOnce Networks
www.nuonce.net