2 ms·
> In my opinion, the best solution that POSIX.1-202x should use is to require make to set the PWD macro itself. The whole SCCS stuff in POSIX already requires m
by 0xbadcafebee 4y ago
> In my opinion, the best solution that POSIX.1-202x should use is to require make to set the PWD macro itself. The whole SCCS stuff in POSIX already requires make to think about PWD, so I don't see why this shouldn't happen
It should't happen because make isn't the problem, it's sudo not setting PWD to what you expect by default. This isn't a make bug, it's a sudo bug. Author even explicitly says this. They just prefer to modify make, for.... reasons.
- phoebos 4y agoI would say it is a make bug in that POSIX make has no good way to get PWD. Not necessarily a bug even, but an annoyance.
- 0xbadcafebee 4y ago> POSIX make has no good way to get PWD It can.... get it from the environment.... like every application run by every operating system does. PWD is only ever set by a shell. It exports it as an environment variable. Programs can read environment variables passed to them.
- phoebos 4y agoAs you noted, I said that the problems stems from sudo not setting PWD, hence `sudo make` doesn't inherit PWD. I'm not calling that a bug in sudo, but it was a bug in the specific makefile which assumed PWD to be set always. A good solution to the problem is for make to set the PWD macro. BSD make already does this. > It can get if from the environment like every application does Well no, applications either read an environment variable or use getcwd(2).