Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Feb 24, 2025

Closes: #1229
Reported-by: @zeha
Cc: @thesamesam



Is this okay?


Revisions:

v2
  • Remove definitions of $prefix and $exec_prefix. [@thesamesam ]
$ git range-diff master gh/ep ep 
1:  8840d0e3 ! 1:  6f4e5d61 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
    @@ Metadata
      ## Commit message ##
         configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
     
    +    According to Sam, if we just remove the definitions, autotools will
    +    provide the right values.
    +
    +    Note that this changes the default from /usr to /usr/local, which is the
    +    right value according to the GNU conding standards (and also what the
    +    BSDs prefer, according to one conversation I had with Ingo Schwarze from
    +    OpenBSD).
    +
         Closes: <https://github.com/shadow-maint/shadow/issues/1229>
    +    Link: <https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/Default-Prefix.html>
         Reported-by: Chris Hofstaedtler <zeha@debian.org>
         Cc: Sam James <sam@gentoo.org>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
    @@ src/Makefile.am
      
     -ubindir = ${prefix}/bin
     -usbindir = ${prefix}/sbin
    -+prefix = /usr/local
    -+exec_prefix = ${prefix}
     +ubindir = ${exec_prefix}/bin
     +usbindir = ${exec_prefix}/sbin
      suidperms = 4755
v3
  • Replace ${} by $() in surrounding code. [@thesamesam ]
$ git range-diff master gh/ep ep 
1:  6f4e5d61 = 1:  6f4e5d61 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
-:  -------- > 2:  0fada16b src/Makefile.am: Use $() for consistency
v3b
  • Rebase
$ git range-diff master..gh/ep shadow/master..ep 
1:  6f4e5d61 = 1:  983e3308 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  0fada16b = 2:  8d0eb980 src/Makefile.am: Use $() for consistency
v3c
  • Rebase
$ git rd
1:  983e3308 = 1:  3d09f4f9 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  8d0eb980 = 2:  51b0e9f9 src/Makefile.am: Use $() for consistency
v3d
  • Rebase
$ git range-diff db/master..gh/ep shadow/master..ep 
1:  3d09f4f9 = 1:  d19fdb29 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  51b0e9f9 = 2:  33142670 src/Makefile.am: Use $() for consistency
v3e
  • Rebase
$ git rd
1:  d19fdb29 = 1:  c499e815 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  33142670 = 2:  8738df50 src/Makefile.am: Use $() for consistency
v3f
  • Rebase
$ git rd
1:  c499e815 = 1:  905759e6 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  8738df50 = 2:  ba3c8f90 src/Makefile.am: Use $() for consistency
v3g
  • Rebase
$ git rd 
1:  905759e6 = 1:  657b01f1 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  ba3c8f90 = 2:  9dff75be src/Makefile.am: Use $() for consistency
v3h
  • Rebase
$ git rd
1:  657b01f1 = 1:  ca0daff9 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  9dff75be = 2:  3f86cfbb src/Makefile.am: Use $() for consistency
v3i
  • Rebase
$ git rd
1:  ca0daff9 = 1:  f793375e configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  3f86cfbb = 2:  cc9e79c7 src/Makefile.am: Use $() for consistency
v3j
  • Rebase
$ git rd
1:  f793375e = 1:  4309e187 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  cc9e79c7 = 2:  b28fb398 src/Makefile.am: Use $() for consistency
v3k
  • Rebase
$ git rd 
1:  4309e187 = 1:  e9fc9e1b configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  b28fb398 = 2:  7ab69930 src/Makefile.am: Use $() for consistency
v3l
  • Rebase
$ git rd 
1:  e9fc9e1b = 1:  0eeb7f4c configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  7ab69930 = 2:  e471ea0d src/Makefile.am: Use $() for consistency
v3m
  • Rebase
$ git rd 
1:  0eeb7f4c = 1:  389a4058 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  e471ea0d = 2:  a7585cb7 src/Makefile.am: Use $() for consistency
v3n
  • Rebase
$ git rd 
1:  389a4058 = 1:  71ea3767 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  a7585cb7 = 2:  4f6598bb src/Makefile.am: Use $() for consistency
v3o
  • Rebase
$ git rd 
1:  71ea3767 = 1:  57bd9370 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  4f6598bb = 2:  cf00ba24 src/Makefile.am: Use $() for consistency
v3p
  • Rebase
$ git rd 
1:  57bd9370 = 1:  89a30f10 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  cf00ba24 = 2:  0d718ce4 src/Makefile.am: Use $() for consistency
v3q
  • Rebase
$ git rd 
1:  89a30f10 = 1:  800aaa5d configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  0d718ce4 = 2:  c3b6e0c3 src/Makefile.am: Use $() for consistency
v4
  • Rebase
$ git rd 
1:  800aaa5d ! 1:  88acb4f1 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
    @@ configure.ac: AC_SUBST([LIBSUBID_ABI_MINOR], [libsubid_abi_minor])
      AC_SUBST([LIBSUBID_ABI], [libsubid_abi])
      
     -dnl Some hacks...
    --test "$prefix" = "NONE" && prefix="/usr"
    --test "$prefix" = "/usr" && exec_prefix=""
    +-test "x$prefix" = "xNONE" && prefix="/usr"
    +-test "X$prefix" = "X/usr" && exec_prefix=""
     -
      AC_USE_SYSTEM_EXTENSIONS
      
2:  c3b6e0c3 = 2:  fbcd57ed src/Makefile.am: Use $() for consistency
v4b
  • Rebase
$ git rd 
1:  88acb4f1 = 1:  aac8ef2f configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  fbcd57ed = 2:  e13042b0 src/Makefile.am: Use $() for consistency
v4c
  • Rebase
$ git rd 
1:  aac8ef2f = 1:  7e76060c configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  e13042b0 = 2:  04adb6df src/Makefile.am: Use $() for consistency
v4d
  • Rebase
$ git rd 
1:  7e76060c = 1:  40f81475 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  04adb6df = 2:  f9deed24 src/Makefile.am: Use $() for consistency
v4e
  • Rebase
$ git rd 
1:  40f81475 = 1:  bd86b89c configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  f9deed24 = 2:  c6816608 src/Makefile.am: Use $() for consistency
v4f
  • Rebase
$ git rd 
1:  bd86b89c9 = 1:  b5bbddca8 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  c6816608b = 2:  64fade5f7 src/Makefile.am: Use $() for consistency
v4g
  • Rebase
$ git rd 
1:  b5bbddca8 = 1:  d4743e4a1 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  64fade5f7 = 2:  8cacf6b31 src/Makefile.am: Use $() for consistency
v4h
  • Rebase
$ git rd 
1:  d4743e4a1 = 1:  4ab4da022 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  8cacf6b31 = 2:  d7b978aae src/Makefile.am: Use $() for consistency
v5
  • Respect $(sbindir) in PASSWD_PROGRAM. [@Karlson2k ]
$ git rd 
-:  --------- > 1:  5d4e20a93 configure.ac, lib/Makefile.am: Respect $(sbindir) in PASSWD_PROGRAM
1:  4ab4da022 = 2:  0ff5aa752 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  d7b978aae = 3:  921e7348c src/Makefile.am: Use $() for consistency
v5b
  • Escape double quotes, so that we have a string literal in the C code.
$ git rd 
1:  5d4e20a93 ! 1:  a884b9bd5 configure.ac, lib/Makefile.am: Respect $(sbindir) in PASSWD_PROGRAM
    @@ lib/Makefile.am
      
     -DEFS =
     +DEFS = \
    -+  -DPASSWD_PROGRAM="$(sbindir)/passwd"
    ++  -DPASSWD_PROGRAM='"$(sbindir)/passwd"'
      
      noinst_LTLIBRARIES = libshadow.la
      
2:  0ff5aa752 = 2:  86adba75d configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
3:  921e7348c = 3:  fc101c6c1 src/Makefile.am: Use $() for consistency
v6
$ git range-diff master..gh/ep PASSWD_PROGRAM..ep 
1:  a884b9bd5 < -:  --------- configure.ac, lib/Makefile.am: Respect $(sbindir) in PASSWD_PROGRAM
2:  86adba75d = 1:  64bfdfd55 configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
3:  fc101c6c1 = 2:  092b283d7 src/Makefile.am: Use $() for consistency
v6b
  • Rebase
$ git range-diff 64bfdfd55a83^..gh/ep PASSWD_PROGRAM..ep 
1:  64bfdfd55 = 1:  e3239be5a configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables
2:  092b283d7 = 2:  b33540fc7 src/Makefile.am: Use $() for consistency

@zeha
Copy link
Contributor

zeha commented Feb 24, 2025

#1227 relies on exec_prefix already being set in configure.ac; with both combined, i get this in config.h:

#define PASSWD_PROGRAM "NONE/bin/passwd"

but maybe you can just push a fix to #1227.

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Feb 24, 2025

#1227 relies on exec_prefix already being set in configure.ac; with both combined, i get this in config.h:

#define PASSWD_PROGRAM "NONE/bin/passwd"

but maybe you can just push a fix to #1227.

I bail out; too much autotools for me. @thesamesam please help. :-)

@thesamesam
Copy link
Contributor

I'll look but probably tomorrow.

Copy link
Contributor

@thesamesam thesamesam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK with that one change for {} vs ().

.indent.pro

ubindir = ${prefix}/bin
usbindir = ${prefix}/sbin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current state of MR, the same exec_prefix will be used for ubindir && bindir

Do we keepubindir and usbindir in such case?
Or they are intentionally separate in Makefile.am so one can use make variables to have different values for ubindir and bindir e.g.

make install ubindir=/tmp/bin usbindir=/tmp/sbin

Otherwise LGTM and +1 for removing hacks :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to remove them, but in a separate PR. I'd say even in a separate release, just to make sure we don't break anything at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alejandro-colomar Are you intentionally moving all binaries from "/bin" to "/usr/bin"?
It makes sense to move all of them, but then you should use just standard functionality and completely remove use of ubindir and usbindir.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I want that; however, I'd like the transition to be gradual, to make sure each patch is easy to review for correctness.

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Mar 5, 2025

#1227 relies on exec_prefix already being set in configure.ac; with both combined, i get this in config.h:

#define PASSWD_PROGRAM "NONE/bin/passwd"

but maybe you can just push a fix to #1227.

Has this been fixed?

Cc: @zeha

@ikerexxe
Copy link
Collaborator

As it is now, the patch does not break anything in the fedora packaging.

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Mar 26, 2025

#1227 relies on exec_prefix already being set in configure.ac; with both combined, i get this in config.h:

#define PASSWD_PROGRAM "NONE/bin/passwd"

but maybe you can just push a fix to #1227.

Has this been fixed?

Cc: @zeha

Self answer: I still get this.

@thesamesam , do you know why?

@alejandro-colomar
Copy link
Collaborator Author

#1227 relies on exec_prefix already being set in configure.ac; with both combined, i get this in config.h:

#define PASSWD_PROGRAM "NONE/bin/passwd"

but maybe you can just push a fix to #1227.

Has this been fixed?
Cc: @zeha

Self answer: I still get this.

@thesamesam , do you know why?

It's due to this line:

AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$exec_prefix/bin/passwd",

But is that line bad? How should one use $exec_prefix within configure.ac properly?

@alejandro-colomar
Copy link
Collaborator Author

Cc: @Karlson2k

Maybe he knows.

@Karlson2k
Copy link
Contributor

There is no need to re-invent the wheel.
Autoconf is handling all these details automatically and gives both downstream users and upstream authors high flexibility.

The useless hacks at the start of the configure.ac must be removed.
Then the standard variables must be used for locations. bindir, sbindir are assigned automatically, but can be overridden easily by user.
See https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/Installation-Directory-Variables.html and https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables

In short: do not use "$exec_prefix/bin/passwd". Both exec_prefix and prefix are only internal helpers to set other variables correctly.

Avoid manipulating or setting any paths in configure. Leave it for the Makefile.am, where you should use bindir, sbindir.
With proper configure.ac and correct Makefile.am the final user may override all directories (including bindir and sbindir) either at the configure time (by ./configure --prefix=/usr or ./configure --sbindir=/usr/sbin) or at make time (by make exec_prefix=/usr install or make sbindir=/usr/sbin install without re-compiling).

It is used by all autotools projects (except projects which invented their own hacks) and this convention is straightforward for downstream users and package maintainers: they know how to deal with it, how to configure it, and also this removes the need for downstream hacks to override upstream-invented hacks.

@Karlson2k
Copy link
Contributor

Karlson2k commented Dec 31, 2025

If any installation path is assigned directly in configure then it breaks ability to use make-time override.

To emphasise: DO NOT assign any installation path variables in configure.

If you really badly need to hardcode an absolute path in the binary file, you may use

DEFS += '-DPASSWD_PROGRAM="$(sbindir)/passwd"'

in your Makefile.am but this will break the rule "different path must work without re-compiling".
Note the proper quoting of the string.

@Karlson2k
Copy link
Contributor

Karlson2k commented Dec 31, 2025

Note: in Makefiles, $(VAR) and ${VAR} are equivalent and both are portable, but $(VAR) is easier to read as a "makefile expansion" (not a "shell expansion").

@alejandro-colomar
Copy link
Collaborator Author

There is no need to re-invent the wheel. Autoconf is handling all these details automatically and gives both downstream users and upstream authors high flexibility.

The useless hacks at the start of the configure.ac must be removed. Then the standard variables must be used for locations. bindir, sbindir are assigned automatically, but can be overridden easily by user. See https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/Installation-Directory-Variables.html and https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables

In short: do not use "$exec_prefix/bin/passwd". Both exec_prefix and prefix are only internal helpers to set other variables correctly.

Avoid manipulating or setting any paths in configure. Leave it for the Makefile.am, where you should use bindir, sbindir. With proper configure.ac and correct Makefile.am the final user may override all directories (including bindir and sbindir) either at the configure time (by ./configure --prefix=/usr or ./configure --sbindir=/usr/sbin) or at make time (by make exec_prefix=/usr install or make sbindir=/usr/sbin install without re-compiling).

It is used by all autotools projects (except projects which invented their own hacks) and this convention is straightforward for downstream users and package maintainers: they know how to deal with it, how to configure it, and also this removes the need for downstream hacks to override upstream-invented hacks.

Would you mind sending patches for that? I don't know how to do it. My understanding of configure.ac and Makefile.am is very limited.

@Karlson2k
Copy link
Contributor

Actually this need much deeper fix and hacks removals.
Currently the code is trying to abuse variables prefix and exec_prefix as "root" and "/usr" subdirs.
The code in

ubindir = ${prefix}/bin
usbindir = ${prefix}/sbin
is trying to install to "/bin", "/usr/bin", "/sbin" and "/usr/sbin"
With global usr-merge it is much better to stop trying to differentiate "root" and "/usr".
If any downstream still needs to use different "root" and "/usr" it can be easily handled at packaging stage without any hacks.

For now, to fix this PR you just need to remove

AC_DEFINE_UNQUOTED([PASSWD_PROGRAM], ["$exec_prefix/bin/passwd"],
	[Path to passwd program.])

from configure.ac and put

DEFS += '-DPASSWD_PROGRAM="$(sbindir)/passwd"'

to

DEFS =

Note: empty assignment to "DEFS" in this file is wrong (or another hack?). It must be DEFS +=.

Alternatively (and less correct) you may just change configure.ac:

AS_VAR_IF([exec_prefix],["NONE"],[:],
    [AC_DEFINE_UNQUOTED([PASSWD_PROGRAM], ["$exec_prefix/bin/passwd"],
	    [Path to passwd program.])]
)

The code is handling correctly undefined PASSWD_PROGRAM macro (with default pathname instead).

I will not be able to take my hands on it until February.

@alejandro-colomar
Copy link
Collaborator Author

Actually this need much deeper fix and hacks removals. Currently the code is trying to abuse variables prefix and exec_prefix as "root" and "/usr" subdirs. The code in

ubindir = ${prefix}/bin
usbindir = ${prefix}/sbin

is trying to install to "/bin", "/usr/bin", "/sbin" and "/usr/sbin"
With global usr-merge it is much better to stop trying to differentiate "root" and "/usr".
If any downstream still needs to use different "root" and "/usr" it can be easily handled at packaging stage without any hacks.

For now, to fix this PR you just need to remove

AC_DEFINE_UNQUOTED([PASSWD_PROGRAM], ["$exec_prefix/bin/passwd"],
	[Path to passwd program.])

from configure.ac and put

DEFS += '-DPASSWD_PROGRAM="$(sbindir)/passwd"'

to

DEFS =

Note: empty assignment to "DEFS" in this file is wrong (or another hack?). It must be DEFS +=.

Thanks! I've applied your suggestion.

I will not be able to take my hands on it until February.

No hurry. Thanks! You're contributions will be very useful when you have time for them. :)

@alejandro-colomar alejandro-colomar marked this pull request as ready for review December 31, 2025 14:18
@alejandro-colomar alejandro-colomar requested review from hallyn and removed request for thesamesam December 31, 2025 14:19
@Karlson2k
Copy link
Contributor

You missed the proper quoting.
You must use '-DPASSWD_PROGRAM="$(sbindir)/passwd"' or -DPASSWD_PROGRAM=\"$(sbindir)/passwd\" (but the latter may fail if whitespace is used in variable)

@alejandro-colomar
Copy link
Collaborator Author

You missed the proper quoting. You must use '-DPASSWD_PROGRAM="$(sbindir)/passwd"' or -DPASSWD_PROGRAM=\"$(sbindir)/passwd\" (but the latter may fail if whitespace is used in variable)

Ahh, sorry. Why is this? In regular makefiles, quoting is unnecessary. Is this because of autotools?

@Karlson2k
Copy link
Contributor

You missed the proper quoting. You must use '-DPASSWD_PROGRAM="$(sbindir)/passwd"' or -DPASSWD_PROGRAM=\"$(sbindir)/passwd\" (but the latter may fail if whitespace is used in variable)

Ahh, sorry. Why is this? In regular makefiles, quoting is unnecessary. Is this because of autotools?

No, it is the regular Makefile rule.
You want to provide parameter quoted as a string. Without correct quoting shell removes " and you get -DPASSWD_PROGRAM=bin/passwd literally. Of course, you may stringify this in C code, but why? :)

@alejandro-colomar
Copy link
Collaborator Author

You missed the proper quoting. You must use '-DPASSWD_PROGRAM="$(sbindir)/passwd"' or -DPASSWD_PROGRAM=\"$(sbindir)/passwd\" (but the latter may fail if whitespace is used in variable)

Ahh, sorry. Why is this? In regular makefiles, quoting is unnecessary. Is this because of autotools?

No, it is the regular Makefile rule. You want to provide parameter quoted as a string. Without correct quoting shell removes " and you get -DPASSWD_PROGRAM=bin/passwd literally. Of course, you may stringify this in C code, but why? :)

Let me try to understand it.

We have in the Makefile:

DEFS = -DPASSWD_PROGRAM="$(sbindir)/passwd"

Which presumably is used in a recipe something like

        $(CC) $(DEFS) $(CFLAGS) ...

Before make(1) executes the shell, it expands variables, thus passing the following string to sh(1):

        cc -DPASSWD_PROGRAM="/usr/local/bin/passwd" ...

Then, the shell performs tokenization:

cc
-DPASSWD_PROGRAM="/usr/local/bin/passwd"
...

And then, the shell expands quoted strings:

cc
-DPASSWD_PROGRAM=/usr/local/bin/passwd
...

And then calls execve(2).

Which program does need the single quotes and why?

@alejandro-colomar
Copy link
Collaborator Author

alejandro-colomar commented Dec 31, 2025

Here's a small example of how I expect it to work:

alx@devuan:~/tmp$ cat Makefile 
bar = B A R

DEFS = -DFOO="$(bar)"

all:
	echo FOO | cc -E $(DEFS) -x c /dev/stdin
alx@devuan:~/tmp$ make
echo FOO | cc -E -DFOO="B A R" -x c /dev/stdin
# 0 "/dev/stdin"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "/dev/stdin"
B A R

@Karlson2k
Copy link
Contributor

Karlson2k commented Dec 31, 2025

Here's a small example of how I expect it to work:

alx@devuan:~/tmp$ cat Makefile 
bar = B A R

DEFS = -DFOO="$(bar)"

all:
	echo FOO | cc -E $(DEFS) -x c /dev/stdin
alx@devuan:~/tmp$ make
echo FOO | cc -E -DFOO="B A R" -x c /dev/stdin
# 0 "/dev/stdin"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "/dev/stdin"
B A R

Yes, you get literally B A R substituted, not a string
But you need a C string. The value of the macro must "B A R", not just B A R.

@alejandro-colomar
Copy link
Collaborator Author

Here's a small example of how I expect it to work:

alx@devuan:~/tmp$ cat Makefile 
bar = B A R

DEFS = -DFOO="$(bar)"

all:
	echo FOO | cc -E $(DEFS) -x c /dev/stdin
alx@devuan:~/tmp$ make
echo FOO | cc -E -DFOO="B A R" -x c /dev/stdin
# 0 "/dev/stdin"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "/dev/stdin"
B A R

Yes, you get literally B A R substituted, not a string But you need a C string. The value of the macro must "B A R", not just B A R.

Ahhh, I see; my bad. Thanks! :)

@alejandro-colomar
Copy link
Collaborator Author

Ughh, now some tests fail.

@Karlson2k
Copy link
Contributor

At least some failures do not look like related.

Suggested-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
For consistency with <paths.h> definitions.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
…directory variables

According to Sam, if we just remove the definitions, autotools will
provide the right values.

Note that this changes the default from /usr to /usr/local, which is the
right value according to the GNU conding standards (and also what the
BSDs prefer, according to one conversation I had with Ingo Schwarze from
OpenBSD).

Closes: <shadow-maint#1229>
Link: <https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/Default-Prefix.html>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Cc: Sam James <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Some code was using $() and other ${}.  Use the same everywhere.

Reported-by: Sam James <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exec_prefix is set to / for prefix=/usr

6 participants