Bug 1225807

Summary: [YaST2][Network] Error shown not clear when ifcfg-xxxx file not correct
Product: [openSUSE] openSUSE Tumbleweed Reporter: Pablo Herranz Ramírez <pablo.herranz>
Component: YaST2Assignee: YaST Team <yast-internal>
Status: CONFIRMED --- QA Contact: Jiri Srain <jsrain>
Severity: Minor    
Priority: P5 - None CC: pablo.herranz
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/MsvHH28n
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: save_y2logs
screenshot

Description Pablo Herranz Ramírez 2024-06-03 08:17:03 UTC
Created attachment 875265 [details]
save_y2logs

I'm getting a not very usefull error message when trying to open `yast2 lan` if there's any wrong `ifcfg-xxx` file present in `/etc/sysconfig/network/`.

Find attached logs and screenshot.
Comment 1 Pablo Herranz Ramírez 2024-06-03 08:17:39 UTC
Created attachment 875266 [details]
screenshot
Comment 2 Stefan Hundhammer 2024-06-03 11:01:27 UTC
Full backtrace:

>> 10:10:24 <3> [Ruby] yast/wfm.rb(handle_exception):271
>>   Client /usr/share/YaST2/clients/lan.rb failed with
>>   'invalid address: ' (IPAddr::InvalidAddressError).
>>   
>> Backtrace:
>> 
>> .../ruby/3.3.0/ipaddr.rb:692:in `in6_addr'
>> .../ruby/3.3.0/ipaddr.rb:628:in `initialize'
>> .../lib/y2network/ip_address.rb:74:in `new'
>> .../lib/y2network/ip_address.rb:74:in `initialize'
>> .../lib/y2network/ip_address.rb:64:in `new'
>> .../lib/y2network/ip_address.rb:64:in `from_string'
>> .../lib/cfa/interface_file.rb:605:in `value_as_ipaddr'
>> .../lib/cfa/interface_file.rb:534:in `fetch_scalar'
>> .../lib/cfa/interface_file.rb:556:in `block in fetch_collection'
>> .../lib/cfa/interface_file.rb:554:in `each'
>> .../lib/cfa/interface_file.rb:554:in `each_with_object'
>> .../lib/cfa/interface_file.rb:554:in `fetch_collection'
>> .../lib/cfa/interface_file.rb:395:in `block in load'
>> .../lib/cfa/interface_file.rb:393:in `each'
>> .../lib/cfa/interface_file.rb:393:in `each_with_object'
>> .../lib/cfa/interface_file.rb:393:in `load'
>> .../lib/y2network/wicked/connection_config_reader.rb:38:in `read'
>> .../lib/y2network/wicked/connection_configs_reader.rb:49:in `block in connections'
>> .../lib/y2network/wicked/connection_configs_reader.rb:47:in `each'
>> .../lib/y2network/wicked/connection_configs_reader.rb:47:in `each_with_object'
>> .../lib/y2network/wicked/connection_configs_reader.rb:47:in `connections'
>> .../lib/y2network/wicked/config_reader.rb:84:in `read_connections'
>> .../lib/y2network/wicked/config_reader.rb:56:in `block in read'
>> .../lib/y2network/wicked/config_reader.rb:55:in `each'
>> .../lib/y2network/wicked/config_reader.rb:55:in `reduce'
>> .../lib/y2network/wicked/config_reader.rb:55:in `read'
>> .../lib/y2network/config.rb:76:in `from'
>> .../modules/Lan.rb:772:in `read_config'
>> .../modules/Lan.rb:270:in `Read'
>> .../include/network/lan/complex.rb:177:in `ReadDialog'
>> .../include/network/lan/wizards.rb:56:in `block in LanSequence'
>> .../ruby/vendor_ruby/3.3.0/yast/builtins.rb:546:in `eval'
>> .../modules/Sequencer.rb:247:in `WS_run'
>> .../modules/Sequencer.rb:318:in `block in Run'
>> .../modules/Sequencer.rb:310:in `Run'
>> .../include/network/lan/wizards.rb:88:in `LanSequence'
>> .../ruby/vendor_ruby/3.3.0/yast/fun_ref.rb:33:in `call'
>> .../ruby/vendor_ruby/3.3.0/yast/fun_ref.rb:33:in `call'
>> .../modules/CommandLine.rb:1569:in `Run'
>> .../clients/lan.rb:207:in `main'
>> .../clients/lan.rb:221:in `<top (required)>'
>> .../ruby/vendor_ruby/3.3.0/yast/wfm.rb:345:in `eval'
>> .../ruby/vendor_ruby/3.3.0/yast/wfm.rb:345:in `run_client'
>> .../ruby/vendor_ruby/3.3.0/yast/wfm.rb:206:in `call_builtin'
>> .../ruby/vendor_ruby/3.3.0/yast/wfm.rb:206:in `call_builtin_wrapper'
>> .../ruby/vendor_ruby/3.3.0/yast/wfm.rb:195:in `CallFunction'
Comment 3 Stefan Hundhammer 2024-06-03 11:04:02 UTC
>> 10:10:23 <1> [Ruby] modules/NetHwDetection.rb(Start):112
>>   IFCONFIG1:
>>   $["exit":0,
>>   "stderr":"",
>>   "stdout":
>> "
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>>     inet 127.0.0.1/8 scope host lo
>>        valid_lft forever preferred_lft forever
>>     inet6 ::1/128 scope host noprefixroute 
>>        valid_lft forever preferred_lft forever
>> 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
>>     link/ether 52:54:00:71:ac:02 brd ff:ff:ff:ff:ff:ff
>>     inet 192.168.122.2/24 brd 192.168.122.255 scope global enp1s0
>>        valid_lft forever preferred_lft forever
>>     inet6 fe80::5054:ff:fe71:ac02/64 scope link noprefixroute 
>>        valid_lft forever preferred_lft forever
>> "
>> ]
Comment 4 Stefan Hundhammer 2024-06-03 11:10:28 UTC
From the slack chat it appears that this is the one that caused problems:

>> 10:10:23 <1> [Ruby] modules/NetHwDetection.rb(Start):112
>>   IFCONFIG1:
>>   $["exit":0,
>>   "stderr":"",
>>   "stdout":
>> "
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>>     inet 127.0.0.1/8 scope host lo
>>        valid_lft forever preferred_lft forever
>>     inet6 ::1/128 scope host noprefixroute 
>>        valid_lft forever preferred_lft forever
>> 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
>>     link/ether 52:54:00:71:ac:02 brd ff:ff:ff:ff:ff:ff
>>     inet 192.168.122.2/24 brd 192.168.122.255 scope global enp1s0
>>        valid_lft forever preferred_lft forever
>>     inet6 fe80::5054:ff:fe71:ac02/64 scope link noprefixroute 
>>        valid_lft forever preferred_lft forever
>> 
>> "
>> ]
Comment 5 Stefan Hundhammer 2024-06-03 11:22:23 UTC
As a user, I'd expect an error telling me at least the file name and the line number of the error location, preferably also the string that could not be parsed.

Here I can only guess that it's 

  inet6 fe80::5054:ff:fe71:ac02/64
                   ^^
     just 2 hex digits, not 4 as expected

On my Leap 15.5, I already have 4 files /etc/sysconfig/network/ifcfg*. At least pointing the user to that directory and the ifcfg* files there would be helpful.
Comment 6 Stefan Hundhammer 2024-06-03 11:24:56 UTC
Related: bug #1181296

This bug may be a duplicate of that one.
Comment 7 Stefan Hundhammer 2024-06-03 11:27:02 UTC
Notice that the Trello card of that other bug is already archived, but it doesn't look like the change included a better error message.
Comment 8 Stefan Hundhammer 2024-06-05 08:09:43 UTC
See also bug #1225980, bug #1205188, bug #1174353.

So it's not only the very unspecific error message, the parser also appears to be very fragile.