| Summary: | sudo -l inserts new lines based on terminal width, causing errors when output is piped. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Joel Davis <jodavis> | ||||||
| Component: | sudo | Assignee: | Daniel Kopeček <dkopecek> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Aleš Mareček <amarecek> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | medium | ||||||||
| Version: | 5.6 | CC: | amarecek, bturner, dkopecek, pvrabec | ||||||
| Target Milestone: | rc | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | sudo-1.7.2p1-11.el5 | Doc Type: | Bug Fix | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | |||||||||
| : | 810326 (view as bug list) | Environment: | |||||||
| Last Closed: | 2012-02-21 03:21:52 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 810326 | ||||||||
| Attachments: |
|
||||||||
Created attachment 492512 [details]
example sudoers
Created attachment 530206 [details]
proposed patch
(In reply to comment #4) > Created attachment 530206 [details] > proposed patch The attached patch adds a check to get_ttycols to detect whether stdout is a pipe and if so, sets the cols to 0, which effectively disables the internal word wrapping mechanism. 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. http://rhn.redhat.com/errata/RHSA-2012-0309.html |
Description of problem: If terminal's columns ("stty cols") is set to a width smaller than the width of the targeted line, then sudo -l inserts a newline at the terminal width before output. If the output is being pipe to grep it will result in only the part of the line with the match on it being returned. Version-Release number of selected component (if applicable): appears only in 1.7.2 veresions of the sudo package. How reproducible: reproducible on any package based on upstream. Reproduced on RHEL5.5 and later without issue. Issue isn't reproducible on earlier versions of the upstream. Steps to Reproduce: 1. create file larger than 80 characters (example used in my reproduction is attached). 2. manually set terminal to narrower width than large line (ex: stty 40) 3. execute a grep on sudo for a something found after the terminal break (in this example "SCM") Actual results: Only the line with the string searched for is printed, instead of the whole line. Expected results: entire line should be output by the grep command. Additional info: reproduced on RHEL 5.5 5.6 and Ubuntu 10.04 all with sudo-1.7.2 version of upstream Not reproducible on RHEL 5.4 with earlier version of the sudo package (sudo-1.6.9p17-5.el5)