You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2005/02/10 22:30:20 UTC

svn commit: r153294 - spamassassin/trunk/build/do

Author: quinlan
Date: Thu Feb 10 13:30:19 2005
New Revision: 153294

URL: http://svn.apache.org/viewcvs?view=rev&rev=153294
Log:
don't depend on $src being present for symlink vs. copy, let that fail
elsewhere

Modified:
    spamassassin/trunk/build/do

Modified: spamassassin/trunk/build/do
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/build/do?view=diff&r1=153293&r2=153294
==============================================================================
--- spamassassin/trunk/build/do (original)
+++ spamassassin/trunk/build/do Thu Feb 10 13:30:19 2005
@@ -24,19 +24,21 @@
 
 use File::Copy;
 
+# Check whether symlink is supported.
+use constant SYMLINK => eval { symlink("",""); 1 };
+
 if (scalar (@ARGV) != 3) {
   die "Usage: $0 command source target\n\twhere command can be copy move or link\n\tand source and target must be single files.\n"
 }
 
-my($cmd, $src, $tgt, $lnk) = @ARGV;
+my ($cmd, $src, $tgt, $lnk) = @ARGV;
 
 # Check if the source is a symlink and read the target.  On systems which do
 # not support symlinks, readlink will bail out which is catched by the eval,
 # similar to what 'perldoc -f symlink' suggests.  It will fall back to copy
 # then.
-$lnk = eval { readlink($src) };
-if ($@) {
-  $cmd = 'copy' if ($cmd eq 'symlink');
+if ($cmd eq 'symlink' && !SYMLINK) {
+  $cmd = 'copy';
 }
 
 # If we're supposed to link, do so.



Re: svn commit: r153294 - spamassassin/trunk/build/do

Posted by "Malte S. Stretz" <ms...@gmx.net>.
On Thursday 10 February 2005 22:30 CET quinlan@apache.org wrote:
>[...]
>  # Check if the source is a symlink and read the target.  On systems
> which do # not support symlinks, readlink will bail out which is catched
> by the eval, # similar to what 'perldoc -f symlink' suggests.  It will
> fall back to copy # then.
> -$lnk = eval { readlink($src) };
> -if ($@) {
> -  $cmd = 'copy' if ($cmd eq 'symlink');
> +if ($cmd eq 'symlink' && !SYMLINK) {
> +  $cmd = 'copy';
>  }

Ummm... now the whole logic is broken.  The readlink() was there for a 
reason...

Cheers,
Malte

-- 
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
      <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
      <http://www.catb.org/~esr/faqs/smart-questions.html>