Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYARW-004zpK-MH for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 20:56:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tYARV-00HNjs-D8 for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 20:56:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYARV-00HNjj-3e for pgsql-hackers@lists.postgresql.org; Wed, 15 Jan 2025 20:56:49 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYARU-000b0U-1K for pgsql-hackers@lists.postgresql.org; Wed, 15 Jan 2025 20:56:48 +0000 Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-3ce8c9a656dso1265975ab.3 for ; Wed, 15 Jan 2025 12:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736974607; x=1737579407; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=aS90zSQ0iRGCwupMarppQgx6d1ZfFd7sJAj86vIET3o=; b=jTMmiPL0EcsBhQjM84Y2oIzWR4xwmwn8Sf3Gj96HYDxmou4SCkdEFAlMeKXQl/25ax kYtauhJIm1uSxy+X0Y0QU/fThuDdQ7zzSIm5EghEV4myEJEPP0BVhSu0J0g6ta5wQ3my uDbBpaRwNg2nYaqdVsJ/5SjJ5m5Xct46da2YYswWZTnusAlsNGsEs9nYh1MMxsvislJe m18XHB0pISTLTq1Jl7tr5v7M7A+Vx8yOj7LvKRZCOGz7YfsSFqOoU1kRUrYnsu6oGXoh US3A5LA23Qp2d0VxP4YkyZs9pmTOrVkQ48fxntR4JxrzSw3VQCRVrr3Qy+70u+KvT6sk BkWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736974607; x=1737579407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aS90zSQ0iRGCwupMarppQgx6d1ZfFd7sJAj86vIET3o=; b=wHwVRWDPQmZdXImt/A2zX7JUxiezyTiXDLQl1I3Yn3LR0paqD5haaBz7kxeqPMWXFy 2xdkeneJwW03zLBmb6Rsmn/UCc9sMGqO6ZcPFkm2woRfe09r9ecvqm9kySqOKoozUj29 Fu+vYiyEhZnHuqQskS4m7QsP8Bf7GDPcZmxV00X3DgPSU+xJHdjbdiOQEnmXiNIWN7Pu jAysu7ctpTjMSyx811Z3crgdqb0C/7ob4FFIeBj/akDh53pK7pHAloAww/pmlSDelM0n 4iRAHVV+GLRgswVzfXuZ49c1i31wKS+1U7n9Xr0dSs1PQBmAaM3XE+XRPtVVeCqTnYvk SPZw== X-Forwarded-Encrypted: i=1; AJvYcCWx18lGZalStIMbuNQaP9yNy3WUdeyo93WJ19S9SaKzAwhbEGoFdNo7A0hPYFjIfb5cVsiFZKzL1onTryfw@lists.postgresql.org X-Gm-Message-State: AOJu0Yxl3bGO28jhAWP7FhsqtCVY8sWATAmJcDmkN9KrkJjInHG5tDbU w2l84mU1uLdWHLZOeyA/VFMEzyhH0/6eUzyM9+TgulWRV6AKMPsj X-Gm-Gg: ASbGncsJtYmff8Pq5Yzde3Ov/r9IcXlwrN9JJRbmMD7in64jgDl3sdnKH5l6YQsnVTj xj/G3cXL0pGPXc/CD0tcmvP8jzDFETf8a7h+qPdB8bj7DFVO0ai6ASVfXWk7j76vhaeECzV9ajo 3IEYpmLTroAffCDs9/ZbQztDYksvz4TomLEpkLcQsDSedwADS6e/JQehqjND1BF7EQ75EhDRCU2 5uBvD0g907/UIUJjFw4Rq4LTzVNvSViUMXdNf+FR/Ft5jJFOSEotjH9T6Pbl/z8UeW1d0mE4eYw SImOx+KW0aaVsjhWEFtTCcyAfAENHMUAv3emAoxrk5DZYVs= X-Google-Smtp-Source: AGHT+IHAs9XAFilGmeD6Eysq6cm6S6UM1knO/Ap9ozMYHKif7itUTIkbsJXQXNefbsvc3Mv9bv6JOg== X-Received: by 2002:a05:6e02:1f8a:b0:3cb:f2e6:5590 with SMTP id e9e14a558f8ab-3ce3a7abde0mr270087825ab.0.1736974607213; Wed, 15 Jan 2025 12:56:47 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3ce8ae001besm4272025ab.68.2025.01.15.12.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 12:56:46 -0800 (PST) Date: Wed, 15 Jan 2025 14:56:44 -0600 From: Nathan Bossart To: Thomas Munro Cc: Tom Lane , Fujii Masao , Andy Fan , pgsql-hackers@lists.postgresql.org Subject: Re: convert libpgport's pqsignal() to a void function Message-ID: References: <1164438.1736910166@sss.pgh.pa.us> <1171432.1736914085@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 15, 2025 at 01:47:18PM -0600, Nathan Bossart wrote: > On Thu, Jan 16, 2025 at 08:21:08AM +1300, Thomas Munro wrote: >> Could be due to calling native signal() with a signal number other >> than the 6 values required to work by the C standard? > > Looking closer, that probably makes more sense than my SIG_ERR redefinition > theory. If that assertion is getting hit, that means signal() _is_ > returning SIG_ERR (either the system one or our redefined version), and it > looks like it's pretty common to use -1 for SIG_ERR. That'd only affect > Windows frontend programs, but it still sounds scary. I'll try getting > more details about the error with some custom cfbot runs. I think this is what's happening. cfbot's test failures are caused by initdb's setup_signals(). The call to pqsignal(SIGHUP, trapsig) seems to fail because SIGHUP isn't a real signal number, just something that's made up in win32_port.h. This SIGHUP definition was added by commit 12c9423 in May 2003, then the pqsignal(SIGHUP, ...) call was added in initdb by commit 279598b in November 2003, but it might not have been broken at that time because it doesn't look like initdb.c included the SIGHUP #define. In any case, I think this has been broken since at least commit ed9b360 (November 2017), if not earlier. Perhaps we should surround all those extra signal #defines in win32_port.h with an #ifndef FRONTEND. initdb seems to be good about avoiding pqsignal() calls if the signal doesn't exist, but I wouldn't be surprised if there are other frontend programs that are not so cautious. I'll give it a try on cfbot and see what breaks... -- nathan