Bug 1471421 - gawk's PROCINFO["identifiers"] reports wrong type
gawk's PROCINFO["identifiers"] reports wrong type
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gawk (Show other bugs)
25
All All
unspecified Severity medium
: ---
: ---
Assigned To: David Kaspar [Dee'Kej]
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-15 16:54 EDT by Peter Backes
Modified: 2017-11-20 04:50 EST (History)
1 user (show)

See Also:
Fixed In Version: gawk-4.2.0-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-11-20 04:50:27 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Peter Backes 2017-07-15 16:54:13 EDT
Description of problem:
when asking AWK for the type of an array variable, it incorrectly claims that it is untyped.

Version-Release number of selected component (if applicable):
gawk-4.1.3-8.fc25.i686

How reproducible:
always

Steps to Reproduce:
1. gawk 'BEGIN { testx["bla"]="foo";testx["bla2"]="foo2";print PROCINFO["identifiers"]["testx"]; split("cul-de-sac",a,"-",seps); print PROCINFO["identifiers"]["a"],PROCINFO["identifiers"]["seps"];}'

Actual results:
untyped
untyped untyped

Expected results:
array
array array

Additional info:
PROCINFO["identifiers"]["PROCINFO"] correctly reports "array".
Comment 1 Peter Backes 2017-07-15 17:06:22 EDT
Same behavior actually for numbers and strings:

% gawk 'BEGIN { x="test"; print PROCINFO["identifiers"]["x"];}'
untyped
% gawk 'BEGIN { x=5.5; print PROCINFO["identifiers"]["x"];}'
untyped
Comment 2 Peter Backes 2017-07-15 17:14:55 EDT
OK I guess it's because "The values indicate what gawk knows about the identifiers after it has finished parsing the program; they are not updated while the program runs." (https://www.gnu.org/software/gawk/manual/gawk.html)
Comment 3 Peter Backes 2017-07-16 06:02:59 EDT
Although I still think it's a bug. In the examples given, the type IS statically known after parsing. Because the respective identifiers are used in only one, unique type of context. 'testx["bla"]="foo"' clearly says that testx is an array, and if there is no conflicting assignment (such as testx = "xyz") afterwards or before, the type must be array. What purpose would PROCINFO have anyway, if it wouldn't handle this basic case well?
Comment 4 David Kaspar [Dee'Kej] 2017-07-17 06:49:41 EDT
Hello Peter,

thank you for reporting this. Unfortunately, I'm not part of gawk's upstream, nor I know much about it. You probably know much more than I do, actually... :)

Would you be, please, so kind and send your bug report to <bug-gawk@gnu.org>? In case upstream acknowledges this as a bug and fixes it, then I can create a new gawk release for you.

(I could report this to upstream on your behalf, but in case they reply I would become just a bottleneck in your communication. If you would write them the same thing you wrote me, it would speed things up much more. Upstream of gawk replies within few days usually. ;))

Thank you for your understanding.

Dee'Kej
Comment 5 Peter Backes 2017-07-17 07:38:09 EDT
Reported upstream
Comment 6 David Kaspar [Dee'Kej] 2017-07-17 10:55:21 EDT
(In reply to Peter Backes from comment #5)
> Reported upstream

Thank you very much! :)
Comment 7 Fedora End Of Life 2017-11-16 13:42:50 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 8 David Kaspar [Dee'Kej] 2017-11-20 04:50:27 EST
Based on the discussion @ gawk-bugs upstream's mailing list, I consider this BZ to be resolved in Rawhide for F28 (with rebase to gawk-4.2.0).

Please, use the suggested approach by upstream. :)

Best regards,

 -- Dee'Kej --

Note You need to log in before you can comment on or make changes to this bug.