Re: [netatalk-admins] asun 2.1.2-2 on FreeBSD 2.2.6 and MacOS 8.5.1


Subject: Re: [netatalk-admins] asun 2.1.2-2 on FreeBSD 2.2.6 and MacOS 8.5.1
From: Steven N. Hirsch (shirsch@adelphia.net)
Date: Thu Jan 14 1999 - 07:42:33 EST


On Wed, 13 Jan 1999, Brian Reid wrote:

> > Let me take a stab in the dark - did you upgrade from netatalk
> > 1.4b2 to an asun version at some point in the past?
>
> Yes. I ran netatalk 1.4b2 for a long time, creating tens of thousands of
> files, before upgrading to asun2.1.2-2. Only a few dozen of them have
> this problem, though.
>
> Is this proposed -v1compat switch something that I will have to run
> with forever, or will I be able to do a one-time-only conversion of all
> of my files?
>
> Besides my home server, where I experiment, I run netatalk in a large
> public school system where we have hundreds of thousands of files, and
> many many thousands of student users, and I sure don't want to have
> problems like this suddenly show up in the middle of the school year..
>
> I am at this moment in another window rdisting about 400,000 files from
> an old Ultrix machine to a new FreeBSD machine at the school. I deduce
> from tonight's exchange that it would be a bad idea for me to turn the
> students loose on it just yet....
>
> Too bad there's no "find -magic" option to let me survey the damage.
>

I ran into the same thing, in fact it was my report to Adrian that
motivated the -v1compat switch :-). I whipped up this little Perl program
to fix the adouble files (make SURE you have a backup before using any
utility with such global effects!!). Run it at the top of the apple
volume on the server and it recurses down through every .AppleDouble
directory found:

-------------------------------------------------

: # -*-perl-*-
eval 'exec perl -w -S $0 ${1+"$@"}'
    if 0;

use strict;
use POSIX qw(fcntl_h);
use IO::File;
use File::Find;
use Cwd;

# Traverse desired filesystems

my $magic = pack "C4", 0x00, 0x05, 0x16, 0x07;
my $adVersion = pack "C4", 0x00, 0x01, 0x00, 0x00;

sub fixADFiles {
  my $curdir = cwd();
  chdir('.AppleDouble');
  foreach ( glob '*' ) {
    my $fh = new IO::File;
    print "$_\n";
    $fh->open($_, O_WRONLY) || die "Can't open $File::Find::name: $!\n";
    $fh->print($magic);
    $fh->print($adVersion);
    $fh->close;
  }
  chdir($curdir);
}

sub wanted {
  my $globalSave = $_;

    (my ($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
    -d _ &&
    /^\.AppleDouble$/ &&
    fixADFiles();

  $_ = $globalSave;
}

@ARGV == 1 || die "Usage: fixad <dir>\n";

my $dir = shift;

find(\&wanted, $dir);

exit;



This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:16:11 EST