From nobody Tue Oct 03 21:34:28 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S0WLD2VkFz4w2DX for ; Tue, 3 Oct 2023 21:34:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0WLD0Yx3z4mXR for ; Tue, 3 Oct 2023 21:34:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696368868; a=rsa-sha256; cv=none; b=gLV2/9tj7p5m6/cmbJo5ZU58VW8lENVr8sby0AGAe9G97KIT6d6M+Je9oQFWyiz8zDofbp Aki0tzLq4yS4hX08Pi2fGhdh89hAQPAJDC6EfLnwkA8ggQv4K98ckwS52DMnSEOG8ZcPJ5 kuvdIzR3fqgJ8SDz5v/scrSnO60WFr/z6rjRpyX4z+uuU18M0AXOwntcdBdH04Mmh+KYJ4 xueZigyKRfwmbCn2MKnYzHFnIDp0bZKahFDqDI4NvKnKQTsRB6HxnUSDRT3qLpKWwiGFVQ 3/AfPcsluVPwMTP0wPQaA/SNqdw8dPAXHAnMwfM2COzPXKnrXDuenD2HB5arRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696368868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NV8yAmCZ23Ot8kE+7AhJc0WJ7h1utIGplHih+MNma+A=; b=pjOaTXOsXgkommbD8Oo16JGrobd1ZtpUdsjTtzvQGX4fy2WPY2RCF+MHGdf8YyHde5gYIz W54V8p1g+w+73fl6/FT9Z6f+Z9M+0eI4Y48rZ0uwvXdNM7WGcDWoGIt88U/OvjSXTvVocD /aiZMGSl6g3zYrQXxj/zqFFgbEz4Ee6J7hWPGUoY7k79xxlXWa9nM1hZdOebOqkACYKowj xxiq0KUqKirwUPGtXsbAVQwMdBm1cAtWyB1J95JfS9AZ72f5VPfpVE96z2qG2ZrU8KCj4I oebHwejHsvz7NOyfwyXDDCm3azGGdZ3dXLLThNvejr6+TJmboLqcyHVf2jl73Q== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S0WLC6kGMz19sb for ; Tue, 3 Oct 2023 21:34:27 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 393LYRxx040425 for ; Tue, 3 Oct 2023 21:34:27 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 393LYR6I040424 for bugs@FreeBSD.org; Tue, 3 Oct 2023 21:34:27 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 274254] The /bin/sh $LINENO value just after a nested function is misleading. Date: Tue, 03 Oct 2023 21:34:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: white-pack@pm.me X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274254 Bug ID: 274254 Summary: The /bin/sh $LINENO value just after a nested function is misleading. Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: white-pack@pm.me Created attachment 245417 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D245417&action= =3Dedit A sample script for inspiring a fix. The following script reveals the issue 1 #!/bin/sh 2 3 check() 4 { 5 echo $1 - \ 6 $( 7 [ $2 -eq $3 ] \ 8 && echo OK \ 9 || echo FAIL "($2 !=3D $3)" 10 ) 11 } 12 13 main() 14 { 15 check 2 $LINENO 3 16 17 inner() 18 { 19 check 4 $LINENO 3 20 } 21 22 check 3 $LINENO 10 23 inner 24 } 25 26 check 1 $LINENO 26 27 main Here's its output: 1 - OK 2 - OK 3 - FAIL (22 !=3D 10) 4 - OK Every line of the output should be "OK", but the third one fails. The internal logic controlling LINENO seems to ignore that inner() was nest= ed. I attach an ad-hoc "work-around" which could inspire a possible fix. --=20 You are receiving this mail because: You are the assignee for the bug.=