Bug 1066329

Summary: YaST Control Center Network Settings takes a long time to read hosts file
Product: [openSUSE] openSUSE Distribution Reporter: Teuniz XXX <teuniz>
Component: YaST2Assignee: Forgotten User kWxJsf0s20 <forgotten_kWxJsf0s20>
Status: RESOLVED DUPLICATE QA Contact: Jiri Srain <jsrain>
Severity: Minor    
Priority: P4 - Low CC: astieger, dgonzalez, plinnell, teuniz
Version: Leap 15.0Flags: dgonzalez: needinfo? (teuniz)
Target Milestone: ---   
Hardware: 64bit   
OS: openSUSE 42.3   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Teuniz XXX 2017-11-03 07:40:25 UTC
When a hosts file contains many entries (15K or more), starting Network Settings in YaST Control Center takes a long time, even more than a minute.

How to reproduce:

Open the /etc/hosts file with an editor.

Create (copy/paste) 15K entries (in order to block malicious websites)
e.g:

0.0.0.0         2znp09oa.com
0.0.0.0         4jnzhl0d0.com
0.0.0.0         6ldu6qa.com
0.0.0.0         82o9v830.com
0.0.0.0         abandonedclover.com
0.0.0.0         abruptroad.com
0.0.0.0         actuallysheep.com
0.0.0.0         ak0gsh40.com
0.0.0.0         ambitiousagreement.com

etc. etc.

Save the hosts file.

Now start YaST Control Center -> Network Settings
Comment 1 Arvin Schnell 2017-11-03 10:06:29 UTC
That is not a common use case.

Unfortunately the YaST team will likely not have the time to work
on this issue. Contributions from the community are welcomed, see
http://yastgithubio.readthedocs.org/en/latest/yast_is_open/.
Comment 2 Teuniz XXX 2017-11-03 12:56:21 UTC
(In reply to Arvin Schnell from comment #1)
> That is not a common use case.
> 

Try googling "hosts file block malware" or "hosts file block ads"

> Unfortunately the YaST team will likely not have the time to work
> on this issue. Contributions from the community are welcomed, see
> http://yastgithubio.readthedocs.org/en/latest/yast_is_open/.
>

I'm already involved with free & open-source software:

https://www.teuniz.net/

A lot of my spare time is going into it. I don't have the time to fix Yast...
Comment 3 Andreas Stieger 2017-11-03 13:44:02 UTC
This is probably due to the fact that for each hostname, yast creates a directory, two files and spawns /usr/bin/idnconv:
https://github.com/yast/yast-yast2/blob/master/library/types/src/modules/Punycode.rb#L215-L225

mkdir("/tmp", 0775)                     = -1 EEXIST (File exists)
mkdir("/tmp/YaST2-30727-Yc7skw", 0775)  = -1 EEXIST (File exists)
unlink("/tmp/YaST2-30727-Yc7skw/tmp-idnconv-in.ycp") = 0
open("/tmp/YaST2-30727-Yc7skw/tmp-idnconv-in.ycp", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 19
write(19, "[\n  \"5b3ed2f1-cb92-4be3-b2e9-c03"..., 44) = 44
write(19, "\n", 1)                      = 1
close(19)                               = 0
pipe([19, 20])                          = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f7beb2ba9d0) = 12943
fcntl(19, F_GETFL)                      = 0 (flags O_RDONLY)
close(20)                               = 0
fstat(19, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7beb173000
read(19, "", 4096)                      = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12943, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
close(19)                               = 0
munmap(0x7f7beb173000, 4096)            = 0
wait4(12943, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 12943
open("/tmp/YaST2-30727-Yc7skw/tmp-idnconv-out.ycp", O_RDONLY) = 19
read(19, "[\n  \"5b3ed2f1-cb92-4be3-b2e9-c03"..., 8192) = 45
close(19)                               = 0

This should be using the pipe interface of the command.
Also for SLE 15/Leap 15 this should really be using idn2 (--quiet) from libidn2 for FATE#321897: IDNA2008 support.
Comment 4 Andreas Stieger 2017-11-18 05:54:22 UTC
*** Bug 1068786 has been marked as a duplicate of this bug. ***
Comment 5 Tomáš Chvátal 2018-04-17 14:16:58 UTC
This is automated batch bugzilla cleanup.

The openSUSE 42.2 changed to end-of-life (EOL [1]) status. As such
it is no longer maintained, which means that it will not receive any
further security or bug fix updates.
As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
openSUSE, or you can still observe it under openSUSE Leap 15.0, please
feel free to reopen this bug against that version (see the "Version"
component in the bug fields), or alternatively open
a new ticket.

Thank you for reporting this bug and we are sorry it could not be fixed
during the lifetime of the release.

[1] https://en.opensuse.org/Lifetime
Comment 6 Teuniz XXX 2018-05-13 16:23:24 UTC
Re-opened because this bug is still present with Leap 42.3.
Comment 7 Teuniz XXX 2018-10-27 13:29:25 UTC
Same problem with Leap 15.
Comment 8 Lukas Ocilka 2018-12-06 09:48:48 UTC
This bug is currently being solved in bug #1116568

*** This bug has been marked as a duplicate of bug 1116568 ***
Comment 9 David Diaz 2019-01-04 12:27:11 UTC
Hi TeunizXXX,

I am glad to could say that one of our experts in this area has been made a bunch of changes in order to improve the performance reading/displaying the content of /etc/hosts file (see https://bugzilla.suse.com/show_bug.cgi?id=1116568).

As you reported this issue more than a year ago, I would like to ask you if you could test it again with a fixed version of yast2-network module (>= 4.1.27) and bring us your feedback. Does it take a more reasonable time now? Could you let us know the time loading difference before and after to use a more recent yast2-network version?

Thank you so much.
Comment 10 Teuniz XXX 2019-01-06 10:10:19 UTC
(In reply to David Diaz from comment #9)
 
> As you reported this issue more than a year ago, I would like to ask you if
> you could test it again with a fixed version of yast2-network module (>=
> 4.1.27) and bring us your feedback.

I don't use Tumbleweed and I don't have the time to install it.
Any pointers as how to install yast-network 4.1.27 on Leap 42.3 or Leap 15?

I cloned from git and I installed the yast development tools.
There's no make file.
When I run "rake run" it exits with an error:

rake aborted!
cannot load such file -- yast/rake
/data/trino/software/Yast/yast-network/Rakefile:1:in `<top (required)>'
(See full trace by running task with --trace)
trino@cetriolo:/data/trino/software/Yast/yast-network> rake run --trace
rake aborted!
cannot load such file -- yast/rake
/usr/lib64/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib64/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/data/trino/software/Yast/yast-network/Rakefile:1:in `<top (required)>'
/usr/lib64/ruby/2.1.0/rake/rake_module.rb:25:in `load'
/usr/lib64/ruby/2.1.0/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib64/ruby/2.1.0/rake/application.rb:637:in `raw_load_rakefile'
/usr/lib64/ruby/2.1.0/rake/application.rb:94:in `block in load_rakefile'
/usr/lib64/ruby/2.1.0/rake/application.rb:165:in `standard_exception_handling'
/usr/lib64/ruby/2.1.0/rake/application.rb:93:in `load_rakefile'
/usr/lib64/ruby/2.1.0/rake/application.rb:77:in `block in run'
/usr/lib64/ruby/2.1.0/rake/application.rb:165:in `standard_exception_handling'
/usr/lib64/ruby/2.1.0/rake/application.rb:75:in `run'
/usr/bin/rake:33:in `<main>'

I gave up here. Let me know if I can help using Leap 42.3 or Leap 15.
Comment 11 David Diaz 2019-01-08 14:20:01 UTC
(In reply to Teuniz XXX from comment #10)
> (In reply to David Diaz from comment #9)
>  
> > As you reported this issue more than a year ago, I would like to ask you if
> > you could test it again with a fixed version of yast2-network module (>=
> > 4.1.27) and bring us your feedback.
> 
> I don't use Tumbleweed and I don't have the time to install it.
> Any pointers as how to install yast-network 4.1.27 on Leap 42.3 or Leap 15?
> 

Don't worry then ;) Changes will be available in openSUSE Leap 15.1 and you can check them when it will be released.

However, if you are really interested in testing it, you can add the YaST::Head repository[1] and install from it (bear in mind that this is the YaST development version)

Thank you so much.

[1] https://download.opensuse.org/repositories/YaST:/Head/openSUSE_Leap_15.0/