G4Vi / Perl-Dist-APPerl

Actually Portable Perl
Other
31 stars 1 forks source link

Disable Cosmo runtime flags hijacking #9

Open dolmen opened 1 month ago

dolmen commented 1 month ago

Cosmo debug flags could be useful for debugging, however they are extracted from the command-line too widely: they are accepted anywhere in the command line, and their removal interact with the expected behavior of perl.

Example:

$ ./perl.com -E 'say $#ARGV' -- --strace 2>/dev/null
-1
$ perl -E 'say $#ARGV' -- --strace 2>/dev/null
0

So it would be better to have them disabled, and the Cosmo debug functionalities to be available only via environment variables (ex: COSMO_STRACE=1, COSMO_FTRACE=1).

G4Vi commented 1 month ago

Using environment variables instead sounds safer and less intrusive. However, without knowing of any real world existing scripts that depend on passing those flags I don't consider this an APPerl bug.

Feel free to file this at cosmopolitan. One reason Cosmopolitan may not want to switch to environment variables is passing arguments to get tracing is a lot more convenient than setting environment variables in cmd.exe or powershell.