RE: commit-email.pl errors on Win2000 (was RE: Are there anyone running Subversion server on Window NT?)
From: Jeff Cave <jeff.cave_at_sunergon.com>
Date: 2003-05-07 18:35:24 CEST
I now have a copy of the scripts that works with Win2000. I hope that someone else out there finds them useful. I tried to keep the number of alterations from the original to a minimum.
post-commit.bat is the same as the post-commit.tmpl except it uses batch file syntax instead of bash syntax. commit-email.pl has a couple of small changes to the safe_read method that allow it to work under windows as well as a change to the way it sends mail (the script itself is the client).
Unfortunately, this does not solve Chien-Lung Wu's original problem. We have sent a couple of emails back and forth and the problem there was not in the commit-email.pl but in the hook itself.
Chien-Lung Wu tried this batch file
rename e:\svn\repos\L3\hooks\y.txt e:\svn\repos\L3\hooks\x.txt
and it failed. I have tried the same batch file, and it worked. This is not a problem with the hook scripts, but with the calling of the hook scripts.
This is where I notice that I have no idea what I'm talking about and run back to my corner to hide in, hoping that someone else will have something to add...
-Jeff-
/*** post-commit.bat **************************************/
/*** diff commit-email.pl commit-email.orig ***************/
--- > my $sendmail = "/usr/sbin/sendmail"; 40,46c39 < my $svnlook = "c:\\program files\\subversion\\svnlook.exe"; < < # Mail Server < my $mailserver = "smtp.sunergon.com"; ### Suggestion by Jeff Cave < < #Temporary Directory < my $tmp_dir = 'c:\\temp\\svnlook'; --- > my $svnlook = "@SVN_BINDIR@/svnlook"; 212a206 > my $tmp_dir = '/tmp'; 216,217d209 < #modify svnlook path to account for spaces in path name < $svnlook = "\"" . $svnlook . "\""; 226,227c218,219 < #c:\program files\subversion\svnlook.exe dirs-changed c:\db\svn\swarm -r 2 < my @dirschanged = &read_from_process($svnlook, 'dirs-changed', $repos, '-r', $ rev); --- > my @dirschanged = &read_from_process($svnlook, 'dirs-changed', $repos, > '-r', $rev); 449,483c441,455 < ### Suggestion by Jeff Cave### < # < my $mailer = Net::SMTP->new($mailserver, Timeout => 60) or (print "$0: cannot open '$mailserver' for writing: $!\n"); < < $mailer->mail($mail_from); < $mailer->to($userlist); < $mailer->data(); < < $mailer->datasend(@head); < $mailer->datasend(@body); < $mailer->dataend(); < $mailer->quit; < # < ### Sugestion by Jeff Cave### < --- > if ($sendmail =~ /\w/ and @email_addresses) > { > # Open a pipe to sendmail. > my $command = "$sendmail $userlist"; > if (open(SENDMAIL, "| $command")) > { > print SENDMAIL @head, @body; > close SENDMAIL > or warn "$0: error in closing `$command' for writing: $!\n"; > } > else > { > warn "$0: cannot open `| $command' for writing: $!\n"; > } > } 556c528,539 < my $pid = open(SAFE_READ, "@_ |") || die "$0: cannot exec `@_': $!\n"; --- > my $pid = open(SAFE_READ, '-|'); > unless (defined $pid) > { > die "$0: cannot fork: $!\n"; > } > unless ($pid) > { > open(STDERR, ">&STDOUT") > or die "$0: cannot dup STDOUT: $!\n"; > exec(@_) > or die "$0: cannot exec `@_': $!\n"; > } 600a584 > /*** diff commit-email.pl commit-email.orig ***************/
---------------------------------------------------------------------
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.