Bug 1471421 - gawk's PROCINFO["identifiers"] reports wrong type
Summary: gawk's PROCINFO["identifiers"] reports wrong type
Alias: None
Product: Fedora
Classification: Fedora
Component: gawk
Version: 25
Hardware: All
OS: All
Target Milestone: ---
Assignee: David Kaspar [Dee'Kej]
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2017-07-15 20:54 UTC by Peter Backes
Modified: 2017-11-20 09:50 UTC (History)
1 user (show)

Fixed In Version: gawk-4.2.0-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-11-20 09:50:27 UTC

Attachments (Terms of Use)

Description Peter Backes 2017-07-15 20:54:13 UTC
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):

How reproducible:

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

Expected results:
array array

Additional info:
PROCINFO["identifiers"]["PROCINFO"] correctly reports "array".

Comment 1 Peter Backes 2017-07-15 21:06:22 UTC
Same behavior actually for numbers and strings:

% gawk 'BEGIN { x="test"; print PROCINFO["identifiers"]["x"];}'
% gawk 'BEGIN { x=5.5; print PROCINFO["identifiers"]["x"];}'

Comment 2 Peter Backes 2017-07-15 21:14:55 UTC
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 10:02:59 UTC
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 10:49:41 UTC
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.


Comment 5 Peter Backes 2017-07-17 11:38:09 UTC
Reported upstream

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

Thank you very much! :)

Comment 7 Fedora End Of Life 2017-11-16 18:42:50 UTC
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 09:50:27 UTC
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.