A NOTE has been added to this issue. ====================================================================== 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 20:15 UTC ====================================================================== Summary: shell can not test if a file is text ======================================================================
---------------------------------------------------------------------- (0004221) eblake (manager) - 2019-01-24 20:15 http://austingroupbugs.net/view.php?id=1226#c4221 ---------------------------------------------------------------------- A shell may not be able to prove whether a file is a text file, but can easily filter out a number of non-text files with a short read() or two (any file that contains a NUL byte, any file that does not end in a newline) regardless of locale, as well as the converse (any file that starts with #! might be treated as a text file rather than a binary to pass to exec(), even though POSIX itself states that the use of #! is non-portable). Given that existing shells also have various other heuristics (such as any iscntrl() hits in the first 512 bytes) for deciding whether a regular file is unlikely to be executable as a shell script (although it does not necessarily make the file a non-text file). I'm not sure if the desired action is sufficient to permit what existing shells do. 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 2019-01-24 20:15 eblake Note Added: 0004221 ======================================================================