#!/usr/bin/perl # A commitinfo script to validate dir permissions and dir existence. # To run, insert a line in CVSROOT/commitinfo like : # ALL /check-valid-dirs.pl # # Copyright (C) WANdisco, Inc # if (@ARGV < 2) { die "Argument error: commitinfo expects at least 2 parameters (got @ARGV)"; } ($repo_dir, @files) = @ARGV; autoflush(STDERR); if (-d $repo_dir && -e $repo_dir) { if (!-w $repo_dir) { print STDERR "WANdisco caught a CVS fatal error - You do not have permission to write into $repo_dir\n" if (!-w $repo_dir); exit(1); } else { exit(0) ; } } $repo_dir =~ /.*\/(.*)/; $my_dir = $1; print STDERR "WANdisco caught a CVS fatal error - The parent directory: ($repo_dir) was not added in the CVS repository. Please clean the CVS sandbox by deleting the directory '$my_dir/CVS' and then run 'cvs add' on the directory again before commiting the files in the directory. You have encountered this problem due to a know bug in 'cvs add'.\n"; exit(1); sub autoflush { my $FH = $_[0]; my $of = select $FH; $| = 1; select $of; }