Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Aug 2018 01:39:43 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 230492] make: -C options doesn't work as explained in man page about value of ${.CURDIR} when logical and physical directory are different.
Message-ID:  <bug-230492-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D230492

            Bug ID: 230492
           Summary: make: -C options doesn't work as explained in man page
                    about value of ${.CURDIR} when logical and physical
                    directory are different.
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: yasu@utahime.org

In the man page of make(1) '-C' options is explained as following.

----------------------------------------------------------------------
     -C directory
             Change to directory before reading the makefiles or doing
             anything else.  If multiple -C options are specified, each is
             interpreted relative to the previous one: -C / -C etc is
             equivalent to -C /etc.
----------------------------------------------------------------------

This means 'make -C /foo/bar/baz' works same as 'cd /foo/bar/baz; make'.

But there is an case that make doesn't behaves so. As explained in summary =
it
is about value of ${.CURDIR} and happens when logical and physical directory
are different.

Let me explain it by providing an example.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd1[2018]% pwd
/home/yasu/tmp
yasu@rolling-vm-freebsd1[2019]% ls -l
total 1
lrwxr-xr-x  1 yasu  user  3  8=E6=9C=88 10 08:21 bar@ -> foo
drwxr-xr-x  2 yasu  user  3  8=E6=9C=88 10 08:20 foo/
----------------------------------------------------------------------

/home/yasu/tmp/foo is real directory and /home/yasu/tmp/bar is symbolic lin=
k to
it. So logical and physical expression of /home/yasu/tmp/bar is different.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd1[2020]% cd /home/yasu/tmp/bar
yasu@rolling-vm-freebsd1[2021]% /bin/pwd -L
/home/yasu/tmp/bar
yasu@rolling-vm-freebsd1[2022]% /bin/pwd -P
/home/yasu/tmp/foo
----------------------------------------------------------------------

And there is following Makefile under /home/yasu/tmp/bar.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd1[2023]% cat Makefile=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
                                   ~/tmp/bar
all:
        @echo ${.CURDIR}
----------------------------------------------------------------------

It simply displays value of ${.CURDIR}.

Now let's execute make without any arguments. It causes following result.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd1[2024]% make=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20
                                   ~/tmp/bar
/home/yasu/tmp/foo
----------------------------------------------------------------------

Physical expression of current working directory is displayed.

Next, let's execute make with -C options and logical expression of current
working directory. In this case it result as following.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd1[2025]% make -C /home/yasu/tmp/bar=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
                                   ~/tmp/bar
/home/yasu/tmp/bar
----------------------------------------------------------------------

If '-C' options works exactly as explained in man page, same value as previ=
ous
execution, that is, physical expression of current working directory should=
 be
displayed. Actually, however, what is displayed is logical expression of
current working directory. This means '-C' option doesn't work as explained=
 in
man page.

I confirmed it happens on both 11.2-RELEASE and 12.0-CURRENT (r337160).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-230492-227>