View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000769 | 1003.1(2013)/Issue7+TC1 | Shell and Utilities | public | 2013-10-14 16:47 | 2019-06-10 08:55 |
Reporter | dwheeler | Assigned To | ajosey | ||
Priority | normal | Severity | Objection | Type | Enhancement Request |
Status | Closed | Resolution | Accepted As Marked | ||
Name | David A. Wheeler | ||||
Organization | |||||
User Reference | |||||
Section | make | ||||
Page Number | 2939-2942 | ||||
Line Number | 97180-97327 | ||||
Interp Status | --- | ||||
Final Accepted Text | See 0000769:0001986 | ||||
Summary | 0000769: Add support for SHELL in make | ||||
Description | POSIX make can currently only invoke some unspecified Bourne shell (sh). This is very limiting; users may want to use a different program to interpret actions. Most POSIX systems allow users to select their interactive shell, and use a variety of interpreters; make should do the same. Many “make” systems allow users to use an alternative shell. As noted in line 97755, this is even true of historic makes through MAKESHELL (omitted because it was always passed in through the environment, creating potential problems). In GNU make and makepp, this is done by setting the SHELL make macro (in the makefile or on the command line); the macro .SHELLFLAGS provides the flags. In some cases at least, GNU make also pays attention to MAKESHELL (though the conditions it does are not clear in the documentation). In the *BSD makes, this is done by using .SHELL and a variety of special-cased targets of the form key=value, e.g., “.SHELL: path=PATH_VALUE”; this is an unusual format, and it does not seem to support resetting the shell value from the command line. The current POSIX specification already anticipates this special use of SHELL (e.g., in lines 97080-97081). In POSIX, the SHELL value is not passed in from the environment, but instead must be specially set. The Below I propose to standardize this existing use of SHELL. This is combines nicely with .ONESHELL, but .ONESHELL is a different issue so I plan to submit that separately. (The page and line numbers given here are for the "Open Group Standard Base Specifications, Issue 7, 2013 Edition".) | ||||
Desired Action | Replace the following text beginning on line 97182: “The execution line shall then be executed by a shell as if it were passed as the argument to the system( ) interface, except that if errors are not being ignored then the shell −e option shall also be in effect. If errors are being ignored for the command (as a result of the −i option, a ’−’ command prefix, or a .IGNORE special target), the shell −e option shall not be in effect.” with this text: “The execution line shall then be executed by a shell. If SHELL is not set as a macro or on the command line, or if the macro or command line value is set to the special values “sh” or “/bin/sh”, then standard shell execution is in effect. In standard shell execution, the command line is treated as if it were passed as the argument to the system( ) interface, except that if errors are not being ignored then the shell −e option shall also be in effect. In standard shell execution, if errors are being ignored for the command (as a result of the −i option, a ’−’ command prefix, or a .IGNORE special target), the shell −e option shall not be in effect. If standard shell execution is not in effect, then the commands are treated as if they were placed in some file temporary_file, and then running $(SHELL) $(.SHELLFLAGS) temporary_file.” Also, beginning line 97326, delete the sentence “Other effects of defining SHELL in the makefile or on the command line are implementation-defined.” | ||||
Tags | tc2-2008 |
|
I see several problems here: - The text "The execution line shall then be executed by a shell." would make it impossible to legally bypass the shell for simple commands. - The proposal is a GNUsim. Other make implementations use different and better aproaches. It is e.g. much easier to write: SHELL is not imported from the environment but may be overwritten inside a makefile or from command line. - Requiring to put the shell commands into a file is not compatible to current definitions. - .SHELLFLAGS does not fit well into the current standard that defines names that start with a "." to be special targets, but not macros. - smake uses a method that fits better to the current standard by defining the macros MAKE_SHELL_FLAG and MAKE_SHELL_IFLAG. MAKE_SHELL_FLAG is predefined by "-ce" MAKE_SHELL_IFLAG is predefined by "-c" |
|
After page 2950 line 97668, insert a new bullet: * Specifying an alternate shell to use to process commands. On page 2952 lines 97755-97758, change: The historical MAKESHELL feature was omitted. In some implementations it is used to let a user override the shell to be used to run make commands. This was confusing; for a portable make, the shell should be chosen by the makefile writer or specified on the make command line and not by a user running make. to: The historical MAKESHELL feature, and related features provided by other make implementations, were omitted. In some implementations it is used to let a user override the shell to be used to run make commands. This was confusing; for a portable make, the shell should be chosen by the makefile writer. Further, a makefile writer cannot require an alternate shell to be used and still consider the makefile portable. While it would be possible to standardize a mechanism for specifying an alternate shell, existing implementations do not agree on such a mechanism, and makefile writers can already invoke an alternate shell by specifying the shell name in the rule for a target (e.g., python -c "foo"). |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-10-14 16:47 | dwheeler | New Issue | |
2013-10-14 16:47 | dwheeler | Status | New => Under Review |
2013-10-14 16:47 | dwheeler | Assigned To | => ajosey |
2013-10-14 16:47 | dwheeler | Name | => David A. Wheeler |
2013-10-14 16:47 | dwheeler | Section | => make |
2013-10-14 16:47 | dwheeler | Page Number | => 2939-2942 |
2013-10-14 16:47 | dwheeler | Line Number | => 97180-97327 |
2013-10-14 18:19 | Don Cragun | Project | 1003.1(2008)/Issue 7 => 1003.1(2013)/Issue7+TC1 |
2013-10-16 12:51 | joerg | Note Added: 0001919 | |
2013-11-14 16:54 | rhansen | Note Added: 0001986 | |
2013-11-14 16:54 | rhansen | Tag Attached: tc2-2008 | |
2013-11-14 16:55 | nick | Interp Status | => --- |
2013-11-14 16:55 | nick | Final Accepted Text | => See 0000769:0001986 |
2013-11-14 16:55 | nick | Status | Under Review => Resolved |
2013-11-14 16:55 | nick | Resolution | Open => Accepted As Marked |
2013-11-14 16:56 | eblake | Relationship added | related to 0000770 |
2019-06-10 08:55 | agadmin | Status | Resolved => Closed |