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

Pass arguments from command line #10

Open
aslozada opened this issue Mar 2, 2021 · 5 comments
Open

Pass arguments from command line #10

aslozada opened this issue Mar 2, 2021 · 5 comments

Comments

@aslozada
Copy link
Member

aslozada commented Mar 2, 2021

In this test, an only argument with blank spaces and a only line break is passed from command line.

Test with fpm run
test_with_fpm
test_with_fpm2

Test without fpm run
test_without_fpm

Source code:

program main
 
  character(len=:), allocatable :: buffer
  integer                       :: length
   
  call get_command_argument(1,length=length)
  allocate(character(len=length) :: buffer)
   
  call get_command_argument(1,buffer)
  
  write(*,'("The argument is: ",a)') buffer
end program main

Have I forgotten anything?


fpm commit: 8f27d57

@everythingfunctional
Copy link
Member

The first case would imply trying to run an executable with that name. I think you should have received an error from fpm on that one. Not sure why it didn't.

The second case looks like it might be an issue with the command line parsing logic in concert with how it recombines the arguments when constructing the call to execute_command_line. It is perhaps not quoting, and thus your program receives each word as a separate argument.

In the third case, obviously the shell is doing what you expect.

@aslozada
Copy link
Member Author

aslozada commented Mar 2, 2021

The unexpected behavior is obtained with fpm-haskell.

With fpm-fortran the result is as expected

test_with_fpm_fortran

@everythingfunctional
Copy link
Member

I see. Is there something that the Fortran version doesn't yet do that you need the Haskell version for? The Haskell version was basically an initial prototype to get some of the initial design fleshed out, but is going to be superseded by the Fortran version.

If you really need this fixed in the Haskell version, I am available for contract work to fix it, but I'm not planning on spending much more of my free time (if any) working on the Haskell version since the Fortran version has basically made it obsolete.

@aslozada
Copy link
Member Author

aslozada commented Mar 2, 2021

Thank you for clarifying this.
I was a bit confused about the current workflow for fpm development. I reported some unexpected behaviors compared to what is described in the documentation (#348).

I am interested in fpm-fortran

@awvwgk
Copy link
Member

awvwgk commented Mar 2, 2021

@aslozada I pinned fortran-lang/fpm#253 on the issue tracker, since it clarifies the current relation of the Haskell and Fortran implementation, unfortunately it “vanished” on the second page of the tracker.

@everythingfunctional Thanks for clarifying on the state of the Haskell version here. Currently the Haskell version is still integral to bootstrap the Fortran version in the way that our current continuous integration workflow relies on it, I wouldn't call it obsolete yet. But it makes the point more important that Fortran fpm should start to bootstrap itself as soon as possible.

@awvwgk awvwgk transferred this issue from fortran-lang/fpm Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants