bug-coreutils
[Top][All Lists]
Advanced

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

Re: Simplifying command line parsing with Genparse


From: Michael Geng
Subject: Re: Simplifying command line parsing with Genparse
Date: Sat, 23 Jun 2007 17:21:19 +0200
User-agent: Mutt/1.5.9i

On Sat, Jun 16, 2007 at 07:23:09PM +0200, Michael Geng wrote:
> On Thu, Jun 07, 2007 at 02:44:38PM +0200, Jim Meyering wrote:
> > However, before I even consider it seriously, it'll need
> > some improvements:
> > 
> >   - it must detect any and all write failures[*]
> 
> I just added a new release of genparse 
> (http://sourceforge.net/project/showfiles.php?group_id=4341&package_id=4354&release_id=516584)
> which now also checks file write and close operations, not only
> file open operations as it was before.
> 
> >   - packaging so that I can run ./configure && make && make check, and
> >       if I don't happen to have cppunit infrastructure, gcj or something
> >       similar, it should tell me about it directly, rather than causing
> >       harder-to-diagnose build failures.
> 
> I went through all these tools and updated configure.ac (and related files)
> such that you get a warning if something is missing but you can still
> compile genparse. For example if you don't have gcj installed then it 
> automatically removes the java example from the list of build targets.
> It now checks for cunit, cppunit, junit, gcj, doxygen, texi2html, texi2pdf 
> and man2html.
> 
> >   - one of the generated .c files I looked at calls strdup but doesn't
> >       check for a NULL return value or (less important) attempt to avoid
> >       the leak when the corresponding --backup=S option appears twice or 
> > more.
> 
> I'm working on that and I'll let you know when this is finished.

I again released a new version of genparse (0.6.5) which doesn't allocate
any memory on the heap any more because I think this is a better concept.
So it doesn't generate any calls to strdup() or malloc() any more. As a
consequence the parser function changed from 

struct arg_t *Cmdline(int argc, char *argv[]) 

to

void Cmdline(struct arg_t *my_args, int argc, char *argv[]). 

See the Genparse examples page (http://genparse.sourceforge.net/examples.html) 
which is also updated.

> 
> >   - not exactly essential, but highly recommended: it should work
> >       with the latest autoconf and automake
> 
> I'm using autoconf version 2.59 and automake 1.9.5. Aditionally I renamed 
> configure.in to configure.ac which appears to be the standard today and 
> removed acconfig.h because it appears to be deprecated. This might have
> produced some warnings before. 
> 
> > [*] with genparse-0.6.3, I get this:
> > 
> >   $ strace -o log -e write ./genparse -o /full/tmp/foo ../examples/ls.gp \
> >     && echo exit status 0
> >   creating /full/tmp/foo.h...done
> >   creating /full/tmp/foo.c...done
> >   exit status 0
> >   $ tail -2 log
> >   write(3, "/*******************************"..., 80) = -1 ENOSPC (No space 
> > left on device)
> >   write(1, "creating /full/tmp/foo.c...done\n", 32) = 32
> > 
> > The two files it claims to have created are both empty,
> > and genparse exited successfully.
> > This means genparse is not detecting write or close failures.
> > 
> > Note that in the example above, /full/tmp is a full file system that still
> > has free inodes, so open can create new files, but writes always fail.
> 
> I could verify this behavior and I hope it's fixed now. Now it tells you
> that it can't write to the file and returns with a non zero exit status.
> 
> Thanks again for your input,
> Michael
> 
> 
> _______________________________________________
> Bug-coreutils mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-coreutils




reply via email to

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