From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook? Date: Mon, 12 Feb 2024 16:36:48 +0200 Message-ID: <86zfw5rbpb.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8419"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 12 15:38:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rZXRi-00022G-RY for ged-emacs-devel@m.gmane-mx.org; Mon, 12 Feb 2024 15:38:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZXQX-00083P-J4; Mon, 12 Feb 2024 09:36:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZXQV-00081A-L2 for emacs-devel@gnu.org; Mon, 12 Feb 2024 09:36:55 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZXQV-0007P0-0y; Mon, 12 Feb 2024 09:36:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3oRfJPm98qKb+oQviH8rf+j0aoSU+9uoGrersIuE/+4=; b=CHGusY1+BPe1 ydrEQp8RWiVNhYBQ/WotX7UpOKlUoPmDL2UBbELwWBkERK7IGX1khRA8xiNlRN0UCuTgR8cn60NgF IJpTbf5lB3TlFTO0OYkkkU8ns20nNQlwJjR2aGhIGvRCsV9HbTPs94lbfyDrjaEsZQFRKcFUNBEOm Cvg3w+Z10ot9qU/75qvmGpCKg+ECkkN7nMXPGEnaPQfxvAS5BqSOfxD8S2rhrKBhBuYlLaY5Njeb6 X56nCfXCrIZUPwr2t1VkpwjKGn9WLa5KTpH89+GXlkPHg+9JtnJheC/IZdik1I8KYd5LoElQsTRI2 CLHRz46h153VAOrieKy9cQ==; In-Reply-To: (message from Arthur Miller on Mon, 12 Feb 2024 11:06:02 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316136 Archived-At: > From: Arthur Miller > Date: Mon, 12 Feb 2024 11:06:02 +0100 > > I am trying to compile Emacs on a new computer with freshly installed Windows 11 > and mingw and having some troubles. > > ld is complaining about missing snprintf. Seems like I can't get past that > one. I am using mingw ucrt toolchain/runtime since m4 failed for "ordinary" > mingw-w64 toolchain which I used on Windows 10 (m4 failed creating configure > script). Any idea why and what to do? It is defined in stdio.h so I would expect > it to be included in basic libc. Do I need to pass some extra flag > compiler/linker flag? Which problem do you want to solve? the one with creating the configure script, so you could use the "ordinary" MinGW toolchain, or the one with snprintf? I don't really understand why you have a problem creating the configure script (nor why you think it's m4's fault). What is different from what you had on Windows 10? Are you using the same development tools copied from the old computer, or did you install them anew? If the former, there should be no problems with creating the configure script. If all else fails, please show the error messages you get trying to create the configure script. One thing to watch out is to make sure your Git installation doesn't perform any EOL conversions. For the snprintf problem, my suggestion is to review the patches the MSYS2 folks use for the UCRT build of Emacs. No one submitted to us patches to support UCRT builds, so that build is currently unsupported by the upstream project, but AFAIU MSYS2 folks do succeed in building it, so I guess they do have patches for it. It is better to use those patches as a starting point. > Since I removed msys mingw-w64 from my PATH to be sure mingw-w64-ucrt runtime > don't mix with other mingw runtime(s), Git also got removed from the path (I am > using mingw-64 one), and than my running Emacs couldn't open a file from a Git > repo. The simple fix for that is to have on PATH a git.cmd batch file that invokes Git after setting PATH locally (with setlocal) to include the directory where you have Git installed. > The backtrace shows find-file is calling vc-refresh which realized I am in a Git > repo and is trying to call Git. If I start emacs -q afresh without Git in the > path, it works fine, so I assume Emacs registers Git program at some point and > does not check for it on every call, perhaps I am wrong about that one? You don't tell enough to figure out what could be the reason for this. What are your customizations doing that could cause Emacs find Git even though it is not on PATH? > If that would be the case, I think it is a bug to assume that environment can't > change under running Emacs. Modifying PATH from within a running Emacs session is not recommended, precisely because it can cause subtle issues. > Also, calling vc-refresh obviously results in a quite expensive call to git > process everytime I open a file from git repo. Is it really a good default > option? At least I interpret it so since emacs -q has vc-refresh in > find-file-hook. Why do we even need vc-refresh by default in find-file-hook? We show the VC status on the mode line.