autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-users] MSYS ln -s to directory


From: Noah Misch
Subject: Re: [Mingw-users] MSYS ln -s to directory
Date: Fri, 7 Apr 2006 18:33:46 -0700
User-agent: Mutt/1.5.6i

On Thu, Apr 06, 2006 at 08:01:41PM +0200, Ralf Wildenhues wrote:
> > Rolf Ebert wrote:
> > > $ mkdir dir
> > > $ ln -s Makefile dir
> > > ln: `dir': cannot overwrite directory

> OK to apply this to detect this in Autoconf?
> Could somebody test that this detects the MSYS behavior, please

By inspection, this patch looks basically right.  Comments below.

> The `rm -f conf$$.dir' at the beginning (rather than a rmdir or rm -rf)
> is on purpose: if someone has such a leftover file, I'd like to know
> (plus I'm real nervous about any occurrences of `rm -rf').

Perhaps this motive deserves a comment in the code?  I probably would have
chalked that up to a typo, had you not explained it.

>  m4_defun([_AS_LN_S_PREPARE],
> -[rm -f conf$$ conf$$.exe conf$$.file
> +[rm -f conf$$ conf$$.exe conf$$.file conf$$.dir

Shouldn't you redirect 2>/dev/null, so the user sees no diagnostic when
conf$$.dir exists and is a directory?

> +test -d conf$$.dir || mkdir conf$$.dir

If, here, the directory already exists, ...

>  echo >conf$$.file
> -if ln -s conf$$.file conf$$ 2>/dev/null; then
> +if ln -s conf$$.file conf$$ 2>/dev/null &&
> +   ln -s conf$$.file conf$$.dir 2>/dev/null; then
>    # We could just check for DJGPP; but this test a) works b) is more generic
>    # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
>    if test -f conf$$.exe; then
> @@ -872,7 +876,8 @@
>  else
>    as_ln_s='cp -p'
>  fi
> -rm -f conf$$ conf$$.exe conf$$.file
> +rm -f conf$$ conf$$.exe conf$$.file conf$$.dir/conf$$.file
> +rmdir conf$$.dir

... it might still contain something.  Maybe 2>/dev/null here, too?

>  ])# _AS_LN_S_PREPARE




reply via email to

[Prev in Thread] Current Thread [Next in Thread]