Austin Group Defect Tracker

Aardvark Mark IV

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001529 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Editorial Enhancement Request 2021-10-30 15:54 2021-12-07 13:05
Reporter steffen View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name steffen
User Reference
Section ex
Page Number 2732
Line Number 89418-89420
Interp Status ---
Final Accepted Text
Summary 0001529: ex: follow-up to issue #1440
Description ""
Desired Action on location as above change

  The ex utility shall execute the program named by the shell edit option. It shall pass two arguments to the program; the first shall be −c, and the second shall be the expanded arguments to the ! command as a single argument.


  ...three arguments to the program; the first shall be -c, the second --, and the third shall be...
Tags No tags attached.
Attached Files

- Relationships
related to 0001440Applied Calling `system("-some-tool")` fails (although it is a valid `sh` command) 

-  Notes
mirabilos (reporter)
2021-12-05 00:51

I’m not sure requiring the ["sh", "-c", "--", arg] behaviour in the standard is a good thing.

This is an implementation detail.

I agree with requiring it for system() and friends, but for user-space utilities, I would instead write something like “run it with sh -c in a safe way, for example by using a double-dash thingy”.

This leaves people who write portable software (such as MirBSD’s ed(1)) the option to do it by prefixing a space instead, which will work on both “old” and “new” systems; ed(1) has a leading character in the buffer which it can use for this anyway.

Other applications, where the arg comes in on its own, should not need copying, so using “sh -c --” is a good thing there (especially if the standard sh(1) supports that), but your proposed wording makes it harder for real-world systems.
steffen (reporter)
2021-12-06 18:02

This will affect future standards only.
And it only affects compliant systems, Thorsten.
For utilities OpenBSD for example i think entirely removed the possibility to use ! style commands, no? For example..
philip-guenther (reporter)
2021-12-06 20:49

No, Steffen, OpenBSD did not break the '!' command in its ex. This ticket is not a useful place to review the changes you're probably thinking of.

I'm with Thorsten that the standard should just specify that the shell shall be invoked by ex in a manner that results in a shell command that starts with a hyphen actually invoking that shell command and not triggering the shell's own option parsing.
steffen (reporter)
2021-12-07 13:05

Oh i see, Philip. I just remembered de Raadt's ~"one can always use ^Z", and in that context the "removal of many !-style commands in the OpenBSD tree".

We have seen several times that edges were interpreted as "was surely a fault/miss/misnomer in the original standard", and here (and in some other places) the standard text explicitly mentions the complete command line that shall be used, of doubtful correctness.
Philip's suggestion to replace these is of course an option.

- Issue History
Date Modified Username Field Change
2021-10-30 15:54 steffen New Issue
2021-10-30 15:54 steffen Name => steffen
2021-10-30 15:54 steffen Section => ex
2021-10-30 15:54 steffen Page Number => 2732
2021-10-30 15:54 steffen Line Number => 89418-89420
2021-12-05 00:51 mirabilos Note Added: 0005542
2021-12-05 01:11 Don Cragun Relationship added related to 0001440
2021-12-06 18:02 steffen Note Added: 0005544
2021-12-06 20:49 philip-guenther Note Added: 0005545
2021-12-07 13:05 steffen Note Added: 0005546

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker