Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1454571

Summary: Sudo, with I/O Logging log_output option enabled, truncate output in case of cycle over standard input
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Perotti <aperotti>
Component: sudoAssignee: Radovan Sroka <rsroka>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: cww, dapospis, dkopecek, pkis, rsroka
Target Milestone: rcKeywords: Patch, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://bugzilla.sudo.ws/show_bug.cgi?id=786
Whiteboard:
Fixed In Version: sudo-1.8.19p2-12.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1454677 (view as bug list) Environment:
Last Closed: 2018-04-10 14:44:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851, 1454677    
Attachments:
Description Flags
script to replicate the error
none
Tests failed on RHEL6
none
Tests passed on RHEL6 + upstream sudo
none
Tests failes on RHEL7
none
Tests failed on RHEL7 + passed with upstream sudo
none
proposed patch none

Description Andrea Perotti 2017-05-23 05:23:05 UTC
Created attachment 1281317 [details]
script to replicate the error

Description of problem:

There's an issue with sudo, that is truncating output in stdout file descriptor upon log_output (io logging) option usage.

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

Affected and tested versions:
* RHEL6 sudo-1.8.6p3-25.el6_8.x86_64 rpm
* RHEL7 sudo-1.8.6p7-21.el7_3.x86_64 rpm
* RHEL7 sudo-1.8.19p2-1.el7_3.x86_64 BETA rpm

NOT Affected version:
* RHEL6 upstream sudo-1.8.20-1.el6.x86_64 rpm (http://ftp.sudo.ws/pub/sudo/packages/Centos/6/sudo-1.8.20-1.el6.x86_64.rpm)


How reproducible:
Always

Steps to Reproduce:

Just run this script (also attacched):

#!/bin/bash
printf "usqpsinfra1\nusqpsinfra2\n" | while read node; do sudo echo $node; done

Actual results:
only usqpsinfra1 is outputted:

$ bash -x test
+ read node
+ printf 'usqpsinfra1\nusqpsinfra2\n'
+ sudo echo usqpsinfra1
usqpsinfra1
+ read node
$

Expected results:
$ bash -x test
+ read node
+ printf 'usqpsinfra1\nusqpsinfra2\n'
+ sudo echo usqpsinfra1
usqpsinfra1
+ read node
+ sudo echo usqpsinfra2
usqpsinfra2
+ read node
$

Comment 2 Andrea Perotti 2017-05-23 05:24:06 UTC
Created attachment 1281318 [details]
Tests failed on RHEL6

Comment 3 Andrea Perotti 2017-05-23 05:24:54 UTC
Created attachment 1281319 [details]
Tests passed on RHEL6 + upstream sudo

Comment 4 Andrea Perotti 2017-05-23 05:25:35 UTC
Created attachment 1281320 [details]
Tests failes on RHEL7

Comment 5 Andrea Perotti 2017-05-23 05:26:58 UTC
Created attachment 1281321 [details]
Tests failed on RHEL7 + passed with upstream sudo

Comment 7 Andrea Perotti 2017-05-23 05:37:21 UTC
Outputting to STDERR the issue is not present:

$ cat test
#!/bin/bash -x
printf "usqpsinfra1\nusqpsinfra2\n" | while read node; do sudo echo $node; done
printf "usqpsinfra1err\nusqpsinfra2err\n" | while read node; do sudo echo $node 0>&1; done

$ ./test
+ printf 'usqpsinfra1\nusqpsinfra2\n'
+ read node
+ sudo echo usqpsinfra1
usqpsinfra1
+ read node #### <--- MISSING usqpsinfra2
+ read node
+ printf 'usqpsinfra1err\nusqpsinfra2err\n'
+ sudo echo usqpsinfra1err
usqpsinfra1err
+ read node
+ sudo echo usqpsinfra2err
usqpsinfra2err
+ read node
$

Comment 8 Andrea Perotti 2017-05-23 05:41:52 UTC
This looks like the upstream bug:
https://bugzilla.sudo.ws/show_bug.cgi?id=786

Comment 12 Daniel Kopeček 2017-05-23 08:25:22 UTC
Created attachment 1281364 [details]
proposed patch

Comment 27 errata-xmlrpc 2018-04-10 14:44:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0824