Subject: Re: linuxls core dumps
To: None <current-users@netbsd.org>
From: Scott Barron <sb125499@oak.cats.ohiou.edu>
List: current-users
Date: 05/11/2002 09:48:12
On Sat, May 11, 2002 at 01:05:02PM +0200, Julio Merino wrote:
> Hi all
> 
> If you have linuxls installed, try the following: 
> 
> linuxls --color=auto
> 
> It coredumps for me. Using --color alone works fine, but when using = to
> add some argument, it fails. Maybe is a problem in gnu getopt? Or in
> linuxls?
> 
> Thanks.
> 
> -- 
> Of course it runs NetBSD - http://www.netbsd.org
> HispaBSD member - http://www.hispabsd.org
> Julio Merino <jmmv@hispabsd.org>

Hi,

Indeed it does coredump.  I think I've found the problem.  In src/ls.c
shouldnt the color_args array have a NULL terminator?  That's how its
checked in the argmatch() function (where a strncmp is causing the core
dump).  The reason you're getting the coredump is that "auto" is not one
of the valid color options in the color_args list so a for loop walks
right off the edge of this list doing bad things.

The cause of the failure is in the color-ls-3.12.0.2.patch.gz that
pkgsrc applies.  I'm not sure who maintains this or what the procedure
for patching a patch is.  Adding a NULL to the end of color_args (ends
up in src/ls.c:599 after the color-ls patch is applied) seems to correct
the problem.  What is the procedure for fixing this kind of patch (one
that is not in patches/ but fetched)?

Thanks,
-Scott