From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 4D0273858D38 for ; Fri, 22 Mar 2024 04:16:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D0273858D38 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=fastly.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D0273858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1031 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711080996; cv=none; b=xeKirKApxlkCChMDO97meqRiapNyqtmfqgv4HLGLrK1iHZxq/8sOEo4vovw7MkFnoo2HUJbKOCfEjPaCwq0e2CoZdPdXnhwC3tacAet60THWf9dNvX79VOzxx8z4b+u092f6ld2Fvwm83ZQjV5LGF8QVWqJYN/PsEugL/hhlCqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711080996; c=relaxed/simple; bh=QeNJ0UqZ2QGvlSuk2B/sCqjUoAnbd1ORhExeh3NoVjU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=l78QurlM7rJ8zO7hR/ZpcsJWXE5FdIIlXKKDjsNeB8n3mF1a2EzjEvPkR+r5Rxl08Xqpl8LRJWJqz+OpXVvznK4uigWp3ITEERtNxxHfJji+FGb/gdMhyem6J3/MBu/gmYGL1DfICYYh6YGLaNUAnkotWzSIoGw9xZxg/7f/+24= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-29deb7e2f7aso1260851a91.1 for ; Thu, 21 Mar 2024 21:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1711080994; x=1711685794; darn=sourceware.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=QNgdVGnxJhuU9fkQROFl512/IhVn+L53WVRuMIwxNYE=; b=caR92cOhzM32F5CLGa+xzZBQ3fqDuxnKjbM8NcLLcjXcjTz3ZTPqA1XJAWVzJqhp5I IHOOAwiGR4/x/KbxqcCW1wAUEE+ua139sf1nx+sse2nx6COStCgaq467fe4Ac5bzY4F/ LzzG8bNTBMuDhxRiV7Ml7BOk2hq45+I5t1r08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711080994; x=1711685794; h=in-reply-to:content-transfer-encoding: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=QNgdVGnxJhuU9fkQROFl512/IhVn+L53WVRuMIwxNYE=; b=oK/nEhaK6HqcCgCxcoOGxAFqD8+IUfyWSeehmPsrgOLRDBWcbhVe0vCdgOZ7sdPj/5 uUlSfbFOd7xP7KTClGohE+LWnfL5QRb/oVtQMeKiVX1zVvBn6k3jnUOS/7UVbBRqx8So Y2Tx01EzSwZ7ZSvHsBh8tFpurWFQ+ki+I8XlhsceEJgChgShIEz6TdaIS2c9moFk0M9l ViAAG2SI9nt8oxX6tAXGYxnyZ73MfV2LZ/YovEzSp+XsDqPGH30tnTMxBKVVzoBUi6A4 XQEMTKDfmSICfEWIeJ1YwUI3mdm5KBsJyRX9xefmJ4cU60ASMnBqhuGQ7d26OT668z4o qEtw== X-Forwarded-Encrypted: i=1; AJvYcCWqWyGlR3jTw0X7f4Iex4WnkZnczEvTUMGxkULsQWfvygFVdoCv48h3bLQi1FNNxHu35LP6mZS4JBOHtQYGM5QWiWU7BapfnZwE X-Gm-Message-State: AOJu0YwrE0xMVG++UKVKik5RNVynh4lAd7jF6Ww5jJN62sUO4ECQeuKe iUTH+Z502Z+XaXXTd7scWO1QHBAZ3tPD46i9ds7sdAKitEdQko9H/YS9T7yqkT8= X-Google-Smtp-Source: AGHT+IH4rMfLmza9JPyBQnVNNfil0Z8f/BVp9EjtsRGpYe53kHq21MuW0Nf+KnehkX6SvRP4oNwKkw== X-Received: by 2002:a17:90b:4c05:b0:29f:988d:c980 with SMTP id na5-20020a17090b4c0500b0029f988dc980mr1392854pjb.6.1711080993731; Thu, 21 Mar 2024 21:16:33 -0700 (PDT) Received: from feather.sobornost.net ([123.254.127.131]) by smtp.gmail.com with ESMTPSA id px1-20020a17090b270100b002a026065f91sm816510pjb.9.2024.03.21.21.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 21:16:33 -0700 (PDT) Date: Fri, 22 Mar 2024 04:16:28 +0000 From: Job Snijders To: Andreas Schwab Cc: Florian Weimer , libc-alpha@sourceware.org Subject: Re: [PATCH] resolv: add IPv6 support to inet_net_pton() Message-ID: References: <87zfuxcdjd.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPAM_FROM,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: **** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Mar 19, 2024 at 10:50:14AM +0100, Andreas Schwab wrote: > On Mär 19 2024, Job Snijders wrote: > > > The proposal at hand does save errno at the start and restores it at the > > end to avoid unnecessary stomping on errno (if nothing bad happened). > > Sorry, I missed that. > > > I’m not entirely sure how removing the idiomatic check helps in that > > regard? I might be missing something. > > It's still unnecessary code that makes it harder to understand, which is > bad. >From POSIX's strtol() description: "If the correct value is outside the range of representable values, LONG_MAX or LONG_MIN is returned (according to the sign of the value), and errno is set to [ERANGE]." https://pubs.opengroup.org/onlinepubs/7908799/xsh/strtol.html The above to me means that it is not enough to just check whether errno is set to ERANGE, but one also has to check whether LONG_MAX or LONG_MIN were returned. It's an 'AND' operation. Then, if errno is NOT set to ERANGE, then we have to additionally check whether the value is within contextual bounds. So I don't think it is correct to skimp on checks here, to me idiomatic checks do not equate 'bad'. I'm not here to argue, please take from the patch whatever you want, I just want glibc inet_net_pton() to finally have IPv6 support. Kind regards, Job