Bug 1113996 - yast2_hostnames parsing error has unclear error message
yast2_hostnames parsing error has unclear error message
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: YaST2
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Michal Filka
Jiri Srain
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-30 15:24 UTC by Alexander Graul
Modified: 2021-01-15 08:08 UTC (History)
5 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Example on fresh TW 20181022 installation (685.28 KB, application/x-xz)
2018-10-30 15:24 UTC, Alexander Graul
Details
/etc/hosts example (597 bytes, text/plain)
2018-11-07 15:23 UTC, Alexander Graul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Graul 2018-10-30 15:24:21 UTC
Created attachment 787810 [details]
Example on fresh TW 20181022 installation

A misconfigured /etc/hosts file results in a somewhat misleading error message:

```
Error
Internal error. Please report a bug report with logs.
Run save_y2logs to get complete logs.
Details: Augeas parsing error: Iterated lens matched less than it should at /etc/hosts:23:7, lens /usr/share/augeas/lenses/dist/hosts.aug:13.12-.52:
Caller:  /usr/lib64/ruby/gems/2.5.0/gems/cfa-0.6.4/lib/cfa/augeas_parser.rb:377:in `report_error'
```

While it is possible to read that the parsing failed, untrained eyes will have a problem with parsing this error message.

I would expect a clear message telling me to check the file manually for misconfiguration.
Comment 1 Martin Vidner 2018-10-30 15:46:28 UTC
Thanks for the report! You're right, we should not report an Internal Error for what may have other causes.

Do you think this would be OK?

"""
Error while parsing file "/foo/bar" at line 42, column 43.
Either there is garbage in the file (your fault)
or our understanding of its grammar is incorrect (our fault).
Please check that file. If it looks correct:

Please report a bug report with logs
[rest of message as before, with exception details and caller etc.]
"""
Comment 2 Alexander Graul 2018-10-30 16:08:06 UTC
I think "garbage" might be a bit harsh, what about "erroneous content" instead?

I would also leave the "your/our" fault out, even if the user is at fault he probably does not want to read it ;)

Otherwise that approach seems good to me!
Comment 3 Josef Reidinger 2018-10-30 16:48:50 UTC
(In reply to Martin Vidner from comment #1)
> Thanks for the report! You're right, we should not report an Internal Error
> for what may have other causes.
> 
> Do you think this would be OK?
> 
> """
> Error while parsing file "/foo/bar" at line 42, column 43.
> Either there is garbage in the file (your fault)
> or our understanding of its grammar is incorrect (our fault).
> Please check that file. If it looks correct:
> 
> Please report a bug report with logs
> [rest of message as before, with exception details and caller etc.]
> """

Well, this is just default fallback exception handler. Of course specific places should use own exception catcher like e.g. bootloader did and react appropriate like propose to create file from scratch.
Comment 4 Stefan Schubert 2018-11-07 15:16:20 UTC
(In reply to Alexander Graul from comment #0)
> Created attachment 787810 [details]
> Example on fresh TW 20181022 installation
> 
> A misconfigured /etc/hosts file results in a somewhat misleading error
Could you please add /etc/hosts too ? It would be helpful for testing the fix :-)
Comment 5 Alexander Graul 2018-11-07 15:23:38 UTC
Created attachment 788858 [details]
/etc/hosts example

Sure, here is my /etc/hosts that lead to that error. I've just added a line with "rubbish" to it to see what happens when the content is invalid.
Comment 6 Martin Vidner 2018-11-08 11:21:34 UTC
Thanks, let's use this wording then:
"""
Error while parsing file "/foo/bar" at line 42, column 43.
Either there is erroneous content in the file
or our understanding of its grammar is incorrect.
Please check that file. If it looks correct:

Please report a bug report with logs
[rest of message as before, with exception details and caller etc.]
"""
Comment 7 Josef Reidinger 2018-11-08 13:19:09 UTC
As First part I will implement more detailed exceptions in CFA, so we can get all required info from it.

https://github.com/config-files-api/config_files_api/pull/26
Comment 9 Swamp Workflow Management 2018-11-08 15:10:06 UTC
This is an autogenerated message for OBS integration:
This bug (1113996) was mentioned in
https://build.opensuse.org/request/show/647329 Factory / rubygem-cfa
Comment 11 Knut Alejandro Anderssen González 2020-01-15 21:58:07 UTC
Michal, you assigned it to your self, what is the state?
Comment 12 Michal Filka 2021-01-15 08:08:26 UTC
We have better support for locating error syntax in CFA now. Thanks to Martin and Josef. So, let's close it for now.