nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] address@hidden: Bug#140281: nano segfaults if it cannot


From: Chris Allegretta
Subject: Re: [Nano-devel] address@hidden: Bug#140281: nano segfaults if it cannot scan home dir]
Date: Fri, 29 Mar 2002 15:44:08 -0500
User-agent: Mutt/1.3.25i

> As root: 
> # sudo -u arudys nano -w ~arudys/.zshrc
> 
> Error in /root/.nanorc on line 96: Segmentation fault
> # ls -la /root/.nanorc
> ls: /root/.nanorc: No such file or directory
> 
> /root is 0700
> 
> Thanks,
> Algis R.

Hi Algis, others.

        There were several issues here.  The first was that nano was 
trying to report an error in do_rcfile() using a formatted string 
"Unable to open ~/.nanorc file, %s", and passing along with it an int 
(errnor) instead of a string (strerror(errno)).  This has been fixed.  
There was also some issues with the string format itself which are 
mostly fixed.  

There is one remaining issue.  That is, should nano rely on $HOME when
looking for .nanorc?  I wasn't sure so I wrote an alternative bit of
code to look into getpwent() for the userid returned by geteuid(), and
use that value instead of $HOME.  But perhaps this is not the Right
Thing.  

In trying to reproduce the bug, I noticed that $HOME was not being set
to the sudoed user, which is what got me thinking about this.  The man
page explains that the -H flag has to be used in order to set $HOME to
the user.  What should we do here?

Patch attached for inspection.

Chris A
-- 
Chris Allegretta        http://www.asty.org

"Share and Enjoy" - Douglas Adams, 1952 - 2001

Attachment: getpwent.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]