Bug 128345 - gawk: "str1 str2 | getline" no longer concatenates str1 str2
gawk: "str1 str2 | getline" no longer concatenates str1 str2
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gawk (Show other bugs)
2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Woerner
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-21 19:20 EDT by George Hansper
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-06 07:33:15 EDT
Type: ---
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 George Hansper 2004-07-21 19:20:19 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
In previous releases of gawk, the getline built-in would
operate, such that given:

   str1 str2 | getline var

The strings to the left of the '|' would be concatenated BEFORE
the command is executed.

The version bundled with Fedora Core 2 changes this behaviour,
and only the last component of the expression is executed as the
command.

This appears to be a change in precedence, because:
  ( str1 str2 ) | getline var
works as expected, as does:
   1 + 4 | getline var
(this gives an error: "sh: line 1: 5: command not found")

Version-Release number of selected component (if applicable):
gawk-3.1.3-7

How reproducible:
Always

Steps to Reproduce:
gawk 'BEGIN { "ls" " -l " "/etc/fstab" | getline test; print test};'
    

Actual Results:  sh: line 1: /etc/fstab: Permission denied


Expected Results:  -rw-r--r--  1 root root 1229 Jul 21 12:12 /etc/fstab


Additional info:

This bug can cause existing, previously working, awk-scripts to fail.
It represents a change in the precendence of evaluation of gawk
expressions.
Comment 1 Thomas Woerner 2004-08-06 07:33:15 EDT
Please have a look at
http://lists.gnu.org/archive/html/bug-gnu-utils/2004-07/msg00046.html

> "da" "te" | getline
>
> This command is ambiguous, as it can be interpreted like:
>
>        ("da" "te") | getline
> or
>        "da" ("te" | getline)
>
> Older versions of gawk took the former, while 3.1.2 and newer take
> the later.  (Search gawk's ChangeLog file for "getline".)
> POSIX documentation mentions this specific situation: it says that
> the behaviour is undefined, and that you have to parenthesize.

Closing as not a bug.

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