From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout12.t-online.de (mailout12.t-online.de [194.25.134.22]) by sourceware.org (Postfix) with ESMTPS id 413A73858429 for ; Thu, 11 Aug 2022 13:37:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 413A73858429 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=t-online.de Received: from fwd78.dcpf.telekom.de (fwd78.aul.t-online.de [10.223.144.104]) by mailout12.t-online.de (Postfix) with SMTP id A48F4B1B0 for ; Thu, 11 Aug 2022 15:36:46 +0200 (CEST) Received: from [192.168.2.101] ([91.57.241.168]) by fwd78.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1oM8Mf-1hcQgC0; Thu, 11 Aug 2022 15:36:45 +0200 Subject: Re: resolv.conf and gnupg2 To: cygwin@cygwin.com References: <61cf96e9-68f9-1186-9c02-61be61614f61@t-online.de> <1512349222.20220810174046@yandex.ru> From: Christian Franke Message-ID: <3480b0f8-7b7e-6672-ce8a-ec675eb909a8@t-online.de> Date: Thu, 11 Aug 2022 15:36:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 SeaMonkey/2.53.12 MIME-Version: 1.0 In-Reply-To: <1512349222.20220810174046@yandex.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TOI-EXPURGATEID: 150726::1660225005-01447F1E-114868A4/0/0 CLEAN NORMAL X-TOI-MSGID: 5cc96e16-1284-463e-895b-e0c1b8fc1942 X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FROM, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 13:37:09 -0000 Andrey Repin wrote: > Greetings, Christian Franke! > > ... >> Unfortunately the ipconfig output is always localized, so this does only >> work OOTB with English versions of Windows. The ipconfig parsing is also broken due to two reasons: >> - The current Cygwin versions of awk, grep and sed no longer convert CR/LF >> -> LF on stdin, so '/FooBar$/' patterns never match. >> - ipconfig may output scoped IPv6 addresses ("fe80::1%12") which are not matched by the awk script. >> A draft patch is attached. It also avoids the tmp file and uses shell builtins where possible. > Why not use netsh with `chcp 65001`? How would netsh help? Netsh is also localized and changing the codepage does possibly not change the output language. Changing the language would also require '.../en-US/netsh.exe.mui' file which is not necessarily installed. If netsh is run interactively, it prints a deprecation warning for 'interface' and other commands and recommends usage of powershell. This works but is slow and might violate local security policy:  powersh()  {    local x    # May require '-ExecutionPolicy ...'    if ! x=$(powershell -NoProfile -Command "$@" 2>/dev/null); then      echo "powershell: failed" >&2      return 1    fi    echo "$x" | tr -d '\r'  }  search=$(powersh \    'Get-DnsClientGlobalSetting `     | ForEach-Object SuffixSearchList')  nameservers=$(powersh \    'Get-DnsClientServerAddress `     | ForEach-Object ServerAddresses `     | select -Unique')  # Alternatively  nameservers=$(powersh \    'Get-NetIPConfiguration `     | ForEach-Object DNSServer `     | ForEach-Object ServerAddresses `     | select -Unique') ... -- Regards, Christian