Bug 128345 - gawk: "str1 str2 | getline" no longer concatenates str1 str2
Summary: gawk: "str1 str2 | getline" no longer concatenates str1 str2
Alias: None
Product: Fedora
Classification: Fedora
Component: gawk (Show other bugs)
(Show other bugs)
Version: 2
Hardware: i386 Linux
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2004-07-21 23:20 UTC by George Hansper
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-06 11:33:15 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description George Hansper 2004-07-21 23:20:19 UTC
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

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):

How reproducible:

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

Comment 1 Thomas Woerner 2004-08-06 11:33:15 UTC
Please have a look at

> "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.