X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AB2738582A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1706775576; bh=gb7yQdjYsDZcx9WUyyeXjtYhGLgz9IBTgRtnq3EkHvc=; h=References:In-Reply-To:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=P9+8g8/ELCDo8KKuAWozFOFaL4lzcK0AzSecAvBeof12vSk7YVvhKllIg4M3fWpr6 RX8anrzXZxfZHDJPwR8KV57nlKMwkwdeGLyUUti3giZMq9fecwr6BlwwP4dQITK7KJ lHEK/9Hv58LJIBN9vzwI13GFWJmFJKUQC6T65RmA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E46EE3858D37 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E46EE3858D37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706775546; cv=none; b=BAxnn+S19O51b9qlRPQVOw4kZo3UztmbuB7S9TcZeBE+EssLGIHay4iS84MV1hnARdarZsTZl9HpzwCW+xClvBqbv2nDptOZJH/iYim6wAWFu4sbGe1lRo2rJnXi19qWeHd4UDIl8UwAaZBr15/KrYr+Qpp+5gGR23+DRnbqEF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706775546; c=relaxed/simple; bh=moIGLvzvgtGOpOkhtM87zDE3XgAMNH7TOGjK32h6e6c=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ZuxtWQvGtx1AJWFQBd5Kq5hLsuBg/UOa5rgYVSLOJu07+UEcqCQW80rjH7MH0c9ihbcIZAnyHNQ2N4p3R2xSTsYdgmmgRY3IHYRv3U1QsaWF9aKmCzBKQbx37IBkeynMXxBWo+1W7cSJN+Zf9GCevN53TQZP2DtT901jl/VdEaQ= ARC-Authentication-Results: i=1; server2.sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706775542; x=1707380342; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Tl3HVTUyD8GWvxqp2U8N27/Nq6IlXSz+ou/ReI6scaM=; b=iAWRwg6NWoZsScwdeOwTBvszQqkmjxBvVsEQkdXPjms7YlPJDE49JJL2ZO0cQ6ZdRu asXeE6Tfq3zO7O6xuJRqHwsV3FHqrH9s2vITbLLGVM1av4bHhwW8Uc+YN0NJxS1yq8KF S1I0GeBOdWSFs4JrdaNwybkvqaQjYJ0jSYEyuBsoOGrc7++i//6hegABw2BmigLLOhgU gO643DNBYW9jYJRsWsuZN6xRw0fpfD+sSkhm00LTn8yBxI/q4TDp0Bzbz++tLXXwx6+J oS38fQve/et/MlyAjNZeU/5o98VyH1UjkRdWeTX7hSp9x/VK52AUoMPoyR6dxziup/Cp RHug== X-Gm-Message-State: AOJu0YwHHMX9q4czgdvm4Jasb8jkPnXV+EnV1dJkKGDDVM763nNP7Cyo swIYVhg4teIIlySp/+YDV+Lx3azptPTPC5FgKvZGv/MAB2YCdNQ2iaCQesnd2qDx4jb/EKU12+o LmVB0bfDoI5drmmyyAy1jAfJueD+wOYA47vWMJdV1th1guEh/TIA= X-Google-Smtp-Source: AGHT+IGSgFgcRI1lkwTzCmp+cr5v3f9k+eJdSxUiYXmxgwzRunfufQZPov1yi8GACs3yDh/TSZGjMM3Oq3i21DfPGD4= X-Received: by 2002:a17:906:f117:b0:a30:d5ae:2833 with SMTP id gv23-20020a170906f11700b00a30d5ae2833mr2660971ejb.56.1706775542521; Thu, 01 Feb 2024 00:19:02 -0800 (PST) MIME-Version: 1.0 References: <4aa47264-70df-42ff-bf74-70da021a8d82 AT SystematicSW DOT ab DOT ca> In-Reply-To: <4aa47264-70df-42ff-bf74-70da021a8d82@SystematicSW.ab.ca> Date: Thu, 1 Feb 2024 08:18:25 +0000 Message-ID: Subject: Re: Aren't Windows System Error popups meant to be disabled in Cygwin? To: cygwin AT cygwin DOT com Cc: Brian Inglis X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: David Allsopp via Cygwin Reply-To: David Allsopp Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" On Wed, 31 Jan 2024 at 22:27, Brian Inglis via Cygwin wrote: > > On 2024-01-31 06:40, David Allsopp via Cygwin wrote: > > Starting with this very trivial C program: > > > > #include > > #include > > > > int main(void) { > > printf("Zstandard v%d\n", ZSTD_versionNumber()); > > } > > > > and compiling with > > > > x86_64-w64-mingw32-gcc -o test.exe test.c -lzstd > > > > when I then run ./test.exe, I get the Windows critical-error-handler > > dialog stating "The code execution cannot proceed because > > libzstd-1.dll was not found. Reinstalling the program may fix this > > problem." > > > > My question is not how to fix the problem (I'm well aware of that), > > but rather why that message is being displayed at all, and is it a bug > > in Cygwin somewhere? All I could find Googling was previous > > suggestions that Cygwin routinely calls SetErrorMode with, amongst > > other things, SEM_FAILCRITICALERRORS with the intention of suppressing > > this dialog. > > > > Is that correct, and if so is this just me? :o) > > > > Windows 10 22H2, Cygwin 3.4.10, running all the commands from mintty. > > I also get the same popup if I run C:\cygwin64\bin\sh -c > > "/cygdrive/c/path/to/test" either from a Command Prompt or even from > > "Start -> Run". Running this via "sh" called from a non-Cygwin process > > (itself invoked from a Command Prompt) which has also called > > SetErrorMode is how I hit this. > > Better to let you know that there is a problem, and what the problem is, so you > can fix it! Thank you, but no - as I made clear by: > My question is not how to fix the problem (I'm well aware of that) I'm fully aware what has caused the issue to arise, and how to fix it - that's not the issue. The problem is that according to previous messages, and the Cygwin code, my impression was that mintty / bash / sh (*Cygwin* programs) calling this executable should be returning an exit code here, not freezing on a message dialog. The problem appears to be a bug in the Cygwin DLL, and from previous messages on the list, my question is whether it's a regression, and can be fixed. The reason it's a problem is, say, a script _in Cygwin_ which is handed a command to run, runs it, and is then completely blocked by that popup dialog. It's the responsibility of the _caller_ (a Cygwin program) to indicate the mode in which a program is executed - the message box may be owned by the program called, but it's caused by it being loaded, before it has a chance to run any code. My understanding, based on this line: https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/dcrt0.cc#L721 in dll_crt0_0 is that Cygwin executables (in this case mintty / bash / sh, etc.) should be running with SEM_FAILCRITICALERRORS enabled, following the best practice recommendations in https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode and that that setting should be correctly inherited by processes they call (including non-Cygwin ones). Some ancient history, reporting my same issue in 2004: https://cygwin.com/pipermail/cygwin/2004-March/115553.html and this thread from 2006 https://cygwin.com/pipermail/cygwin/2006-August/150038.html strongly indicating that that line dcrt0.cc is there precisely to stop this popup. Thanks, David -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple