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

net: TestInterfacesWithNetsh failure in Italian version of Windows #14859

Closed
bigslipper opened this issue Mar 18, 2016 · 15 comments
Closed

net: TestInterfacesWithNetsh failure in Italian version of Windows #14859

bigslipper opened this issue Mar 18, 2016 · 15 comments

Comments

@bigslipper
Copy link

Hi, from version 1.5.2 to 1.6 of GO the test net_windows_net.go fail, the problem was the exit of netsh command called in netshInterfaceIPShowInterface(). The output of command is in Italian so when it search if bytes.HasPrefix(line, []byte("Interface ")) && bytes.HasSuffix(line, []byte(" Parameters")) {
return an empty slice because italian exit is "Interfaccia" and "Parametri".
This is output of building process:

---FAIL: TestInterfacesWithNetsh (2.22s)
net_windows_test.go:313: unexpected interface list ["Connessione alla rete locale (LAN)* 3:down" "Ethernet:up" "Loopback Pseudo-Interface 1:up" "Wi-Fi:d
own" "isatap.test.it:down"], want []
--- FAIL: TestInterfaceAddrsWithNetsh (1.61s)
net_windows_test.go:505: Ethernet: unexpected addresses list ["192.168.109.164/24" "fe80::3c96:b339:2c28:768f"], want []
net_windows_test.go:505: Loopback Pseudo-Interface 1: unexpected addresses list ["127.0.0.1/8" "::1"], want []

Alex

@ianlancetaylor ianlancetaylor changed the title Problem building GO 1.6 in Italian version of Windows net: TestInterfacesWithNetsh failure in Italian version of Windows Mar 18, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Mar 18, 2016
@bradfitz
Copy link
Contributor

@alexbrainman, can we force the language on Windows with an environment variable or something?

@bigslipper
Copy link
Author

I don't know, i solved with the installation of english language pack.

@alexbrainman
Copy link
Member

@bigslipper I am glad you solved your problem. But I was hoping that you could test me change https://go-review.googlesource.com/20865. Maybe you have another PC with Italian version of Windows. I would also like to know what GetConsoleOutputCP returns on your system - you should be able to insert some println in the test. Thank you.

Alex

@gopherbot
Copy link

CL https://golang.org/cl/20865 mentions this issue.

@bigslipper
Copy link
Author

@alexbrainman the GetConsoleOutputCP return 850,
the output of netshInterfaceIPShowInterface is

Parametri Ethernet interfaccia

IfLUID : ethernet_0
IfIndex : 4
Stato : disconnected
Metrica : 5
MTU collegamento : 1500 byte
Tempo raggiungibile : 27500 ms
Tempo raggiungibile base : 30000 ms
Intervallo di ritrasmissione : 1000 ms
Trasmissioni DAD : 3
Lunghezza prefisso sito : 64
ID sito : 1
Inoltro : disabled
Annunci : disabled
Individuazione router adiacenti : enabled
Rilevamento irraggiungibilità router adiacenti : enabled
Individuazione router : dhcp
Configurazione indirizzi gestiti : enabled
Altre opzioni di configurazione con stato : enabled
Invii host vulnerabile : disabled
Ricezioni host vulnerabile : disabled
Utilizza metrica automatica : enabled
Ignora route predefinite : disabled
Durata router annunciato : 1800 secondi
Annuncia route predefinita : disabled
Limite di hop corrente : 0
Forza modelli di attivazione ARPND : disabled
Modelli di attivazione MAC indirizzati : disabled
Funzionalità ECN : application

Parametri Wi-Fi interfaccia

IfLUID : wireless_0
IfIndex : 11
Stato : connected
Metrica : 25
MTU collegamento : 1500 byte
Tempo raggiungibile : 22500 ms
Tempo raggiungibile base : 30000 ms
Intervallo di ritrasmissione : 1000 ms
Trasmissioni DAD : 3
Lunghezza prefisso sito : 64
ID sito : 1
Inoltro : disabled
Annunci : disabled
Individuazione router adiacenti : enabled
Rilevamento irraggiungibilità router adiacenti : enabled
Individuazione router : dhcp
Configurazione indirizzi gestiti : enabled
Altre opzioni di configurazione con stato : enabled
Invii host vulnerabile : disabled
Ricezioni host vulnerabile : disabled
Utilizza metrica automatica : enabled
Ignora route predefinite : disabled
Durata router annunciato : 1800 secondi
Annuncia route predefinita : disabled
Limite di hop corrente : 0
Forza modelli di attivazione ARPND : disabled
Modelli di attivazione MAC indirizzati : disabled
Funzionalità ECN : application

Parametri Loopback Pseudo-Interface 1 interfaccia

IfLUID : loopback_1
IfIndex : 1
Stato : connected
Metrica : 50
MTU collegamento : 4294967295 byte
Tempo raggiungibile : 40500 ms
Tempo raggiungibile base : 30000 ms
Intervallo di ritrasmissione : 1000 ms
Trasmissioni DAD : 0
Lunghezza prefisso sito : 64
ID sito : 1
Inoltro : disabled
Annunci : disabled
Individuazione router adiacenti : disabled
Rilevamento irraggiungibilità router adiacenti : disabled
Individuazione router : dhcp
Configurazione indirizzi gestiti : enabled
Altre opzioni di configurazione con stato : enabled
Invii host vulnerabile : disabled
Ricezioni host vulnerabile : disabled
Utilizza metrica automatica : enabled
Ignora route predefinite : disabled
Durata router annunciato : 1800 secondi
Annuncia route predefinita : disabled
Limite di hop corrente : 0
Forza modelli di attivazione ARPND : disabled
Modelli di attivazione MAC indirizzati : disabled
Funzionalità ECN : application

Parametri Connessione alla rete locale (LAN)* 2 interfaccia

IfLUID : wireless_6
IfIndex : 2
Stato : disconnected
Metrica : 5
MTU collegamento : 1500 byte
Tempo raggiungibile : 29500 ms
Tempo raggiungibile base : 30000 ms
Intervallo di ritrasmissione : 1000 ms
Trasmissioni DAD : 3
Lunghezza prefisso sito : 64
ID sito : 1
Inoltro : disabled
Annunci : disabled
Individuazione router adiacenti : enabled
Rilevamento irraggiungibilità router adiacenti : enabled
Individuazione router : dhcp
Configurazione indirizzi gestiti : enabled
Altre opzioni di configurazione con stato : enabled
Invii host vulnerabile : disabled
Ricezioni host vulnerabile : disabled
Utilizza metrica automatica : enabled
Ignora route predefinite : disabled
Durata router annunciato : 1800 secondi
Annuncia route predefinita : disabled
Limite di hop corrente : 0
Forza modelli di attivazione ARPND : disabled
Modelli di attivazione MAC indirizzati : disabled
Funzionalità ECN : application

@alexbrainman
Copy link
Member

the GetConsoleOutputCP return 850,

Thanks for checking. I was hoping GetConsoleOutputCP will return something different than 850, because my computer's GetConsoleOutputCP returns 850 too, but my netsh speaks English.

Going by your answer, I take it this change https://go-review.googlesource.com/20865 does not fix your problem. Does it?

Do you know of any other way to fix this issue? A particular Windows API we could call. Maybe some program that we could run to determine your netsh speaks Italian.

Thank you.

Alex

@bradfitz
Copy link
Contributor

Just run netsh and search for a few substrings to see if it's in English. No need to detect Italian, German, Japanese, etc. The existing isEnglish function only reports a boolean anyway.

@alexbrainman
Copy link
Member

Just run netsh and search for a few substrings to see if it's in English

I had that idea. But I was hoping there is a more reliable way to do that. I will do that if nothing else.

Alex

@hirochachacha
Copy link
Contributor

I hope this helps you.

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Hiroshi>echo
ECHO は <ON> です。

C:\Users\Hiroshi>chcp
現在のコード ページ: 932

C:\Users\Hiroshi>chcp 437
Active code page: 437

C:\Users\Hiroshi>echo
ECHO is on.

C:\Users\Hiroshi>chcp
Active code page: 437

C:\Users\Hiroshi>

@alexbrainman
Copy link
Member

@hirochachacha are you suggesting we use echo or chcp to determine ifnewsh speaks English? But I would rather use Brad's suggestion.

Alex

@hirochachacha
Copy link
Contributor

You can get any output as English by chcp 437 like export LANG=c on unix.
This idea is already suggested by @bradfitz .

@alexbrainman, can we force the language on Windows with an environment variable or something?

@alexbrainman
Copy link
Member

You can get any output as English by chcp 437 like export LANG=c on unix.

How would I use "chcp 437" (from a Go program) to make netsh output English if I am on non-English version of Windows?

Alex

@hirochachacha
Copy link
Contributor

For example:

package main

import (
  "fmt"
  "os/exec"
)

func main() {
  out, err := exec.Command("cmd.exe", "/C", "chcp 437 && your_command").CombinedOutput()
  if err != nil {
    panic(err)
  }

  fmt.Println(string(out))
}

If go test some_pkg is not so important, just add chcp 437 to all.bat is OK? I'm not sure.

@alexbrainman
Copy link
Member

For example:

I will try that. Thank you.

Alex

@gopherbot
Copy link

CL https://golang.org/cl/21195 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants