Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port of FS42 - command line parameters are not parsed properly on Unix and unlike 3.6. #145

Open
wfpokorny opened this issue Nov 5, 2016 · 1 comment
Labels
bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments OS: Unix specific to POV-Ray for Unix

Comments

@wfpokorny
Copy link
Contributor

wfpokorny commented Nov 5, 2016

http://bugs.povray.org/task/42


Details

POV-Ray does not follow common practice on command-line handling; for instance:

povray +i"My File"

entered on a Unix shell would be passed to POV-Ray as

povray
+iMy File

(each line representing a distinct parameter here), which POV-Ray would further dissect, interpreting it as

povray
+iMy
File

To achieve the desired effect, one would actually have to quote the string twice:

povray +i"'My File'"

which the shell would translate to

povray
+i'My File'

which POV-Ray would interpret as

povray
+iMy File

In both cases, this is obviously not what a Unix user would expect.

The further dissecting of individual command-line parameters may have had its valid roots in the peculiarities of DOS' command-line handling, but to my knowledge all major contemporary operating systems follow a concept akin to Unix, passing a list of parameters instead of a monolithic command line, and burdening the respective command shells with the task of dissecting command lines into parameters.

Therefore I suggest to disable this anachronistic feature in favor of contemporary standards; a compiler flag might be used to allow for easy re-enabling of the feature, for compiling POV-Ray on exotic targets.

  • edit -

It has been pointed out that the described behaviour differs from 3.6, so I'm promoting this to a bug and changing the title.


Comments


Comment by Thorsten Fröhlich (thorsten) - Sunday, 20 June 2010, 10:49 GMT+5

This is a platform specific code issue. POV-Ray's internal command-line parser can handle both as needed. The method ProcessOptions::ParseString offers a parameter to handle this case correctly.


Comment by Andrey Zholos (aaz) - Thursday, 19 May 2011, 16:46 GMT+5

Another parsing problem:

$ povray Declare=\'foo=\"bar\"\'  # works
$ povray Declare=foo=\"bar\"      # doesn't work

Passing the singleswitch flag to ParseString solves this, but I think the second form should be accepted even without singleswitch.


Comment by Christoph Lipka (clipka) - Friday, 26 August 2011, 05:37 GMT+5

This is a platform specific code issue. POV-Ray's internal command-line parser can handle both as needed.

Not really, at least if you consider vfeSession::SetOptions(...) in the generic vfecontrol.cpp as part of POV-Ray's internal command-line parser. That's where ProcessOptions::ParseString(...) is called from, but it never passes the singleswitch parameter (so it always defaults to false).


Comment by Thorsten Fröhlich (thorsten) - Wednesday, 05 September 2012, 09:35 GMT+5

Another parsing problem:

$ povray Declare=\'foo=\"bar\"\'  # works
$ povray Declare=foo=\"bar\"      # doesn't work

Passing the singleswitch flag to ParseString solves this, but I think the second 
form should be accepted even without singleswitch.

It can't detect this without singleswitch because the quotes get removed otherwise. Then it is faced with an ambiguous "Declare=" "foo=" "bar" and can't know "bar" is meant to be a string in the tokenizer without singleswitch.

  • The best approach to recommend to any user when passing INI parameters on the command-line (which is a very non-standard feature!) would be the recommendation to quote them as a whole.
@c-lipka c-lipka added bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments OS: Unix specific to POV-Ray for Unix labels Jun 11, 2021
@c-lipka
Copy link
Contributor

c-lipka commented Jun 11, 2021

For the records, I think we should consider this a bug, but not tackle it in v3.8.0 as it would risk breaking more stuff.

(Also, does this already happen to have been fixed somewhere along the way? Someone might test this with a modern version.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments OS: Unix specific to POV-Ray for Unix
Projects
None yet
Development

No branches or pull requests

2 participants