[libvirt] [PATCH] build: fix autogen rule for VPATH build

Eric Blake eblake at redhat.com
Wed Apr 28 14:47:59 UTC 2010

On 04/28/2010 07:00 AM, Daniel Veillard wrote:
>> ACK.

Given Jim's ACK, and my discussion below, I've pushed 1/2 as-is.  I'll
wait for further comments and a v2 of my 2/2 patch before pushing it.

>   BTW since we have auto* experts around, I tend to use the CDPATH
> environment variable to make navigation within my tree easier,
> but has a tendency to break some of the auto* target, because as a
> result the cd command outputs the target directory instead of being
> silent. This used to break for example "make dist" in subtle ways.

Yeah, that can be an issue.  If you like CDPATH (and I do; I use it
regularly), I recommend:
- do _not_ export it to the environment.  Set it as a shell-local
variable in .bashrc, and not an environment variable, so that child
shells spawned by make don't see it set
- consider explicitly putting . in CDPATH, since some shells like older
zsh did not follow POSIX rules of implicitly trying . after exhausting

Meanwhile, there's a couple things to remember about when CDPATH will
interfere with cd.  'cd name' and even 'cd name/sub' must produce output
if CDPATH assisted in the resolution, but 'cd /abs-name' and 'cd
./anchored-name' must be silent because CDPATH cannot participate in the
resolution.  So if you are sure name is absolute, you can use 'cd
$(name)' without worries; if you are sure it is relative, you can use
'cd ./$(name)' without worries, and if you are unsure, then yes, you
have to unset CDPATH first.

Please do point out any particular places where we might be using cd on
a name that might be relative.  The autotools have had bugs in the past,
but are hopefully clean right now; but the problem is that you often get
uses of cd outside of stuff provided by the autotools.

But for my patch, "cd $(srcdir)" is reasonably safe, because even if it
is relative, it will normally be anchored ('.' for builddir=srcdir, or
some form of '../name' if you build in a subdir or sibling dir, which is
the only two forms of VPATH builds that I use).  The only case where it
would not be anchored is if someone builds in the parent dir, but that
is a very unusual build setup.  If you are paranoid, though, I could
change that to "cd '$(abs_srcdir)'" to avoid the issue even for someone
building in the parent dir.

Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100428/49064a7d/attachment-0001.sig>

More information about the libvir-list mailing list