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

Better handling of out-of-order elements #4

Open
colindean opened this issue Apr 30, 2018 · 0 comments
Open

Better handling of out-of-order elements #4

colindean opened this issue Apr 30, 2018 · 0 comments

Comments

@colindean
Copy link

I had a user setup their .netrc like so:

machine bash.org
  password hunter2
  login AzureDiamond

This caused an error like so:

compile
[error] at [3,3]: `login' expected but `p' found
[error]     at org.libnetrc.Parsers$.parse(Parsers.scala:43)
[error]     at org.libnetrc.NetRcFile$.read(NetRcFile.scala:21)
[error]     at org.libnetrc.NetRcFile$.read(NetRcFile.scala:29)
[error]     at $f391e400039bf423b0b9$.$anonfun$$sbtdef$1(/Users/AzureDiamond/dev/downloads-service/build.sbt:21)
[error]     at sbt.std.Transform$$anon$3.$anonfun$apply$2(System.scala:46)
[error]     at sbt.std.Transform$$anon$4.work(System.scala:66)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.Execute.work(Execute.scala:271)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]     at java.lang.Thread.run(Thread.java:748)
[error] (credentials) at [3,3]: `login' expected but `p' found

Looking at the parsing code for machine definitions, it appears that order matters and that order must be login, password, account.

We've got netrc libraries in Ruby, Python, and Groovy reading from these files and they seem not to be order dependent. netrc(5) doesn't say anything about order-dependency, either.

I see two solutions to this usability problem:

  1. Make it be not order dependent
  2. See if there's a way to make the error message include the whole found token: an error message such as "login' expected but password' found" would be more indicative of an ordering issue and hint better how to fix it.
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

1 participant