The following issue has been SUBMITTED. ====================================================================== http://austingroupbugs.net/view.php?id=1226 ====================================================================== Reported By: shware_systems Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1226 Category: Shell and Utilities Type: Error Severity: Objection Priority: normal Status: New Name: Mark Ziegast Organization: SHware Systems Dev. User Reference: Section: XCU 2.9.1 Page Number: 2368 Line Number: 75592 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2019-01-24 19:00 UTC Last Modified: 2019-01-24 19:00 UTC ====================================================================== Summary: shell can not test if a file is text Description: With the sentence "If the executable file is not a text file, the shell may bypass this command execution.", POSIX makes no distinction between binary formatted files and files formatted as text according to some locale, so there is no standard way to determine what the contents of an arbitrary file represent. As such, after an exec() fails the shell just knows the file had an appropriate x-permission bit set but isn't in the format exec() expected. It is up to the invoked shell to determine this is not text by eventually getting some syntax or grammar error when reading the file. That platform's exec() may just recognize ELF binaries, and the file may be a COFF or OMF binary for access by other platforms over a network, as example, and not a script.
What can be tested is the type of a file, and it's more precise to say command execution can always be bypassed if the file's type precludes the possibility of it being a source of scripts, such as a directory or symbolic link, and a platform may elect to treat types other than regular files as binary-only oriented and skip trying to process these also. Regular files are the only type the standard requires as able to persist text data, and that sentence should reflect this. Desired Action: Change: If the executable file is not a text file, to: If the executable file is not a regular file, ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2019-01-24 19:00 shware_systems New Issue 2019-01-24 19:00 shware_systems Name => Mark Ziegast 2019-01-24 19:00 shware_systems Organization => SHware Systems Dev. 2019-01-24 19:00 shware_systems Section => XCU 2.9.1 2019-01-24 19:00 shware_systems Page Number => 2368 2019-01-24 19:00 shware_systems Line Number => 75592 ======================================================================