Fpm: Pass arguments from command line

Created on 2 Mar 2021  ·  5Comments  ·  Source: fortran-lang/fpm

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

bug fpm-haskell

Most helpful comment

@aslozada I pinned https://github.com/fortran-lang/fpm/issues/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.

All 5 comments

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.

The unexpected behavior is obtained with fpm-haskell.

With fpm-fortran the result is as expected

test_with_fpm_fortran

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.

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

@aslozada I pinned https://github.com/fortran-lang/fpm/issues/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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

certik picture certik  ·  6Comments

everythingfunctional picture everythingfunctional  ·  8Comments

scivision picture scivision  ·  10Comments

urbanjost picture urbanjost  ·  8Comments

certik picture certik  ·  3Comments