delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/02/13/18:49:27

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E12F83857C66
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1707868165;
bh=R5KOzch/dXP1W4djPZhJrY6kBNmxa6wmbfFidvWyYrM=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=Smyt9NizR3BXfb15RuagOWRtxOLpaN+4uezFj9xqKajC5Ee0l/YnPOVJjpZDPZuZ1
tq5Ly8W5vTAqk0FRaT0baBLOZ+MOzcXOLcieHkC/fhAbM6Cpx8t1PPQpv7yBXvIWQB
+AQtckWFKja2FAZzuwG9MKdr78PEvS6he3Ivlv60=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA6853857C5B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA6853857C5B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707868142; cv=none;
b=ayMMf+XeXuimHJmF34CYb8JCCbZk7Vmorwf6dd7UM4QsSyXLi3Npr2IJFUWTOFx04Bh1KuY4pLlkwCI/j45JWRVwm8GAytidIkramegWUT64Q784wn24o971dcL9/8bTmStoGdQm/nzGZZIdGS5K3lqQY87WxaGa3EeKLeE2IQk=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1707868142; c=relaxed/simple;
bh=MRLYIrigNK8pgkn7V92DCY1KtaeqLZpaCWZmX1RfVDo=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=JecwqRT41PLKpSKs8X+7PYIAp1q3hPVZMfMFp8osYa/wXcLRHgmbWnj5gkko8SQ53UR8jxOIWHOuEhOf+ykmbRTF/LisWn/gFzWBbdxgU+Y+sBccUEFOdZTpDS1R2Ci5J4RMTpFoSAxO7dUw1XXsqujzWUskWZJdLUZdhfqYNWg=
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=1707868131; x=1708472931;
h=content-transfer-encoding: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=n2/fYZRkrV6jIVFrjKx8iCT5g3AmcJ++5esofL1+jqE=;
b=CX43enAIexVrPkyx5VxfgmPdVWoTpu7Xu+pe8CChymYNME88SymChtRSd4wPftmS0h
vzR0vQf1u9yLSkw6OrrnP54Ew+4tDNT7MH/euPvOi4l7hFCCLlTvfX+4i1V7cWzSxWtZ
1fBEsesfaAPPQ/laN0r+RSf/VP9F72WmsaA1R+POk3cr2CwMukraAuQmrRZHv4Xw4elH
JX05JXqrzk4WZ50Kzen1mS+TvamlKo49xgfILqllnvr5Yo8HFoUvkdtbyQzMb0hB0xpq
gnVZG8PdUy/JWHHxnFARBn3PeYTumlyw1SYP5bobh4ORb0ivZaUTG27XlCjQyLv84ZRw
ephQ==
X-Gm-Message-State: AOJu0YwuzlWPgWNejyFPE6pbr0LuksSQrS0WX9c30Gc7pgjTAd+xBwjr
ey8JthiZnOyqX1wayIweizt8BFTnwpA/+2LV16HHCbueQ+JZOjfnDJg4VWJwxEQrvRhr30fNicR
ULszkRB2wg2nUeyBScwk8ucO++OBdnjLkVh4=
X-Google-Smtp-Source: AGHT+IEhA2A5BZjHvUTiToJfG7kvITOMEznq4whywj5Nx7pyW6dXvLQyijGE9IfSMK73Jw6NYOH3xXMv7P1ooW/5gG0=
X-Received: by 2002:a0d:cb0a:0:b0:5f7:1006:3f54 with SMTP id
n10-20020a0dcb0a000000b005f710063f54mr871937ywd.15.1707868130566; Tue, 13 Feb
2024 15:48:50 -0800 (PST)
MIME-Version: 1.0
References: <CAJXgQP0ZpcQXON_oKbgE=S8Y-M=9+b00cZ6s4Het01TCTp3ajA AT mail DOT gmail DOT com>
<Zcs_54Sakt48iAUd AT calimero DOT vinschen DOT de>
<ZcuYBL3D2rSjlhNu AT calimero DOT vinschen DOT de>
<CAJXgQP3YzDiomDUvOG30JfSAbe5d3EgLDRvbsT8yN73aAswPLA AT mail DOT gmail DOT com>
<Zcu761ZXudxviCKv AT calimero DOT vinschen DOT de>
In-Reply-To: <Zcu761ZXudxviCKv@calimero.vinschen.de>
Date: Tue, 13 Feb 2024 15:48:13 -0800
Message-ID: <CAJXgQP3L5Wq9ZmVUJ2K+wt04Nh15QTjt2e9SF07TYwS8Bg15rg@mail.gmail.com>
Subject: Re: Cygwin installer hangs when running post-install scripts
To: cygwin AT cygwin DOT com, Kevin Ushey <kevinushey AT gmail DOT com>
X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE,
WEIRD_PORT autolearn=ham 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 <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Kevin Ushey via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Kevin Ushey <kevinushey AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 41DNnREF029645

Here's a bit more information from a debug build of cygwin; here I'm
just trying to launch cygpath.exe:

(gdb) f 1
#1  0x00007ffa0123ba1f in find_fast_cwd_pointer () at
../../../../winsup/cygwin/path.cc:4526
4526      const uint8_t *lock = (const uint8_t *)

(gdb) bt
#0  memmem (haystack=<optimized out>, hs_len=<optimized out>,
needle=0x7ffa0142e531 <_C_collate_locale+59857>, ne_len=4) at
../../../newlib/libc/string/memmem.c:161
#1  0x00007ffa0123ba1f in find_fast_cwd_pointer () at
../../../../winsup/cygwin/path.cc:4526
#2  0x00007ffa0123bb7d in find_fast_cwd () at
../../../../winsup/cygwin/path.cc:4614
#3  0x00007ffa0123fd39 in cwdstuff::override_win32_cwd
(this=this AT entry=0x800004840, init=init AT entry=true,
old_dismount_count=old_dismount_count AT entry=0) at
../../../../winsup/cygwin/path.cc:4649
#4  0x00007ffa0124035c in cwdstuff::set (this=0x800004840,
nat_cwd=nat_cwd AT entry=0x0, posix_cwd=posix_cwd AT entry=0x0) at
../../../../winsup/cygwin/path.cc:4999
#5  0x00007ffa012404fb in cwdstuff::init (this=<optimized out>) at
../../../../winsup/cygwin/path.cc:4739
#6  0x00007ffa011f78bd in dll_crt0_1 () at
../../../../winsup/cygwin/dcrt0.cc:839
#7  0x00007ffa011f5c5f in _cygtls::call2 (this=0x7ffffce00,
func=0x7ffa011f782b <dll_crt0_1(void*)>, arg=0x0,
buf=buf AT entry=0x7ffffcdc0) at ../../../../winsup/cygwin/cygtls.cc:41
#8  0x00007ffa011f5ccc in _cygtls::call (func=<optimized out>,
arg=<optimized out>) at ../../../../winsup/cygwin/cygtls.cc:28
#9  0x00007ffa011f72f1 in _dll_crt0 () at
../../../../winsup/cygwin/dcrt0.cc:1052
#10 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

(gdb) info locals
ntdll = <optimized out>
get_dir = <optimized out>
ent_crit = 0x7ffa885a4b70 "H\213\304H\211X U]\351\342\214\030"
rcall = 0x7ffa885a51cb <incomplete sequence \350\044>
use_cwd = 0x7ffa552651f4 <error: Cannot access memory at address 0x7ffa552651f4>
movrbx = <optimized out>
lock = <optimized out>
testrbx = <optimized out>

which would suggest this bit of code (using the GitHub mirror just for
ease-of-use in linking)

https://github.com/cygwin/cygwin/blob/4e77fa9b8bf4818ff90c013f7e7b2b0ac0b968c5/winsup/cygwin/path.cc#L4519-L4528

Diving in further is a bit beyond my level of experience with Windows
internals. Anything else I can try and provide? I wonder if it'd be
worth having cygwin respect an environment variable like
CYGWIN_USE_FAST_CWD_POINTER, so that users could opt out of this
particular optimization if it happens to break on new versions of
Windows, as I have seemingly encountered.

As an aside, I had to make a couple of small patches to side-step gcc
warnings (converted to errors) during build; I tried building with "-g
-Og" flags.

$ git diff
diff --git a/winsup/cygwin/fhandler/fifo.cc b/winsup/cygwin/fhandler/fifo.cc
index efea508ae..f288e874a 100644
--- a/winsup/cygwin/fhandler/fifo.cc
+++ b/winsup/cygwin/fhandler/fifo.cc
@@ -669,7 +669,7 @@ fhandler_fifo::create_shmem (bool only_open)
 {
   HANDLE sect;
   OBJECT_ATTRIBUTES attr;
-  NTSTATUS status;
+  NTSTATUS status = 0;
   LARGE_INTEGER size = { .QuadPart = sizeof (fifo_shmem_t) };
   SIZE_T viewsize = sizeof (fifo_shmem_t);
   PVOID addr = NULL;
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index bf7c6010f..2cd4ae6ed 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -323,7 +323,7 @@ tty::wait_fwd ()
      thread when the last data is transfered. */
   const ULONGLONG sleep_in_nat_pipe = 16;
   const ULONGLONG time_to_wait = sleep_in_nat_pipe * 2 + 1/* margine */;
-  ULONGLONG elapsed;
+  ULONGLONG elapsed = 0;
   while (fwd_not_empty
         || (elapsed = GetTickCount64 () - fwd_last_time) < time_to_wait)
     {
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index fb45e4c9d..bcabcd47c 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -73,7 +73,7 @@ print_version ()
 static const char *
 strsigno (int signo)
 {
-  static char sigbuf[8];
+  static char sigbuf[32];

   if (signo > 0 && signo < SIGRTMIN)
     return sys_sigabbrev[signo];

Thanks,
Kevin

On Tue, Feb 13, 2024 at 10:58 AM Corinna Vinschen
<corinna-cygwin AT cygwin DOT com> wrote:
>
> On Feb 13 10:01, Kevin Ushey via Cygwin wrote:
> > On Tue, Feb 13, 2024 at 8:25 AM Corinna Vinschen wrote:
> > > On Feb 13 11:09, Corinna Vinschen via Cygwin wrote:
> > > > Other than that, the only thing you really could do at this point is to
> > > > check Cygwin's find_fast_cwd_pointer() function and go through this
> > > > function step by step, diving into the assembler code this function
> > > > inspects trying to find out which of the memmem calls fails and how to
> > > > fix it.  And send a patch eventually.
> > > > [...]
> > > > One thing we can do is to skip the find_fast_cwd_pointer() code entirely
> > > > when running on AArch64, but it's a bit annoying, given this wasn't
> > > > necessary in previous AArch64 builds.
> > >
> > > I've just pushed a (temporary?) patch to do just that.  This will be
> > > in the test build cygwin-3.6.0-0.37.g4e77fa9b8bf4 which will be
> > > installable via Cygwin's installer in an hour or two.
> >
> > Thank you for taking a look so quickly -- I can confirm your patch
> > fixes things for me; the installer now runs to completion and the
> > Cygwin64 Terminal + other installed tools all function correctly.
>
> Thanks for confirming.  However, if you see *any* chance to check
> Cygwin's find_fast_cwd_pointer() pointer function and try to find
> out why it crashes, that would be very helpful.
>
>
> Corinna

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019