Bug 428546 - visudo reports wrong line number on syntax error
visudo reports wrong line number on syntax error
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: sudo (Show other bugs)
8
All Linux
low Severity low
: ---
: ---
Assigned To: Peter Vrabec
Fedora Extras Quality Assurance
:
: 432395 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-12 22:02 EST by Jonathan Wakely
Modified: 2008-02-25 19:24 EST (History)
2 users (show)

See Also:
Fixed In Version: 1.6.9p4-4.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-25 19:24:57 EST
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 Jonathan Wakely 2008-01-12 22:02:13 EST
Description of problem:

If you create a syntax error near the end of /etc/sudoers then visudo will say:

>>> sudoers file: syntax error, line 95 <<<

If you choose to edit the file it conveniently moves you to the specified line.
 Unfortunately the line number is wrong.

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

sudo-1.6.9p4-3.fc8

How reproducible:
Always

Steps to Reproduce:
1. visudo
2. add a new line at the end, containing a syntax error
3. save and quit
4. choose to re-edit the file
  
Actual results:

Cursor is automatically placed on the wrong line.

Expected results:

Cursor should be on the line containing the syntax error.

Additional info:

This is caused by the following lines:

Defaults    env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
                        LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
                        LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
                        LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
                        LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
                        _XKB_CHARSET XAUTHORITY"

The escaped newlines confuse the line counter so that any syntax error after
env_keep will report the wrong line number.
Comment 1 Jonathan Wakely 2008-01-12 22:33:32 EST
Using += allows you to break the lines up without confusing the line numbers:

Defaults    env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR"       
Defaults    env_keep += "LS_COLORS MAIL PS1 PS2 QTDIR USERNAME"                
Defaults    env_keep += "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION"
Defaults    env_keep += "LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME
LC_NUMERIC"                                                                    
        Defaults    env_keep += "LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE
LINGUAS" Defaults    env_keep += "_XKB_CHARSET XAUTHORITY"

but I'll leave this bug open since the problem still exists
Comment 2 Peter Vrabec 2008-02-21 11:46:23 EST
*** Bug 432395 has been marked as a duplicate of this bug. ***
Comment 3 Fedora Update System 2008-02-21 12:51:08 EST
sudo-1.6.9p4-4.fc8 has been submitted as an update for Fedora 8
Comment 4 Fedora Update System 2008-02-25 19:24:55 EST
sudo-1.6.9p4-4.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

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