Bug 783

Summary: In detailed list option (-ll), blank lines are replaced by a previous line when piped or redirected to a file
Product: Sudo Reporter: Marc Beaudoin <M.Beaudoin>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.7.2   
Hardware: PC   
OS: AIX   
Attachments: Copy and paste of "sudo -ll" directed to the terminal (PUTTY)
Copy and paste of "sudo -ll | cat". Notice how blank lines are ofthen replaced by a previous non-blank line.

Description Marc Beaudoin 2017-04-26 11:38:49 MDT
Created attachment 491 [details]
Copy and paste of "sudo -ll" directed to the terminal (PUTTY)

"sudo -ll" works fine as long as it goes to a terminal.  When output is directed to a variable, a file or a pipe, output is different: replacing most blank lines with a previous line.

The bug appears on RHEL 5.11 (2.6.18-406.el5); the bug no longer exists on RHEL 7.3 (3.10.0-327.22.2.el7).

I shall attach output copy of "sudo -ll" and "sudo -ll | cat".

I guess this is a known bug that was fixed between RHEL 5.11 and RHEL 7.3, but I could not find it with your search engine.

I hope there is a workaround or a patch: upgrading the entire O/S is going to take lots of time.
Comment 1 Marc Beaudoin 2017-04-26 11:41:11 MDT
Created attachment 492 [details]
Copy and paste of "sudo -ll | cat".  Notice how blank lines are ofthen replaced by a previous non-blank line.
Comment 2 Todd C. Miller 2017-04-26 12:45:39 MDT
I'm quite certain this was fixed several years ago.  You can find updated sudo packages for RHEL 5 at https://www.sudo.ws/download.html#binary

It is probably easier to update the sudo package than to update the entire OS.
Comment 3 Marc Beaudoin 2017-04-26 13:36:30 MDT
It works!

My SysAdmin was brave enough to apply the new version of "sudo" on a production server before I had a chance to warn it.

We were both impressed that it worked.  I whish all RHEL programs could be supported this way.

Regards,
Marc.