Closed Mte90 closed 4 years ago
this is consistent or intermittent? i saw another issue about remove by position, think it's related?
We have 2 users with this issue, so I am looking to release an old version of the plugin with a previous release.
I downloaded and ran sudo goodhosts clean
and got the same error:
❯ sudo goodhosts clean
panic: runtime error: slice bounds out of range [362:361]
goroutine 1 [running]:
github.com/goodhosts/hostsfile.(*Hosts).removeByPosition(...)
/home/runner/go/pkg/mod/github.com/goodhosts/hostsfile@v0.0.6/hosts.go:297
github.com/goodhosts/hostsfile.(*Hosts).combineIp(0xc0000fbc18, 0xc0000c2540, 0x7)
/home/runner/go/pkg/mod/github.com/goodhosts/hostsfile@v0.0.6/hosts.go:285 +0x582
github.com/goodhosts/hostsfile.(*Hosts).RemoveDuplicateIps(0xc0000fbc18)
/home/runner/go/pkg/mod/github.com/goodhosts/hostsfile@v0.0.6/hosts.go:224 +0x1f3
github.com/goodhosts/hostsfile.(*Hosts).Clean(0xc0000fbc18)
/home/runner/go/pkg/mod/github.com/goodhosts/hostsfile@v0.0.6/hosts.go:130 +0x40
github.com/goodhosts/cli/cmd.clean(0xc0000908c0, 0x2, 0x2)
/home/runner/work/cli/cli/cmd/clean.go:29 +0x7f
github.com/urfave/cli/v2.(*Command).Run(0xc0000aac60, 0xc0000907c0, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.1.1/command.go:161 +0x4b9
github.com/urfave/cli/v2.(*App).RunContext(0xc00008e180, 0x127d980, 0xc000096008, 0xc0000a0020, 0x2, 0x2, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.1.1/app.go:302 +0x790
github.com/urfave/cli/v2.(*App).Run(...)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.1.1/app.go:211
main.main()
/home/runner/work/cli/cli/main.go:55 +0x48e
adding and removing is unaffected, it's just the clean operation that has the issue
My hosts file for coomparison:
i will check with your data and confirm. thanks and sorry about this
ok so ya this is recreatable with your hostsfile content. im working on a patch and sorry about that
ok i fixed.. did this on windows so see below with a --dry-run. ill PR in a bit.
PS C:\Users\luthe\goodhosts\cli> goodhosts -f ./hostsfile clean --dry-run
::1 localhost testwplocaltest.local www.testwplocaltest.local #Local Site Local Site
0.0.0.0 001.0x1f4b0.com 002.0x1f4b0.com 003.0x1f4b0.com 004.0x1f4b0.com 005.0x1f4b0.com 006.0x1f4b0.com 007.0x1f4b0.com 008.0x1f4b0.com 1q2w3.fun
0.0.0.0 1q2w3.me 1q2w3.website 2giga.download abc.pema.cl ad-miner.com ad.g-content.bid adminer.com adplusplus.fr adzjzewsma.cf
0.0.0.0 aeros01.tk aeros02.tk aeros03.tk aeros04.tk aeros05.tk aeros06.tk aeros07.tk aeros08.tk aeros09.tk
0.0.0.0 aeros10.tk aeros11.tk aeros12.tk altavista.ovh analytics.blue andlache.com api.aalbbh84.info api.bhzejltg.info api.browsermine.com
0.0.0.0 api.inwemo.com api.jsecoin.com api.netflare.info api.pzoifaum.info as.cfcdist.loan as.cfcnet.top authedmine.com authedmine.eu authedwebmine.cz
0.0.0.0 axoncoho.tk bablace.com baiduccdn1.com bauersagtnein.myeffect.net berateveng.ru berserkpl.net.pl bestcoinsignals.com besti.ga bewaslac.com
0.0.0.0 biberukalap.com bjorksta.men bmcm.ml bmcm.pw bmnr.pw bmst.pw bowithow.com browsermine.com butcalve.com
0.0.0.0 candid.zone cdn-code.host cdn-jquery.host cdn.adless.io cdn.cloudcoins.co cdn.jquery-uim.download cdn.minescripts.info cdn.static-cnt.bid cdn.streambeam.io
0.0.0.0 cdnjs.cloudflane.com cfcdist.gdn chainblock.science clgserv.pro clickwith.bid cnhv.co cnt.statistic.date coin-have.com coin-hive.com
0.0.0.0 coinblind.com coinerra.com coinhive.com coinhiveproxy.com coinlab.biz coinnebula.com coinpirate.cf cryptaloot.pro crypto-loot.com
0.0.0.0 crypto-webminer.com crypto.csgocpu.com cryptoloot.pro ctlrnwbv.ru d.cfcnet.top d.cpufan.club depttake.ga dev.cryptobara.com didnkinrab.com
0.0.0.0 digger.cryptobara.com dl.browsermine.com dronml.ml encoding.ovh ermaseuc.ru eth-pocket.de ethtrader.de eu.cfcdist.loan eu.cfcnet.top
0.0.0.0 eucsoft.com evengparme.com ffinwwfpqi.gq flare-analytics.com flophous.cf freshrefresher.com g-content.bid go.megabanners.cf go2.mercy.ga
0.0.0.0 gobba.myeffect.net graftpool.ovh gridiogrid.com gustaver.ddns.net hatcalter.com hegrinhar.com hemnes.win hide.ovh hive.tubetitties.com
0.0.0.0 hodlers.party hodling.faith host.d-ns.ga ininmacerad.pro intactoffers.club jqcdn01.herokuapp.com jqcdn03.herokuapp.com jqcdn2.herokuapp.com jquery-uim.download
0.0.0.0 js.nahnoji.cz jsccnn.com jscdndel.com jurty.ml jurtym.cf kdmkauchahynhrs.ru kedtise.com kippbeak.cf krb.devphp.org.ua
0.0.0.0 ledhenone.com ledinund.com lightminer.co load.jsecoin.com losital.ru m.anyfiles.ovh mebablo.com mepirtedic.com mfio.cf
0.0.0.0 mhiobjnirs.gq mine.nahnoji.cz mine.torrent.pw minemytraffic.com miner.cryptobara.com miner.nablabee.com miner.pr0gramm.com minercry.pt minero-proxy-01.now.sh
0.0.0.0 minero-proxy-02.now.sh minero-proxy-03.now.sh minero.pw minescripts.info minr.browsermine.com minr.pw mlib.browsermine.com moneone.ga monerominer.rocks
0.0.0.0 moonsade.com mwor.gq mxcdn1.now.sh mxcdn2.now.sh nathetsof.com nebabrop.com never.ovh new.minr.pw nexttime.ovh
0.0.0.0 nfwebminer.com niematego.tk noblock.pro node.cfcdist.gdn npcdn1.now.sh oei1.gq okeyletsgo.ml open-hive-server-1.pp.ua p.estream.to
0.0.0.0 p1.interestingz.pw papoto.com pasoherb.gq pearno.com play.play1.videos.vidto.me play.video2.stream.vidzi.tv play1.flashx.pw play2.flashx.pw play4.flashx.pw
0.0.0.0 play5.flashx. playe.vidto.se playerassets.info plexcoin.info pool.etn.spacepools.org pool.hws.ru pr0gram.org renhertfo.com reservedoffers.club
0.0.0.0 rintindown.com rintinwa.com rocks.io s2.appelamule.com scaleway.ovh server.jsecoin.com site.flashx.cc skencituer.com smectapop12.pl
0.0.0.0 sparnove.com static.browsermine.com static.sparechange.io staticsfs.host sxcdn02.now.sh sxcdn1.herokuapp.com sxcdn4.now.sh sxcdn5.herokuapp.com sxcdn6.now.sh
0.0.0.0 test.minr.pw tidafors.xyz tokyodrift.ga traviilo.com tulip18.com uoldid.ru us.cfcdist.loan us.cfcnet.top verresof.com
0.0.0.0 video.streaming.estream.to video.videos.vidto.me videoplayer2.xyz vip.cfcnet.top wasm24.ru webassembly.stream webmine.cz webmine.pro webminepool.com
0.0.0.0 webminepool.tk webminerpool.com webxmr.com willacrit.com witthethim.com wordc.ga worker.salon.com wpcdn1.herokuapp.com ws.bhzejltg.info
0.0.0.0 ws.browsermine.com ws.pzoifaum.info wsp.marketgid.com wss.nablabee.com www.authedwebmine.cz www.aymcsx.ru www.blockchained.party www.cloudflane.com www.coinimp.com
0.0.0.0 www.coinimp.net www.cryptonoter.com www.datasecu.download www.etzbnfuigipwvs.ru www.freecontent.bid www.freecontent.date www.freecontent.faith www.freecontent.loan www.freecontent.racing
0.0.0.0 www.freecontent.win www.hostingcloud.download www.jqassets.download www.jqcdn.download www.jqrcdn.download www.jquerrycdn.download www.jquery-cdn.download www.jqwww.download www.lightminer.co
0.0.0.0 www.monero-miner.com www.monkeyminer.net www.mutuza.win www.sparechange.io www.terethat.ru www.webassembly.stream www.webmine.cz www2.adfreetv.ch xmr.cool
0.0.0.0 xmr.mining.best xvideosharing.site
127.0.0.1 kubernetes.docker.internal localhost testwplocaltest.local www.testwplocaltest.local
192.168.50.4 gitty.test multisite.test one.wordpress.test one.wordpress.test.192.168.50.4.xip.io tomjn.test two.wordpress.test vipone.test vvv vvv.test
255.255.255.255 broadcasthost
awesome :) thanks for such a quick turn around!
We are getting some crashes on OSX.
Seems the line with the issue is https://github.com/goodhosts/hostsfile/blob/master/hosts.go#L297